refracto test étudiant
This commit is contained in:
parent
1aebf18999
commit
ba68da71fd
@ -1,15 +1,24 @@
|
||||
import unittest
|
||||
import time
|
||||
from setup import SCODOC_ADMIN_ID, SCODOC_ADMIN_PASS, BASE_URL, NOM_DPT
|
||||
import subprocess
|
||||
from setup import (
|
||||
SCODOC_ADMIN_ID,
|
||||
SCODOC_ADMIN_PASS,
|
||||
BASE_URL,
|
||||
NOM_DPT,
|
||||
LINK_SCODOC_SERVER,
|
||||
BASE_NOT_SECURED_URL,
|
||||
)
|
||||
import urllib.parse as urlparse
|
||||
from urllib.parse import parse_qs
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
from selenium.webdriver.support.ui import Select, WebDriverWait
|
||||
from selenium.webdriver.support.select import Select
|
||||
|
||||
nomDPT = "AurelienUS"
|
||||
URL = BASE_URL + NOM_DPT + "/Scolarite"
|
||||
nomEtu = "UnAutreEtudiant"
|
||||
prenomEtu = "Normal"
|
||||
nip = "11122234"
|
||||
@ -19,6 +28,17 @@ 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):
|
||||
self.driver = webdriver.Firefox()
|
||||
@ -28,20 +48,21 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
+ SCODOC_ADMIN_ID
|
||||
+ ":"
|
||||
+ SCODOC_ADMIN_PASS
|
||||
+ "@scodoc-dev-iutinfo.univ-lille.fr/force_admin_authentication"
|
||||
+ "@"
|
||||
+ BASE_NOT_SECURED_URL
|
||||
+ "force_admin_authentication"
|
||||
)
|
||||
self.driver.get("https://scodoc-dev-iutinfo.univ-lille.fr/ScoDoc")
|
||||
global URL
|
||||
self.driver.get(URL)
|
||||
|
||||
# Test : creer un etudiant et verifie si sa fiche etudiante est creee
|
||||
# @expected : A la soumission du formulaire on retrouve la fiche d'information avec le nip (unique) dans la page, on a également un resultat en recherchant l'étudiant
|
||||
def test_01_creation_etudiant(self):
|
||||
driver = self.driver
|
||||
url = (
|
||||
"https://scodoc-dev-iutinfo.univ-lille.fr/ScoDoc/"
|
||||
+ NOM_DPT
|
||||
+ "/Scolarite/etudident_create_form"
|
||||
)
|
||||
driver.get(url)
|
||||
global URL
|
||||
driver.find_element_by_id("link_create_etudident").click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
URL = driver.current_url
|
||||
driver.find_element_by_id("tf_nom").send_keys(nomEtu)
|
||||
driver.find_element_by_id("tf_prenom").send_keys(prenomEtu)
|
||||
driver.find_element_by_id("tf_annee").send_keys("2021")
|
||||
@ -56,12 +77,8 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
# @expected : La création mène à une page qui affiche "code étudiant dupliqué", l'étudiant n'est pas créé
|
||||
def test_02_creation_etudiant_avec_meme_nip(self):
|
||||
driver = self.driver
|
||||
url = (
|
||||
"https://scodoc-dev-iutinfo.univ-lille.fr/ScoDoc/"
|
||||
+ nomDPT
|
||||
+ "/Scolarite/etudident_create_form"
|
||||
)
|
||||
driver.get(url)
|
||||
global URL
|
||||
driver.get(URL)
|
||||
driver.find_element_by_id("tf_nom").send_keys(nomEtu)
|
||||
driver.find_element_by_id("tf_prenom").send_keys(prenomEtu)
|
||||
driver.find_element_by_id("tf_annee").send_keys("2021")
|
||||
@ -78,17 +95,15 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
# expected : La nouvelle adresse est mise à jour sur la page information de l'étudiant
|
||||
def test_03_modification_adresse_etudiant(self):
|
||||
driver = self.driver
|
||||
url = (
|
||||
"https://scodoc-dev-iutinfo.univ-lille.fr/ScoDoc/"
|
||||
+ nomDPT
|
||||
+ "/Scolarite/search_etud_in_dept"
|
||||
)
|
||||
driver.get(url)
|
||||
element = driver.find_element_by_name("expnom")
|
||||
global URL
|
||||
driver.get(URL)
|
||||
element = driver.find_element_by_id("in-expnom")
|
||||
element.send_keys(nomEtu)
|
||||
element.submit()
|
||||
time.sleep(1)
|
||||
driver.find_element_by_id("changerCoordonneesEtudiant").click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
driver.find_element_by_xpath(
|
||||
"//a[contains(@href,'formChangeCoordonnees')]"
|
||||
).click()
|
||||
time.sleep(1)
|
||||
driver.find_element_by_id("tf_domicile").send_keys(domicile)
|
||||
driver.find_element_by_id("tf_codepostaldomicile").send_keys(codepostaldomicile)
|
||||
@ -96,31 +111,35 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
driver.find_element_by_id("tf_submit").click()
|
||||
time.sleep(1)
|
||||
self.assertTrue(
|
||||
codepostaldomicile in driver.find_element_by_id("champAdresse").text
|
||||
codepostaldomicile in driver.find_element_by_id("adresse_etudiant").text
|
||||
)
|
||||
|
||||
# Test Inscription d'un étudiant dans un semestre
|
||||
# @expected :
|
||||
def test_04_inscription_etudiant(self):
|
||||
driver = self.driver
|
||||
url = (
|
||||
"https://scodoc-dev-iutinfo.univ-lille.fr/ScoDoc/"
|
||||
+ nomDPT
|
||||
+ "/Scolarite/search_etud_in_dept"
|
||||
)
|
||||
driver.get(url)
|
||||
element = driver.find_element_by_id("searchEtud")
|
||||
global URL
|
||||
driver.get(URL)
|
||||
element = driver.find_element_by_id("in-expnom")
|
||||
element.send_keys(nomEtu)
|
||||
element.submit()
|
||||
time.sleep(1)
|
||||
driver.find_element_by_id("inscription_Etudiant").click()
|
||||
time.sleep(1)
|
||||
self.assertTrue("<h3>Choisir un semestre:</h3>" in driver.page_source)
|
||||
driver.find_elements_by_id("semestreInscription")[0].click()
|
||||
time.sleep(1)
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
driver.find_element_by_xpath(
|
||||
"//a[contains(@href, 'formsemestre_inscription_with_modules_form')]"
|
||||
).click()
|
||||
self.wait.until(EC.url_changes(URL))
|
||||
try:
|
||||
semestres = driver.find_elements_by_xpath(
|
||||
"//a[contains(@id,'inscription_Semestre_')]"
|
||||
)
|
||||
print(semestres)
|
||||
except NoSuchElementException:
|
||||
self.assertFalse(True)
|
||||
semestres[0].click()
|
||||
# self.wait.until(EC.url_changes(URL))
|
||||
driver.find_element_by_xpath("//input[@value='Inscrire']").click()
|
||||
self.wait.until(EC.url_changes(url))
|
||||
self.assertTrue("Inscrire" in driver.page_source)
|
||||
# self.wait.until(EC.url_changes(url))
|
||||
self.assertTrue("inscrit" in driver.page_source)
|
||||
time.sleep(1)
|
||||
|
||||
# Test Supprime un étudiant
|
||||
@ -129,7 +148,7 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
driver = self.driver
|
||||
urlRecherche = (
|
||||
"https://scodoc-dev-iutinfo.univ-lille.fr/ScoDoc/"
|
||||
+ nomDPT
|
||||
+ NOM_DPT
|
||||
+ "/Scolarite/search_etud_in_dept"
|
||||
)
|
||||
driver.get(urlRecherche)
|
||||
@ -140,7 +159,7 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
etudid = driver.find_element_by_id("euid")
|
||||
url = (
|
||||
"https://scodoc-dev-iutinfo.univ-lille.fr/ScoDoc/"
|
||||
+ nomDPT
|
||||
+ NOM_DPT
|
||||
+ "/Scolarite/etudident_delete?etudid="
|
||||
+ etudid.text
|
||||
)
|
||||
|
@ -1,57 +0,0 @@
|
||||
import unittest
|
||||
import time
|
||||
import urllib.parse as urlparse
|
||||
from setup import SCODOC_ADMIN_ID,SCODOC_ADMIN_PASS,BASE_URL,NOM_DPT
|
||||
from urllib.parse import parse_qs
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.support.ui import Select, WebDriverWait
|
||||
from selenium.webdriver.support.select import Select
|
||||
|
||||
nomEtu = "UnAutreEtudiant"
|
||||
prenomEtu = "Normal"
|
||||
oldnip = "11122234"
|
||||
newnip = "12345678"
|
||||
eid = "EID1"
|
||||
|
||||
|
||||
class PythonOrgSearch(unittest.TestCase):
|
||||
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
||||
def setUp(self):
|
||||
self.driver = webdriver.Firefox()
|
||||
self.wait = WebDriverWait(self.driver, 10)
|
||||
self.driver.get(
|
||||
"https://"
|
||||
+ SCODOC_ADMIN_ID
|
||||
+ ":"
|
||||
+ SCODOC_ADMIN_PASS
|
||||
+ "@scodoc-dev-iutinfo.univ-lille.fr/force_admin_authentication"
|
||||
)
|
||||
self.driver.get("https://scodoc-dev-iutinfo.univ-lille.fr/ScoDoc")
|
||||
|
||||
# Test changer les données d'un étudiant
|
||||
# @expected : Le nip sur la page informations de l'étudiant est mis à jour
|
||||
def test_changement_info_etudiant(self):
|
||||
url = (
|
||||
BASE_URL
|
||||
+ NOM_DPT
|
||||
+ "/Scolarite/etudident_edit_form?etudid="
|
||||
+ eid
|
||||
)
|
||||
driver = self.driver
|
||||
driver.get(url)
|
||||
driver.find_element_by_id("tf_code_nip").clear()
|
||||
driver.find_element_by_id("tf_code_nip").send_keys(newnip)
|
||||
driver.find_element_by_id("tf_submit").click()
|
||||
self.wait.until(EC.url_changes(url))
|
||||
time.sleep(5)
|
||||
self.assertTrue(newnip in driver.page_source)
|
||||
|
||||
# ferme la fenetre
|
||||
def tearDown(self):
|
||||
self.driver.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
@ -1,7 +1,7 @@
|
||||
import unittest
|
||||
import time
|
||||
import urllib.parse as urlparse
|
||||
from setup import SCODOC_ADMIN_ID,SCODOC_ADMIN_PASS,BASE_URL,NOM_DPT
|
||||
from setup import SCODOC_ADMIN_ID, SCODOC_ADMIN_PASS, BASE_URL, NOM_DPT
|
||||
from urllib.parse import parse_qs
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
@ -9,15 +9,21 @@ from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.support.ui import Select, WebDriverWait
|
||||
from selenium.webdriver.support.select import Select
|
||||
|
||||
nomEtu = "UnAutreEtudiant"
|
||||
prenomEtu = "Normal"
|
||||
nip = "11122234"
|
||||
dateDebutAbsenceJustifiee = "12/04/2021"
|
||||
dateDebutAbsenceNonJustifiee = "13/04/2021"
|
||||
URL = BASE_URL + NOM_DPT + "/Scolarite"
|
||||
|
||||
|
||||
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):
|
||||
self.driver = webdriver.Firefox()
|
||||
@ -27,15 +33,15 @@ class PythonOrgSearch(unittest.TestCase):
|
||||
+ SCODOC_ADMIN_ID
|
||||
+ ":"
|
||||
+ SCODOC_ADMIN_PASS
|
||||
+ "@scodoc-dev-iutinfo.univ-lille.fr/force_admin_authentication"
|
||||
+ "@"
|
||||
+ BASE_NOT_SECURED_URL
|
||||
+ "force_admin_authentication"
|
||||
)
|
||||
global URL
|
||||
self.driver.get(URL)
|
||||
driver = self.driver
|
||||
driver.implicitly_wait(10)
|
||||
url = (
|
||||
BASE_URL
|
||||
+ NOM_DPT
|
||||
+ "/Scolarite/Absences/search_etud_in_dept"
|
||||
)
|
||||
url = BASE_URL + NOM_DPT + "/Scolarite/Absences/search_etud_in_dept"
|
||||
driver.get(url)
|
||||
element = driver.find_element_by_name("expnom")
|
||||
element.send_keys(nomEtu)
|
||||
|
10100
geckodriver.log
10100
geckodriver.log
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user