fix attente changement de page

This commit is contained in:
Aurélien Plancke 2021-06-08 17:04:07 +02:00
parent 5cda25ad04
commit a96041d3f1
1 changed files with 24 additions and 14 deletions

View File

@ -49,6 +49,8 @@ class PythonOrgSearch(unittest.TestCase):
+ "force_admin_authentication"
)
# Test: Ajout de note pour deux élèves dans une seule UE et vérifie si la moyenne de cet UE sur la fiche étudiante correspondant à la valeur rentrée
# @expected : La note rentrée et la moyenne sont identiques
def test_010_ajout_note_multiple_pour_une_ue(self):
global listeEtudiant
global MOY_UE1
@ -58,6 +60,7 @@ class PythonOrgSearch(unittest.TestCase):
driver.get(url)
linkAddNote = "formnotes_note_"
driver.find_element_by_link_text("semestre 1").click()
self.wait.until(EC.url_changes(url))
URL_SEMESTRE = driver.current_url
ue_name = driver.find_elements_by_class_name("status_ue_acro")[0].text
driver.find_element_by_link_text("M1101").click()
@ -83,7 +86,7 @@ class PythonOrgSearch(unittest.TestCase):
searchBar = driver.find_element_by_id("in-expnom")
searchBar.send_keys(etudiant)
searchBar.submit()
self.wait.until(EC.url_changes(URL_SEMESTRE))
time.sleep(5)
MOY_UE1 = driver.find_element_by_id("ue_" + ue_name).text
if "12" not in MOY_UE1:
noteBonne = False
@ -138,10 +141,11 @@ class PythonOrgSearch(unittest.TestCase):
driver.get(URL_SEMESTRE)
noteBonne = True
for etudiant in listeEtudiant:
URL = driver.current_url
searchBar = driver.find_element_by_id("in-expnom")
searchBar.send_keys(etudiant)
searchBar.submit()
self.wait.until(EC.url_changes(URL_SEMESTRE))
time.sleep(5)
MOY_UE2 = driver.find_element_by_id("ue_" + ue_name).text
if "8" not in MOY_UE2:
noteBonne = False
@ -152,6 +156,8 @@ class PythonOrgSearch(unittest.TestCase):
global listeEtudiant
global MOY_UE1
global MOY_UE2
coeffUE1 = 2
coeffUE2 = 2
driver = self.driver
url = self.url
driver.get(url)
@ -160,45 +166,49 @@ class PythonOrgSearch(unittest.TestCase):
searchBar = driver.find_element_by_id("in-expnom")
searchBar.send_keys(etudiant)
searchBar.submit()
self.wait.until(EC.url_changes(URL_SEMESTRE))
if (MOY_UE1 * 2 + MOY_UE2 * 2) / 2 not in driver.find_element_by_id(
"ue_" + ue_name
).text:
self.wait.until(EC.url_changes(url))
if (
(float(MOY_UE1) * coeffUE1 + float(MOY_UE2) * coeffUE2)
/ (coeffUE1 + coeffUE2)
) != float(driver.find_element_by_class_name("rcp_moy").text):
moyenneBonne = False
self.assertTrue(moyenneBonne)
def test_040_modification_coefficiant_module(self):
global listeEtudiant
moyUE1 = 3
coeffUE1 = 3
coeffUE2 = 2
driver = self.driver
url = self.url
driver.get(url)
URL = driver.current_url
driver.find_element_by_id("ProgrammesLink").click()
driver.find_element_by_id("titre_DUT Info").click()
driver.find_element_by_xpath("//span[contains(text(),'M1101')]").click()
driver.find_element_by_id("tf_coefficient").clear()
driver.find_element_by_id("tf_coefficient").send_keys("3")
driver.find_element_by_id("tf_coefficient").send_keys(moyUE1)
driver.find_element_by_id("tf_submit").click()
self.wait.until(EC.url_changes(URL))
moyenneBonne = True
for etudiant in listeEtudiant:
URL = driver.current_url
searchBar = driver.find_element_by_id("in-expnom")
searchBar.send_keys(etudiant)
searchBar.submit()
self.wait.until(EC.url_changes(URL_SEMESTRE))
self.wait.until(EC.url_changes(URL))
if (
MOY_UE1 * moyUE1 + MOY_UE2 * coeffUE2
) / 2 not in driver.find_element_by_class(rcp_moy).text:
(float(MOY_UE1) * coeffUE1 + float(MOY_UE2) * coeffUE2)
/ (coeffUE1 + coeffUE2)
) != float(driver.find_element_by_class_name("rcp_moy").text):
moyenneBonne = False
self.assertTrue(moyenneBonne)
def tearDown(self):
self.driver.close()
if __name__ == "__main__":
if NAVIGATEUR == "firefox":
driver = webdriver.Firefox()
else:
driver = webdriver.Chrome()
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess)
process.wait()