This commit is contained in:
Aurélien Plancke 2021-06-23 14:28:31 +02:00
commit 491c50ebc0
9 changed files with 55 additions and 28 deletions

View File

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

View File

@ -47,13 +47,14 @@ class PythonOrgSearch(unittest.TestCase):
def test_create_departement(self): def test_create_departement(self):
driver = self.driver driver = self.driver
driver.get(BASE_URL + "/scodoc_admin") driver.get(BASE_URL + "/scodoc_admin")
time.sleep(2)
select = Select(driver.find_element_by_id("CreateDept")) 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() driver.find_element_by_name("DeptId").submit()
time.sleep(1) time.sleep(1)
driver.find_element_by_id("tf_submit").click() driver.find_element_by_id("tf_submit").click()
driver.get(BASE_URL) 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 # 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 # @expected : Le département n'apparait plus sur la page d'accueil
@ -61,14 +62,14 @@ class PythonOrgSearch(unittest.TestCase):
driver = self.driver driver = self.driver
driver.get(BASE_URL + "/scodoc_admin") driver.get(BASE_URL + "/scodoc_admin")
select = Select(driver.find_element_by_id("DeleteDept")) 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.find_element_by_id("DeleteDept").submit()
driver.get(BASE_URL) driver.get(BASE_URL)
self.assertTrue("TESTCREATEDPT" not in driver.page_source) self.assertTrue(NOM_DPT not in driver.page_source)
cmdProcess = [ cmdProcess = [
"./scriptDeleteDepartement.sh", "./scriptDeleteDepartement.sh",
LINK_SCODOC_SERVER, LINK_SCODOC_SERVER,
"TESTCREATEDPT", NOM_DPT,
] ]
process = subprocess.Popen(cmdProcess) process = subprocess.Popen(cmdProcess)
process.wait() process.wait()
@ -80,7 +81,10 @@ class PythonOrgSearch(unittest.TestCase):
if __name__ == "__main__": 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 = subprocess.Popen(cmdProcess)
process.wait() process.wait()
unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output="./output")) unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output="./output"))

View File

@ -129,8 +129,6 @@ class PythonOrgSearch(unittest.TestCase):
self.assertTrue("TEST UE TEST" in driver.page_source) self.assertTrue("TEST UE TEST" in driver.page_source)
driver.get(URL) driver.get(URL)
self.assertTrue((NOM_DPT.upper() + "-" + "DUT" + "--") in driver.page_source)
# Test : Ajout d'une matière dans la formation # 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 # @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): def test_015_ajout_matiere(self):
@ -236,11 +234,12 @@ class PythonOrgSearch(unittest.TestCase):
"//input[@value='Supprimer cette formation']" "//input[@value='Supprimer cette formation']"
).click() ).click()
driver.get(URL) driver.get(URL)
try: formations = driver.find_elements_by_class_name("version")
driver.find_element_by_id(idButtonDelete) formationDelete = True
self.assertTrue(False) for formation in formations:
except NoSuchElementException: if "1" in formation.text:
self.assertTrue(True) formationDelete = False
self.assertTrue(formationDelete)
# def test_create_module(self): # def test_create_module(self):
# driver = self.driver # driver = self.driver

View File

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

View File

@ -151,6 +151,9 @@ class PythonOrgSearch(unittest.TestCase):
if __name__ == "__main__": 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] cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess) process = subprocess.Popen(cmdProcess)
process.wait() process.wait()

View File

@ -58,6 +58,7 @@ class PythonOrgSearch(unittest.TestCase):
self.driver.find_element_by_name("__ac_password").send_keys( self.driver.find_element_by_name("__ac_password").send_keys(
SCODOC_CHEF_PASS SCODOC_CHEF_PASS
) )
time.sleep(3)
self.driver.find_element_by_name("submit").click() self.driver.find_element_by_name("submit").click()
elif isEns: elif isEns:
self.driver.find_element_by_name("__ac_name").send_keys(SCODOC_ENS_ID) self.driver.find_element_by_name("__ac_name").send_keys(SCODOC_ENS_ID)
@ -132,6 +133,7 @@ class PythonOrgSearch(unittest.TestCase):
driver = self.driver driver = self.driver
global URL_MATIERE global URL_MATIERE
driver.get(URL_MATIERE) driver.get(URL_MATIERE)
time.sleep(2)
driver.find_element_by_partial_link_text("modifier les enseignants").click() driver.find_element_by_partial_link_text("modifier les enseignants").click()
time.sleep(1) time.sleep(1)
constructIDEns = ( constructIDEns = (
@ -156,6 +158,7 @@ class PythonOrgSearch(unittest.TestCase):
def test_040_creation_interrogation(self): def test_040_creation_interrogation(self):
descriptionInterrogation = "Interrogation numero 2" descriptionInterrogation = "Interrogation numero 2"
driver = self.driver driver = self.driver
global URL_MATIERE
driver.get( driver.get(
"https://" "https://"
+ SCODOC_ADMIN_ID + SCODOC_ADMIN_ID
@ -299,6 +302,7 @@ class PythonOrgSearch(unittest.TestCase):
time.sleep(1) time.sleep(1)
time.sleep(1) time.sleep(1)
driver.get(URL_MATIERE) driver.get(URL_MATIERE)
time.sleep(5)
self.assertTrue(SCODOC_ENS_ID not in driver.page_source) self.assertTrue(SCODOC_ENS_ID not in driver.page_source)
# Test : Suppresion du reste des interrogations sans notes # Test : Suppresion du reste des interrogations sans notes
@ -330,6 +334,9 @@ if __name__ == "__main__":
driver = webdriver.Firefox() driver = webdriver.Firefox()
else: else:
driver = webdriver.Chrome() 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] cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess) process = subprocess.Popen(cmdProcess)
process.wait() process.wait()
@ -363,7 +370,7 @@ if __name__ == "__main__":
if nom.text.lower() == SCODOC_ENS_ID.lower(): if nom.text.lower() == SCODOC_ENS_ID.lower():
ensCree = True ensCree = True
if not chefCree: if not chefCree:
time.sleep(5) time.sleep(2)
constructValue = "Ens" + NOM_DPT constructValue = "Ens" + NOM_DPT
driver.find_element_by_id("creer_Utilisateur").click() driver.find_element_by_id("creer_Utilisateur").click()
driver.find_element_by_id("tf_nom").send_keys(SCODOC_CHEF_ID) driver.find_element_by_id("tf_nom").send_keys(SCODOC_CHEF_ID)
@ -372,11 +379,11 @@ if __name__ == "__main__":
driver.find_element_by_id("tf_passwd").send_keys(SCODOC_CHEF_PASS) 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_id("tf_passwd2").send_keys(SCODOC_CHEF_PASS)
driver.find_element_by_xpath("//input[@value='" + constructValue + "']").click() 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("tf_submit").click()
driver.find_element_by_id("utilisateurs_Vue").click() driver.find_element_by_id("utilisateurs_Vue").click()
if not ensCree: if not ensCree:
time.sleep(5) time.sleep(2)
constructValue = "Ens" + NOM_DPT constructValue = "Ens" + NOM_DPT
driver.find_element_by_id("creer_Utilisateur").click() 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_nom").send_keys(SCODOC_ENS_ID)

View File

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

View File

@ -219,6 +219,9 @@ class PythonOrgSearch(unittest.TestCase):
if __name__ == "__main__": 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] cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
process = subprocess.Popen(cmdProcess) process = subprocess.Popen(cmdProcess)
process.wait() process.wait()

Binary file not shown.