fix bug ajout enseignant

This commit is contained in:
Aurélien Plancke 2021-06-03 15:34:04 +02:00
parent 9fe52f9960
commit 92f7bda362
2 changed files with 41 additions and 27 deletions

View File

@ -26,7 +26,7 @@ from selenium.webdriver.support.select import Select
URL_MATIERE = ""
URL_SEMESTRE = ""
URL = BASE_URL + NOM_DPT + "/Scolarite"
PRENOM_ENS = "Ens"
# Prérequis
class PythonOrgSearch(unittest.TestCase):
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
@ -37,19 +37,19 @@ class PythonOrgSearch(unittest.TestCase):
self.driver = webdriver.Chrome()
self.wait = WebDriverWait(self.driver, 10)
self.driver.get(
"https://"
+ SCODOC_ADMIN_ID
+ ":"
+ SCODOC_ADMIN_PASS
+ "@"
+ BASE_NOT_SECURED_URL
+ "force_admin_authentication"
)
"https://"
+ SCODOC_ADMIN_ID
+ ":"
+ SCODOC_ADMIN_PASS
+ "@"
+ BASE_NOT_SECURED_URL
+ "force_admin_authentication"
)
self.wait = WebDriverWait(self.driver, 10)
#self.driver.get(self.url)
#self.driver.find_element_by_id("name").send_keys(SCODOC_ENS_ID)
#self.driver.find_element_by_id("password").send_keys(SCODOC_ENS_PASS)
#self.driver.find_element_by_id("submit").click()
# self.driver.get(self.url)
# self.driver.find_element_by_id("name").send_keys(SCODOC_ENS_ID)
# self.driver.find_element_by_id("password").send_keys(SCODOC_ENS_PASS)
# self.driver.find_element_by_id("submit").click()
# Test : Vérifie s'il y a un semestre en cours
# @expected : La class listesems n'est pas vide et contient "Session en cours"
@ -57,7 +57,7 @@ class PythonOrgSearch(unittest.TestCase):
driver = self.driver
global URL
driver.get(URL)
#time.sleep(1)
# time.sleep(1)
self.assertTrue(
"Sessions en cours" in driver.find_element_by_class_name("listesems").text
)
@ -82,13 +82,13 @@ class PythonOrgSearch(unittest.TestCase):
# @expected : Le nom de l'enseignant apparait désormais sur la page d'information du module
def test_030_ajout_enseignant_sur_module(self):
driver = self.driver
#driver.get(BASE_URL)
#driver.find_element_by_link_text("déconnecter").click()
#driver.get(BASE_URL)
#driver.find_element_by_id("name").send_keys(SCODOC_CHEF_ID)
#driver.find_element_by_id("password").send_keys(SCODOC_CHEF_PASS)
#driver.find_element_by_id("submit").click()
#global URL_SEMESTRE
# driver.get(BASE_URL)
# driver.find_element_by_link_text("déconnecter").click()
# driver.get(BASE_URL)
# driver.find_element_by_id("name").send_keys(SCODOC_CHEF_ID)
# driver.find_element_by_id("password").send_keys(SCODOC_CHEF_PASS)
# driver.find_element_by_id("submit").click()
# global URL_SEMESTRE
driver.get(URL_SEMESTRE)
driver.find_element_by_link_text("M4101C").click()
time.sleep(1)
@ -96,9 +96,21 @@ class PythonOrgSearch(unittest.TestCase):
URL_MATIERE = driver.current_url
driver.find_element_by_partial_link_text("modifier les enseignants").click()
time.sleep(1)
driver.find_element_by_id("ens_id").send_keys("ENSEIGNANT Test (enseignantUS)")
constructIDEns = (
SCODOC_ENS_ID.upper()
+ " "
+ PRENOM_ENS
+ " ("
+ SCODOC_ENS_ID.lower()
+ ")"
)
print(constructIDEns)
driver.find_element_by_id("ens_id").send_keys(constructIDEns)
time.sleep(5)
driver.find_element_by_id("tf_submit").click()
time.sleep(1)
driver.get(URL_MATIERE)
self.assertTrue("Enseignants du" in driver.page_source)
self.assertTrue(SCODOC_ENS_ID in driver.page_source)
@ -124,6 +136,7 @@ class PythonOrgSearch(unittest.TestCase):
time.sleep(1)
driver.find_element_by_link_text("Créer nouvelle évaluation").click()
time.sleep(1)
driver.find_element_by_name("jour").clear()
driver.find_element_by_name("jour").send_keys("31/05/2021")
driver.find_element_by_id("tf_description").send_keys(descriptionInterrogation)
driver.find_element_by_id("tf_coefficient").send_keys("2")
@ -148,7 +161,8 @@ class PythonOrgSearch(unittest.TestCase):
driver = self.driver
global URL_MATIERE
driver.get(URL_MATIERE)
time.sleep(1)
print(URL_MATIERE)
time.sleep(10)
driver.find_element_by_class_name("notes_img").click()
time.sleep(1)
element = driver.find_element_by_class_name("note")
@ -312,9 +326,9 @@ if __name__ == "__main__":
chefCree = False
ensCree = False
for nom in noms:
if(nom.text.lower() == SCODOC_CHEF_ID.lower()):
if nom.text.lower() == SCODOC_CHEF_ID.lower():
chefCree = True
if(nom.text.lower() == SCODOC_ENS_ID.lower()):
if nom.text.lower() == SCODOC_ENS_ID.lower():
ensCree = True
if not chefCree:
time.sleep(5)
@ -335,7 +349,7 @@ if __name__ == "__main__":
driver.find_element_by_id("creer_Utilisateur").click()
driver.find_element_by_id("tf_nom").send_keys(SCODOC_ENS_ID)
driver.find_element_by_id("tf_user_name").send_keys(SCODOC_ENS_ID)
driver.find_element_by_id("tf_prenom").send_keys("ens")
driver.find_element_by_id("tf_prenom").send_keys(PRENOM_ENS)
driver.find_element_by_id("tf_passwd").send_keys(SCODOC_ENS_PASS)
driver.find_element_by_id("tf_passwd2").send_keys(SCODOC_ENS_PASS)
driver.find_element_by_xpath("//input[@value='" + constructValue + "']").click()
@ -343,4 +357,4 @@ if __name__ == "__main__":
driver.find_element_by_id("tf_submit").click()
driver.find_element_by_id("utilisateurs_Vue").click()
driver.close()
unittest.main(warnings='ignore')
unittest.main(warnings="ignore")

Binary file not shown.