forked from aurelien.plancke/ScodocTestClient
ajout de test sur les moyennes
This commit is contained in:
parent
e9269992fe
commit
13af9b200a
@ -25,6 +25,9 @@ from selenium.webdriver.support.select import Select
|
||||
|
||||
urlMatiere = ""
|
||||
listeEtudiant = []
|
||||
global MOY_UE1
|
||||
global MOY_UE2
|
||||
global URL_SEMESTRE
|
||||
|
||||
|
||||
class PythonOrgSearch(unittest.TestCase):
|
||||
@ -45,42 +48,149 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
+ BASE_NOT_SECURED_URL
|
||||
+ "force_admin_authentication"
|
||||
)
|
||||
self.driver.get(self.url)
|
||||
|
||||
def test_010_ajout_note_multiple(self):
|
||||
def test_010_ajout_note_multiple_pour_une_ue(self):
|
||||
global listeEtudiant
|
||||
global MOY_UE1
|
||||
global URL_SEMESTRE
|
||||
driver = self.driver
|
||||
url = self.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
|
||||
driver.get(url)
|
||||
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)
|
||||
driver.find_element_by_link_text("semestre 1").click()
|
||||
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()
|
||||
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
||||
driver.find_element_by_xpath("//a[contains(@href,'saisie_notes?')]").click()
|
||||
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
||||
URL = driver.current_url
|
||||
for champs in driver.find_elements_by_xpath(
|
||||
"//input[contains(@id,'" + linkAddNote + "')]"
|
||||
):
|
||||
champs.clear()
|
||||
champs.send_keys(12)
|
||||
idChamp = champs.get_attribute("id")
|
||||
idEtud = idChamp[len(linkAddNote) : len(idChamp)]
|
||||
if idEtud not in listeEtudiant:
|
||||
listeEtudiant.append(idEtud)
|
||||
driver.find_element_by_id("formnotes_submit").click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
driver.get(URL_SEMESTRE)
|
||||
noteBonne = True
|
||||
print(listeEtudiant)
|
||||
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")
|
||||
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
||||
MOY_UE1 = driver.find_element_by_id("ue_" + ue_name).text
|
||||
if "12" not in MOY_UE1:
|
||||
noteBonne = False
|
||||
self.assertTrue(noteBonne)
|
||||
# matiereAvecEvaluation = driver.find_elements_by_xpath("//a[contains(text(),'1 prévues, 0 ok')]")
|
||||
#
|
||||
# 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)
|
||||
# self.wait.until(EC.url_changes(URL))
|
||||
# matiereAvecEvaluation = driver.find_elements_by_xpath(
|
||||
# "//a[contains(text(),'1 prévues, 0 ok')]"
|
||||
# )
|
||||
|
||||
def test_020_ajout_note_seconde_ue(self):
|
||||
global listeEtudiant
|
||||
global MOY_UE2
|
||||
glboal URL_SEMESTRE
|
||||
driver = self.driver
|
||||
url = self.url
|
||||
driver.get(url)
|
||||
linkAddNote = "formnotes_note_"
|
||||
driver.find_element_by_link_text("semestre 1").click()
|
||||
URL_SEMESTRE = driver.current_url
|
||||
ue_name = driver.find_elements_by_class_name("status_ue_acro")[1].text
|
||||
driver.find_element_by_link_text("M1201").click()
|
||||
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
||||
driver.find_element_by_xpath("//a[contains(@href,'saisie_notes?')]").click()
|
||||
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
||||
URL = driver.current_url
|
||||
for champs in driver.find_elements_by_xpath(
|
||||
"//input[contains(@id,'" + linkAddNote + "')]"
|
||||
):
|
||||
champs.clear()
|
||||
champs.send_keys(8)
|
||||
driver.find_element_by_id("formnotes_submit").click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
driver.get(URL_SEMESTRE)
|
||||
noteBonne = True
|
||||
for etudiant in listeEtudiant:
|
||||
searchBar = driver.find_element_by_id("in-expnom")
|
||||
searchBar.send_keys(etudiant)
|
||||
searchBar.submit()
|
||||
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
||||
MOY_UE2 = driver.find_element_by_id("ue_" + ue_name).text
|
||||
if "8" not in MOY_UE2:
|
||||
noteBonne = False
|
||||
|
||||
self.assertTrue(noteBonne)
|
||||
|
||||
def test_030_verification_moyenne_generale(self):
|
||||
global listeEtudiant
|
||||
global MOY_UE1
|
||||
global MOY_UE2
|
||||
driver = self.driver
|
||||
url = self.url
|
||||
driver.get(url)
|
||||
moyenneBonne = True
|
||||
for etudiant in listeEtudiant:
|
||||
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:
|
||||
moyenneBonne = False
|
||||
self.assertTrue(moyenneBonne)
|
||||
|
||||
def test_040_modification_coefficiant_module(self):
|
||||
global listeEtudiant
|
||||
coeffUE1 = 3
|
||||
coeffUE2 = 2
|
||||
driver = self.driver
|
||||
url = self.url
|
||||
driver.get(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_submit").click()
|
||||
for etudiant in listeEtudiant:
|
||||
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 * moyUE1 + MOY_UE2 * coeffUE2
|
||||
) / 2 not in driver.find_element_by_class(rcp_moy).text:
|
||||
moyenneBonne = False
|
||||
|
||||
def tearDown(self):
|
||||
self.driver.close()
|
||||
|
@ -7,3 +7,5 @@ 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, 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
|
||||
|
||||
#TODO Lancer les test en parrallèle
|
Loading…
Reference in New Issue
Block a user