fix bug sur différents tests

This commit is contained in:
Aurelien PLANCKE 2021-06-21 15:19:30 +02:00
parent 4ead3eb9f3
commit 545be29ac6
9 changed files with 77 additions and 32 deletions

View File

@ -3,9 +3,9 @@ NOM_DPT = "test01"
SCODOC_ADMIN_ID = "admin_id"
SCODOC_ADMIN_PASS = "admin_password"
SCODOC_ENS_ID = "enseignant_id"
SCODOC_ENS_PASS = "enseignant_password"
SCODOC_ENS_PASS = "enseignant_password@10"
SCODOC_CHEF_ID = "chef_id"
SCODOC_CHEF_PASS = "password"
SCODOC_CHEF_PASS = "p@ssword42@"
LINK_SCODOC_SERVER = "root@ssh_server_scodoc"
BASE_NOT_SECURED_URL = "scodoc-dev-iutinfo.univ-lille.fr/"
NAVIGATEUR = "firefox"

View File

@ -46,13 +46,14 @@ class PythonOrgSearch(unittest.TestCase):
def test_create_departement(self):
driver = self.driver
driver.get(BASE_URL + "/scodoc_admin")
time.sleep(2)
select = Select(driver.find_element_by_id("CreateDept"))
select.select_by_visible_text("TESTCREATEDPT")
select.select_by_visible_text(NOM_DPT)
driver.find_element_by_name("DeptId").submit()
time.sleep(1)
driver.find_element_by_id("tf_submit").click()
driver.get(BASE_URL)
self.assertTrue("TESTCREATEDPT" in driver.page_source)
self.assertTrue(NOM_DPT in driver.page_source)
# Test : Suppresion d'un département, puis lancement d'un script coté serveur pour supprimer sa base de données
# @expected : Le département n'apparait plus sur la page d'accueil
@ -60,14 +61,14 @@ class PythonOrgSearch(unittest.TestCase):
driver = self.driver
driver.get(BASE_URL + "/scodoc_admin")
select = Select(driver.find_element_by_id("DeleteDept"))
select.select_by_visible_text("TESTCREATEDPT")
select.select_by_visible_text(NOM_DPT)
driver.find_element_by_id("DeleteDept").submit()
driver.get(BASE_URL)
self.assertTrue("TESTCREATEDPT" not in driver.page_source)
self.assertTrue(NOM_DPT not in driver.page_source)
cmdProcess = [
"./scriptDeleteDepartement.sh",
LINK_SCODOC_SERVER,
"TESTCREATEDPT",
NOM_DPT,
]
process = subprocess.Popen(cmdProcess)
process.wait()
@ -79,7 +80,10 @@ class PythonOrgSearch(unittest.TestCase):
if __name__ == "__main__":
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, "TESTCREATEDPT"]
cmdProcess = ["./scriptDeleteDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess)
process.wait()
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess)
process.wait()
unittest.main()

View File

@ -131,8 +131,6 @@ class PythonOrgSearch(unittest.TestCase):
)
driver.get(URL)
self.assertTrue((NOM_DPT.upper() + "-" + "DUT" + "--") in driver.page_source)
# Test : Ajout d'une matière dans la formation
# @Expected : La matière est créée et elle apparait désormais sur la page de détail de la formation
def test_015_ajout_matiere(self):
@ -231,11 +229,12 @@ class PythonOrgSearch(unittest.TestCase):
"//input[@value='Supprimer cette formation']"
).click()
driver.get(URL)
try:
driver.find_element_by_id(idButtonDelete)
self.assertTrue(False)
except NoSuchElementException:
self.assertTrue(True)
formations = driver.find_elements_by_class_name("version")
formationDelete = True
for formation in formations:
if "1" in formation.text:
formationDelete = False
self.assertTrue(formationDelete)
# def test_create_module(self):
# driver = self.driver
@ -247,10 +246,28 @@ class PythonOrgSearch(unittest.TestCase):
if __name__ == "__main__":
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess)
process.wait()
unittest.main()
cmdProcess = ["./scriptDeleteDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess)
process.wait()
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess)
process.wait()
#driver = webdriver.Firefox()
#driver.get(
# "https://"
# + SCODOC_ADMIN_ID
# + ":"
# + SCODOC_ADMIN_PASS
# + "@"
# + BASE_NOT_SECURED_URL
# + "force_admin_authentication"
# )
#driver.get(BASE_URL + "/scodoc_admin")
#time.sleep(2)
#select = Select(driver.find_element_by_id("CreateDept"))
#select.select_by_visible_text(NOM_DPT)
#driver.find_element_by_name("DeptId").submit()
#time.sleep(1)
#driver.find_element_by_id("tf_submit").click()
#driver.close()
unittest.main()

View File

@ -129,8 +129,14 @@ class PythonOrgSearch(unittest.TestCase):
self.assertFalse(True)
semestres[0].click()
driver.find_element_by_xpath("//input[@value='Inscrire']").click()
self.assertTrue("inscrit" in driver.page_source)
time.sleep(1)
time.sleep(2)
boutonInscrireIsNotPresent = False
try:
driver.find_element_by_partial_link_text("inscrire")
except:
boutonInscrireIsNotPresent = True
self.assertTrue(boutonInscrireIsNotPresent)
# Test Supprime un étudiant
# @expected : Lors d'une recherche sur le nom de l'étudiant, aucun résultat apparait
@ -175,6 +181,9 @@ class PythonOrgSearch(unittest.TestCase):
if __name__ == "__main__":
cmdProcess = ["./scriptDeleteDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess)
process.wait()
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess)
process.wait()

