refractoring, ajout de nouveaux test, correction de bug
This commit is contained in:
parent
b7f3830b2f
commit
e9269992fe
@ -8,3 +8,4 @@ SCODOC_CHEF_ID = "chef_id"
|
||||
SCODOC_CHEF_PASS = "password"
|
||||
LINK_SCODOC_SERVER = "root@ssh_server_scodoc"
|
||||
BASE_NOT_SECURED_URL = "scodoc-dev-iutinfo.univ-lille.fr/"
|
||||
NAVIGATEUR = "firefox"
|
@ -18,9 +18,6 @@ from selenium.webdriver.support.select import Select
|
||||
|
||||
|
||||
class PythonOrgSearch(unittest.TestCase):
|
||||
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, "TESTCREATEDPT"]
|
||||
process = subprocess.Popen(cmdProcess)
|
||||
process.wait()
|
||||
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
||||
def setUp(self):
|
||||
if NAVIGATEUR == "firefox":
|
||||
@ -82,4 +79,7 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, "TESTCREATEDPT"]
|
||||
process = subprocess.Popen(cmdProcess)
|
||||
process.wait()
|
||||
unittest.main()
|
@ -25,9 +25,6 @@ ACRONYME_FORMATION = "FormationTEST"
|
||||
|
||||
|
||||
class PythonOrgSearch(unittest.TestCase):
|
||||
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
|
||||
process = subprocess.Popen(cmdProcess)
|
||||
process.wait()
|
||||
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
||||
def setUp(self):
|
||||
if NAVIGATEUR == "firefox":
|
||||
@ -181,4 +178,7 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
|
||||
process = subprocess.Popen(cmdProcess)
|
||||
process.wait()
|
||||
unittest.main()
|
@ -29,17 +29,6 @@ paysdomicile = "Lille"
|
||||
|
||||
|
||||
class PythonOrgSearch(unittest.TestCase):
|
||||
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
|
||||
process = subprocess.Popen(cmdProcess)
|
||||
process.wait()
|
||||
cmdProcess = [
|
||||
"./scriptExecution.sh",
|
||||
LINK_SCODOC_SERVER,
|
||||
NOM_DPT,
|
||||
"test_scenario1_formation.py",
|
||||
]
|
||||
process = subprocess.Popen(cmdProcess)
|
||||
process.wait()
|
||||
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
||||
def setUp(self):
|
||||
if NAVIGATEUR == "firefox":
|
||||
@ -188,4 +177,15 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
|
||||
process = subprocess.Popen(cmdProcess)
|
||||
process.wait()
|
||||
cmdProcess = [
|
||||
"./scriptExecution.sh",
|
||||
LINK_SCODOC_SERVER,
|
||||
NOM_DPT,
|
||||
"test_scenario1_formation.py",
|
||||
]
|
||||
process = subprocess.Popen(cmdProcess)
|
||||
process.wait()
|
||||
unittest.main()
|
@ -22,21 +22,10 @@ URL = BASE_URL + NOM_DPT + "/Scolarite"
|
||||
NOM_ETU = "Semestre11"
|
||||
PRENOM_ETU = "EtudiantNumero1"
|
||||
dateDebutAbsenceNonJustifiee = "31/05/2021"
|
||||
dateDebutAbsenceJustifiee = "30/05/2021"
|
||||
dateDebutAbsenceJustifiee = "25/05/2021"
|
||||
|
||||
|
||||
class PythonOrgSearch(unittest.TestCase):
|
||||
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
|
||||
process = subprocess.Popen(cmdProcess)
|
||||
process.wait()
|
||||
cmdProcess = [
|
||||
"./scriptExecution.sh",
|
||||
LINK_SCODOC_SERVER,
|
||||
NOM_DPT,
|
||||
"test_scenario2_formation.py",
|
||||
]
|
||||
process = subprocess.Popen(cmdProcess)
|
||||
process.wait()
|
||||
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
||||
def setUp(self):
|
||||
if NAVIGATEUR == "firefox":
|
||||
@ -98,7 +87,7 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
driver.find_element_by_name("datedebut").send_keys(dateDebutAbsenceJustifiee)
|
||||
driver.find_element_by_name("estjust").click()
|
||||
driver.find_element_by_id("butsubmit").submit()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
time.sleep(1)
|
||||
self.assertTrue("Ajout de 2 absences <b>justifiées</b>" in driver.page_source)
|
||||
driver = self.driver
|
||||
driver.find_element_by_link_text("Liste").click()
|
||||
@ -141,7 +130,7 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
driver.find_element_by_xpath("//input[@value='Supprimer les absences']").click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
self.assertTrue("Annulation sur 2 demi-journées " in driver.page_source)
|
||||
driver.find_element_by_id("supprimer_Absence ").click()
|
||||
driver.find_element_by_id("supprimer_Absence").click()
|
||||
driver.find_element_by_name("datedebut").send_keys(dateDebutAbsenceNonJustifiee)
|
||||
driver.find_element_by_xpath("//input[@value='Supprimer les absences']").click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
@ -161,4 +150,15 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT]
|
||||
process = subprocess.Popen(cmdProcess)
|
||||
process.wait()
|
||||
cmdProcess = [
|
||||
"./scriptExecution.sh",
|
||||
LINK_SCODOC_SERVER,
|
||||
NOM_DPT,
|
||||
"test_scenario2_formation.py",
|
||||
]
|
||||
process = subprocess.Popen(cmdProcess)
|
||||
process.wait()
|
||||
unittest.main()
|
@ -64,10 +64,6 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
SCODOC_ENS_PASS
|
||||
)
|
||||
self.driver.find_element_by_name("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"
|
||||
@ -96,49 +92,14 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
except NoSuchElementException:
|
||||
self.assertFalse(False)
|
||||
|
||||
# Test : Ajout d'un enseignant comme résponsable d'un module
|
||||
# @expected : Le nom de l'enseignant apparait désormais sur la page d'information du module
|
||||
def test_030_ajout_enseignant_sur_module(self):
|
||||
def test_030_changement_responsable_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
|
||||
isThere = False
|
||||
driver.get(URL_SEMESTRE)
|
||||
driver.find_element_by_link_text("M4101C").click()
|
||||
time.sleep(1)
|
||||
global URL_MATIERE
|
||||
URL_MATIERE = driver.current_url
|
||||
driver.find_element_by_partial_link_text("modifier les enseignants").click()
|
||||
time.sleep(1)
|
||||
constructIDEns = (
|
||||
SCODOC_ENS_ID.upper() + " " + PRENOM_ENS + " (" + SCODOC_ENS_ID + ")"
|
||||
)
|
||||
driver.find_element_by_id("ens_id").send_keys(constructIDEns)
|
||||
driver.find_element_by_id("tf_submit").click()
|
||||
time.sleep(1)
|
||||
driver.get(URL_MATIERE)
|
||||
professeurDansModule = driver.find_elements_by_class_name("ens_Dans_Module")
|
||||
# self.assertTrue("Enseignants du" in driver.page_source)
|
||||
time.sleep(5)
|
||||
professeurString = []
|
||||
for professeur in professeurDansModule:
|
||||
professeurString.append(professeur.text)
|
||||
for professeurS in professeurString:
|
||||
print(SCODOC_ENS_ID.lower() + " " + professeurS.lower())
|
||||
print(professeurS.lower().find(SCODOC_ENS_ID.lower() + " e."))
|
||||
if professeurS.lower().find(SCODOC_ENS_ID.lower() + " e."):
|
||||
self.assertTrue(True)
|
||||
|
||||
self.assertFalse(True)
|
||||
|
||||
def test_031_changement_responsable_sur_module(self):
|
||||
driver = self.driver
|
||||
global URL_MATIERE
|
||||
driver.get(URL_MATIERE)
|
||||
driver.find_element_by_xpath(
|
||||
"//a[contains(@href,'edit_moduleimpl_resp?')]"
|
||||
).click()
|
||||
@ -159,6 +120,35 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
driver.get(URL_MATIERE)
|
||||
nomResponsable = driver.find_element_by_id("ens_Responsable")
|
||||
self.assertTrue(SCODOC_CHEF_ID.lower() in nomResponsable.text.lower())
|
||||
global isAdmin
|
||||
isAdmin = False
|
||||
global isChef
|
||||
isChef = True
|
||||
|
||||
# Test : Ajout d'un enseignant comme résponsable d'un module
|
||||
# @expected : Le nom de l'enseignant apparait désormais sur la page d'information du module
|
||||
def test_031_ajout_enseignant_sur_module(self):
|
||||
driver = self.driver
|
||||
global URL_MATIERE
|
||||
driver.get(URL_MATIERE)
|
||||
driver.find_element_by_partial_link_text("modifier les enseignants").click()
|
||||
time.sleep(1)
|
||||
constructIDEns = (
|
||||
SCODOC_ENS_ID.upper() + " " + PRENOM_ENS + " (" + SCODOC_ENS_ID + ")"
|
||||
)
|
||||
driver.find_element_by_id("ens_id").send_keys(constructIDEns)
|
||||
driver.find_element_by_id("tf_submit").click()
|
||||
time.sleep(1)
|
||||
driver.get(URL_MATIERE)
|
||||
professeurDansModule = driver.find_elements_by_class_name("ens_Dans_Module")
|
||||
time.sleep(5)
|
||||
professeurString = []
|
||||
for professeur in professeurDansModule:
|
||||
professeurString.append(professeur.text)
|
||||
for professeurS in professeurString:
|
||||
if SCODOC_ENS_ID.lower() in professeurS.lower():
|
||||
isThere = True
|
||||
self.assertTrue(isThere)
|
||||
|
||||
# Test : Création d'une interrogation en tant que chef des études
|
||||
# @eexpected : L'interrogation apparait désormais dans ce module
|
||||
@ -188,8 +178,8 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
driver.find_element_by_id("tf_coefficient").send_keys("2")
|
||||
driver.find_element_by_id("tf_submit").click()
|
||||
time.sleep(1)
|
||||
global isAdmin
|
||||
isAdmin = False
|
||||
global isChef
|
||||
isChef = False
|
||||
global isEns
|
||||
isEns = True
|
||||
self.assertTrue(descriptionInterrogation in driver.page_source)
|
||||
@ -261,8 +251,8 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
self.assertFalse(False)
|
||||
except NoSuchElementException:
|
||||
self.assertTrue(True)
|
||||
global isAdmin
|
||||
isAdmin = True
|
||||
global isChef
|
||||
isChef = True
|
||||
global isEns
|
||||
isEns = False
|
||||
|
||||
@ -286,10 +276,10 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
driver.find_element_by_class_name("delete_img").click()
|
||||
time.sleep(1)
|
||||
driver.find_element_by_id("tf_submit").click()
|
||||
global isAdmin
|
||||
isAdmin = True
|
||||
global isEns
|
||||
isEns = False
|
||||
# global isAdmin
|
||||
# isAdmin = True
|
||||
# global isEns
|
||||
# isEns = False
|
||||
self.assertFalse(descriptionInterrogation in driver.page_source)
|
||||
|
||||
# Test : Suppression d'un enseignant responsable d'un module
|
||||
@ -306,8 +296,6 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
time.sleep(1)
|
||||
time.sleep(1)
|
||||
driver.get(URL_MATIERE)
|
||||
print(SCODOC_ENS_ID)
|
||||
time.sleep(10)
|
||||
self.assertTrue(SCODOC_ENS_ID not in driver.page_source)
|
||||
|
||||
# Test : Suppresion du reste des interrogations sans notes
|
||||
|
@ -1,15 +1,19 @@
|
||||
import unittest
|
||||
import time
|
||||
import subprocess
|
||||
import urllib.parse as urlparse
|
||||
from setup import (
|
||||
from setting import (
|
||||
SCODOC_ADMIN_ID,
|
||||
SCODOC_ADMIN_PASS,
|
||||
BASE_URL,
|
||||
BASE_NOT_SECURED_URL,
|
||||
LINK_SCODOC_SERVER,
|
||||
NOM_DPT,
|
||||
SCODOC_ENS_ID,
|
||||
SCODOC_ENS_PASS,
|
||||
SCODOC_CHEF_ID,
|
||||
SCODOC_CHEF_PASS,
|
||||
NAVIGATEUR,
|
||||
)
|
||||
from urllib.parse import parse_qs
|
||||
from selenium import webdriver
|
||||
@ -20,25 +24,82 @@ from selenium.webdriver.support.ui import Select, WebDriverWait
|
||||
from selenium.webdriver.support.select import Select
|
||||
|
||||
urlMatiere = ""
|
||||
listeEtudiant = []
|
||||
|
||||
|
||||
class PythonOrgSearch(unittest.TestCase):
|
||||
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
||||
def setUp(self):
|
||||
#chargement du script creation d'interro
|
||||
self.driver = webdriver.Firefox()
|
||||
if NAVIGATEUR == "firefox":
|
||||
self.driver = webdriver.Firefox()
|
||||
elif NAVIGATEUR == "chrome":
|
||||
self.driver = webdriver.Chrome()
|
||||
self.url = BASE_URL + NOM_DPT + "/Scolarite"
|
||||
self.wait = WebDriverWait(self.driver, 10)
|
||||
self.driver.get(BASE_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(
|
||||
"https://"
|
||||
+ SCODOC_ADMIN_ID
|
||||
+ ":"
|
||||
+ SCODOC_ADMIN_PASS
|
||||
+ "@"
|
||||
+ BASE_NOT_SECURED_URL
|
||||
+ "force_admin_authentication"
|
||||
)
|
||||
self.driver.get(self.url)
|
||||
|
||||
def test_010_ajout_note_multiple(self):
|
||||
driver = self.driver()
|
||||
driver = self.driver
|
||||
url = self.url
|
||||
driver.find_element_by_link_text("DUT Informatique semestre 4").click()
|
||||
driver.find_element_by_link_text("M4101C").click()
|
||||
time.sleep(1)
|
||||
global urlMatiere
|
||||
urlMatiere = driver.current_url
|
||||
driver.find_element_by_link_text("semestre 1").click()
|
||||
matiereAvecEvaluation = driver.find_elements_by_xpath(
|
||||
"//a[contains(text(),'1 prévues, 0 ok')]"
|
||||
)
|
||||
global listeEtudiant
|
||||
linkAddNote = "formnotes_note_"
|
||||
|
||||
for evaluation in matiereAvecEvaluation:
|
||||
URL = driver.current_url
|
||||
evaluation.click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
URL_SEMESTRE = driver.current_url
|
||||
driver.find_element_by_xpath("//a[contains(@href,'saisie_notes?')]").click()
|
||||
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
||||
for champs in driver.find_elements_by_xpath(
|
||||
"//input[contains(@id,'" + linkAddNote + "')]"
|
||||
):
|
||||
champs.send_keys(12)
|
||||
idChamp = champs.get_attribute("id")
|
||||
idEtud = idChamp[len(linkAddNote) : len(idChamp)]
|
||||
if idEtud not in listeEtudiant:
|
||||
listeEtudiant.append(idEtud)
|
||||
URL = driver.current_url
|
||||
driver.find_element_by_id("formnotes_submit").click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
driver.get(URL_SEMESTRE)
|
||||
for etudiant in listeEtudiant:
|
||||
searchBar = driver.find_element_by_id("in-expnom")
|
||||
searchBar.send_keys(etudiant)
|
||||
searchBar.submit()
|
||||
self.assertTrue(driver.find_element_by_id("rcp_moy").text == "12")
|
||||
|
||||
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()
|
||||
cmdProcess = [
|
||||
"./scriptExecution.sh",
|
||||
LINK_SCODOC_SERVER,
|
||||
NOM_DPT,
|
||||
"test_scenario3_formation.py",
|
||||
]
|
||||
process = subprocess.Popen(cmdProcess)
|
||||
process.wait()
|
||||
unittest.main(warnings="ignore")
|
0
07_test_admission.py
Normal file
0
07_test_admission.py
Normal file
@ -8,7 +8,6 @@ aliases:
|
||||
Role3: &Prof Professeur
|
||||
Role4: &AdminDPT AdminDepartement
|
||||
Page1: &Accueil Accueil
|
||||
Champs: [&champTest test]
|
||||
Page2: &Absence Absence
|
||||
Page3: &Departement Departement
|
||||
Page4: &Notes Notes
|
||||
@ -58,7 +57,7 @@ test4:
|
||||
resultat: la page sur laquelle on est dirigée contient un tableau avec la formation crée, dont un id avec titre_nom_formation
|
||||
etat: *DeptCreated
|
||||
page: *Notes
|
||||
champs: "titre_" + acronyme
|
||||
champs: "titre_acronyme"
|
||||
role: *AdminDPT
|
||||
createur: Aurélien
|
||||
test5:
|
||||
|
6
output.txt
Normal file
6
output.txt
Normal file
@ -0,0 +1,6 @@
|
||||
>>>
|
||||
.....
|
||||
----------------------------------------------------------------------
|
||||
Ran 5 tests in 77.731s
|
||||
|
||||
OK
|
@ -4,6 +4,6 @@ Environnement de test :
|
||||
Editer le .envmodel pour remplacer les différentes informations qui permettent d'intéragir avec Scodoc (attention au / dans les liens, il y a des exemples)
|
||||
Renommer le fichier en .env
|
||||
|
||||
Les tests sont prévus pour fonctionner avec firefox, le webdriver (geckodriver) est intégré dans le projet pour éviter de devoir l'installer manuellement
|
||||
Les tests sont prévus pour fonctionner avec firefox, le webdriver (geckodriver) est intégré dans le projet pour éviter de devoir l'installer manuellement, il est également possible de préciser un autre webdriver en le précisant dans le .env, en remplaçant firefox par chrome par exemple
|
||||
|
||||
Les tests sont prévus pour fonctionner en python 3 avec unit test
|
Loading…
Reference in New Issue
Block a user