ScodocTestClient/02_creation_formation_test.py
2021-05-06 20:28:56 +02:00

53 lines
1.7 KiB
Python

import unittest
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.select import Select
SCODOC_ADMIN_ID = "admin"
SCODOC_ADMIN_PASS = "root_pass_42"
nomDpt = "AurelienUS"
baseURL = "https://scodoc-dev-iutinfo.univ-lille.fr"
class PythonOrgSearch(unittest.TestCase):
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
def setUp(self):
self.driver = webdriver.Firefox()
self.driver.get(
"https://"
+ SCODOC_ADMIN_ID
+ ":"
+ SCODOC_ADMIN_PASS
+ "@scodoc-dev-iutinfo.univ-lille.fr/force_admin_authentication"
)
self.driver.get(baseURL + "/ScoDoc")
# Test Creer une formation
# @expected :
def test_create_formation(self):
driver = self.driver
url = baseURL + "/ScoDoc/" + nomDpt + "/Scolarite/Notes/formation_create"
driver.get(url)
select = Select(driver.find_element_by_name("DeptId"))
select.select_by_visible_text("TESTDPT")
self.assertTrue(select.first_selected_option.text == "TESTDPT")
element = driver.find_element_by_name("DeptId")
element = driver.find_element_by_id("gtrcontent").find_element_by_tag_name("h6")
element.submit()
time.sleep(2)
driver.get(baseURL + "/ScoDoc")
self.assertTrue("TESTDPT" in driver.page_source)
# def test_create_module(self):
# driver = self.driver
# element = driver.find_element_by_name("TESTDPT")
# ferme la fenetre à chaque fin de test
def tearDown(self):
self.driver.close()
if __name__ == "__main__":
unittest.main()