View File

@ -150,6 +150,9 @@ class PythonOrgSearch(unittest.TestCase):
if __name__ == "__main__":
cmdProcess = ["./scriptDeleteDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess)
process.wait()
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess)
process.wait()

View File

@ -57,6 +57,7 @@ class PythonOrgSearch(unittest.TestCase):
self.driver.find_element_by_name("__ac_password").send_keys(
SCODOC_CHEF_PASS
)
time.sleep(3)
self.driver.find_element_by_name("submit").click()
elif isEns:
self.driver.find_element_by_name("__ac_name").send_keys(SCODOC_ENS_ID)
@ -131,6 +132,7 @@ class PythonOrgSearch(unittest.TestCase):
driver = self.driver
global URL_MATIERE
driver.get(URL_MATIERE)
time.sleep(2)
driver.find_element_by_partial_link_text("modifier les enseignants").click()
time.sleep(1)
constructIDEns = (
@ -155,6 +157,7 @@ class PythonOrgSearch(unittest.TestCase):
def test_040_creation_interrogation(self):
descriptionInterrogation = "Interrogation numero 2"
driver = self.driver
global URL_MATIERE
driver.get(
"https://"
+ SCODOC_ADMIN_ID
@ -298,6 +301,7 @@ class PythonOrgSearch(unittest.TestCase):
time.sleep(1)
time.sleep(1)
driver.get(URL_MATIERE)
time.sleep(5)
self.assertTrue(SCODOC_ENS_ID not in driver.page_source)
# Test : Suppresion du reste des interrogations sans notes
@ -329,6 +333,9 @@ if __name__ == "__main__":
driver = webdriver.Firefox()
else:
driver = webdriver.Chrome()
cmdProcess = ["./scriptDeleteDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess)
process.wait()
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess)
process.wait()
@ -362,7 +369,7 @@ if __name__ == "__main__":
if nom.text.lower() == SCODOC_ENS_ID.lower():
ensCree = True
if not chefCree:
time.sleep(5)
time.sleep(2)
constructValue = "Ens" + NOM_DPT
driver.find_element_by_id("creer_Utilisateur").click()
driver.find_element_by_id("tf_nom").send_keys(SCODOC_CHEF_ID)
@ -371,11 +378,11 @@ if __name__ == "__main__":
driver.find_element_by_id("tf_passwd").send_keys(SCODOC_CHEF_PASS)
driver.find_element_by_id("tf_passwd2").send_keys(SCODOC_CHEF_PASS)
driver.find_element_by_xpath("//input[@value='" + constructValue + "']").click()
driver.find_element_by_xpath("//input[@value='force:list']").click()
driver.find_element_by_xpath("//input[@name='force:list']").click()
driver.find_element_by_id("tf_submit").click()
driver.find_element_by_id("utilisateurs_Vue").click()
if not ensCree:
time.sleep(5)
time.sleep(2)
constructValue = "Ens" + NOM_DPT
driver.find_element_by_id("creer_Utilisateur").click()
driver.find_element_by_id("tf_nom").send_keys(SCODOC_ENS_ID)

View File

@ -83,7 +83,7 @@ class PythonOrgSearch(unittest.TestCase):
self.wait.until(EC.url_changes(URL))
driver.get(URL_SEMESTRE)
noteBonne = True
print(listeEtudiant)
#print(listeEtudiant)
for etudiant in listeEtudiant:
searchBar = driver.find_element_by_id("in-expnom")
searchBar.send_keys(etudiant)
@ -262,7 +262,6 @@ class PythonOrgSearch(unittest.TestCase):
numeroEtu = 0
moyenneBonne = True
affichageMoyenne = True
ueList = []
for etudiant in listeEtudiant:
URL = driver.current_url
searchBar = driver.find_element_by_id("in-expnom")
@ -335,12 +334,12 @@ class PythonOrgSearch(unittest.TestCase):
float(MOY_UE1_EXC) * COEFF_UE1
+ ((float(MOY_UE2) + float(moyenneBonusEtudiant1)) * COEFF_UE2)
) / (COEFF_UE1 + COEFF_UE2)
print(format(moyEtudiant1, "2.2f"))
print(
format(
float(driver.find_element_by_class_name("rcp_moy").text), "2.2f"
)
)
#print(format(moyEtudiant1, "2.2f"))
#print(
# format(
# float(driver.find_element_by_class_name("rcp_moy").text), "2.2f"
# )
#)
if format(moyEtudiant1, "2.2f") != format(
float(driver.find_element_by_class_name("rcp_moy").text), "2.2f"
):
@ -431,6 +430,9 @@ class PythonOrgSearch(unittest.TestCase):
if __name__ == "__main__":
cmdProcess = ["./scriptDeleteDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess)
process.wait()
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess)
process.wait()

View File

@ -218,6 +218,9 @@ class PythonOrgSearch(unittest.TestCase):
if __name__ == "__main__":
cmdProcess = ["./scriptDeleteDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess)
process.wait()
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess)
process.wait()

Binary file not shown.