Compare commits

...

4 Commits

Author SHA1 Message Date
491c50ebc0 merge 2021-06-23 14:28:31 +02:00
16ba1f0037 maj gitignore 2021-06-23 14:27:55 +02:00
d4850108bb maj gitignore 2021-06-23 14:27:50 +02:00
1c8bccbf41 ajout d'ouput sous forme html pour les tests 2021-06-23 14:27:05 +02:00
9 changed files with 39 additions and 51 deletions

3
.gitignore vendored
View File

@ -3,4 +3,5 @@ settings.json
.env .env
*__pycache__* *__pycache__*
*__pycache__/* *__pycache__/*
geckodriver.log geckodriver.log
*/output/*

View File

@ -2,6 +2,7 @@
import unittest import unittest
import time import time
import subprocess import subprocess
import HtmlTestRunner
from setting import ( from setting import (
SCODOC_ADMIN_ID, SCODOC_ADMIN_ID,
SCODOC_ADMIN_PASS, SCODOC_ADMIN_PASS,
@ -86,4 +87,4 @@ if __name__ == "__main__":
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()
unittest.main() unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output="./output"))

View File

@ -2,6 +2,7 @@
import unittest import unittest
import time import time
import subprocess import subprocess
import HtmlTestRunner
from setting import ( from setting import (
SCODOC_ADMIN_ID, SCODOC_ADMIN_ID,
SCODOC_ADMIN_PASS, SCODOC_ADMIN_PASS,
@ -118,17 +119,14 @@ class PythonOrgSearch(unittest.TestCase):
driver.find_element_by_id(idTitre).click() driver.find_element_by_id(idTitre).click()
self.wait.until(EC.url_changes(URL)) self.wait.until(EC.url_changes(URL))
driver.find_element_by_xpath("//a[contains(@href,'ue_create?')]").click() driver.find_element_by_xpath("//a[contains(@href,'ue_create?')]").click()
driver.find_element_by_id('tf_titre').send_keys("UE TEST") driver.find_element_by_id("tf_titre").send_keys("UE TEST")
driver.find_element_by_id('tf_acronyme').send_keys("TEST") driver.find_element_by_id("tf_acronyme").send_keys("TEST")
driver.find_element_by_id('tf_submit').click() driver.find_element_by_id("tf_submit").click()
time.sleep(1) time.sleep(1)
driver.get(URL) driver.get(URL)
driver.find_element_by_id(idTitre).click() driver.find_element_by_id(idTitre).click()
self.wait.until(EC.url_changes(URL)) self.wait.until(EC.url_changes(URL))
self.assertTrue( self.assertTrue("TEST UE TEST" in driver.page_source)
"TEST UE TEST"
in driver.page_source
)
driver.get(URL) driver.get(URL)
# Test : Ajout d'une matière dans la formation # Test : Ajout d'une matière dans la formation
@ -138,16 +136,19 @@ class PythonOrgSearch(unittest.TestCase):
global URL global URL
nomMat = "unematieretest" nomMat = "unematieretest"
driver.get(URL) driver.get(URL)
time.sleep(3)
idTitre = "titre_" + ACRONYME_FORMATION idTitre = "titre_" + ACRONYME_FORMATION
driver.find_element_by_id(idTitre).click() driver.find_element_by_id(idTitre).click()
self.wait.until(EC.url_changes(URL)) self.wait.until(EC.url_changes(URL))
time.sleep(3)
driver.find_element_by_xpath("//a[contains(@href,'matiere_create?')]").click() driver.find_element_by_xpath("//a[contains(@href,'matiere_create?')]").click()
driver.find_element_by_id('tf_titre').send_keys(nomMat) driver.find_element_by_id("tf_titre").send_keys(nomMat)
driver.find_element_by_id('tf_numero').send_keys("1") driver.find_element_by_id("tf_numero").send_keys("1")
driver.find_element_by_id('tf_submit').click() driver.find_element_by_id("tf_submit").click()
time.sleep(1) time.sleep(3)
driver.get(URL) driver.get(URL)
driver.find_element_by_id(idTitre).click() driver.find_element_by_id(idTitre).click()
time.sleep(3)
self.wait.until(EC.url_changes(URL)) self.wait.until(EC.url_changes(URL))
elements = driver.find_elements_by_xpath("//a[contains(@href,'matiere_edit?')]") elements = driver.find_elements_by_xpath("//a[contains(@href,'matiere_edit?')]")
matIsPresent = False matIsPresent = False
@ -178,6 +179,7 @@ class PythonOrgSearch(unittest.TestCase):
driver.get(URL) driver.get(URL)
self.assertTrue((NOM_DPT.upper() + "-" + "DUT" + "--") in driver.page_source) self.assertTrue((NOM_DPT.upper() + "-" + "DUT" + "--") in driver.page_source)
# Test : Dupplique une formation sous une nouvelle version # Test : Dupplique une formation sous une nouvelle version
# @expected : La formation est dupliquée et à la version "2" # @expected : La formation est dupliquée et à la version "2"
def test_017_creer_nouvelle_version_formation(self): def test_017_creer_nouvelle_version_formation(self):
@ -188,16 +190,19 @@ class PythonOrgSearch(unittest.TestCase):
driver.find_element_by_id(idTitre).click() driver.find_element_by_id(idTitre).click()
self.wait.until(EC.url_changes(URL)) self.wait.until(EC.url_changes(URL))
tmpurl = driver.current_url tmpurl = driver.current_url
driver.find_element_by_xpath("//a[contains(@href,'formation_create_new_version?')]").click() driver.find_element_by_xpath(
"//a[contains(@href,'formation_create_new_version?')]"
).click()
self.wait.until(EC.url_changes(tmpurl)) self.wait.until(EC.url_changes(tmpurl))
self.assertTrue("Nouvelle version !" in driver.page_source) self.assertTrue("Nouvelle version !" in driver.page_source)
driver.get(URL) driver.get(URL)
elements = driver.find_elements_by_class_name("version") elements = driver.find_elements_by_class_name("version")
versionIsPresent = False versionIsPresent = False
for element in elements: for element in elements:
if element.text == '2': if element.text == "2":
versionIsPresent = True versionIsPresent = True
self.assertTrue(versionIsPresent) self.assertTrue(versionIsPresent)
# Test : Supprime une formation après avoir supprimé les semestres qui y sont rattachés # Test : Supprime une formation après avoir supprimé les semestres qui y sont rattachés
# @expected : La formation n'apparait plus dans le tableau des formations # @expected : La formation n'apparait plus dans le tableau des formations
def test_020_delete_formation(self): def test_020_delete_formation(self):
@ -252,22 +257,4 @@ if __name__ == "__main__":
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()
#driver = webdriver.Firefox() unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output="./output"))
#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

@ -1,5 +1,6 @@
import unittest import unittest
import time import time
import HtmlTestRunner
import subprocess import subprocess
from setting import ( from setting import (
SCODOC_ADMIN_ID, SCODOC_ADMIN_ID,
@ -195,4 +196,4 @@ if __name__ == "__main__":
] ]
process = subprocess.Popen(cmdProcess) process = subprocess.Popen(cmdProcess)
process.wait() process.wait()
unittest.main() unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output="./output"))

View File

@ -2,6 +2,7 @@ import unittest
import time import time
import urllib.parse as urlparse import urllib.parse as urlparse
import subprocess import subprocess
import HtmlTestRunner
from setting import ( from setting import (
SCODOC_ADMIN_ID, SCODOC_ADMIN_ID,
SCODOC_ADMIN_PASS, SCODOC_ADMIN_PASS,
@ -164,4 +165,4 @@ if __name__ == "__main__":
] ]
process = subprocess.Popen(cmdProcess) process = subprocess.Popen(cmdProcess)
process.wait() process.wait()
unittest.main() unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output="./output"))

View File

@ -2,6 +2,7 @@ import unittest
import time import time
import subprocess import subprocess
import urllib.parse as urlparse import urllib.parse as urlparse
import HtmlTestRunner
from setting import ( from setting import (
SCODOC_ADMIN_ID, SCODOC_ADMIN_ID,
SCODOC_ADMIN_PASS, SCODOC_ADMIN_PASS,
@ -395,4 +396,4 @@ if __name__ == "__main__":
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()
driver.close() driver.close()
unittest.main(warnings="ignore") unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output="./output"))

View File

@ -2,6 +2,7 @@ import unittest
import time import time
import subprocess import subprocess
import urllib.parse as urlparse import urllib.parse as urlparse
import HtmlTestRunner
from setting import ( from setting import (
SCODOC_ADMIN_ID, SCODOC_ADMIN_ID,
SCODOC_ADMIN_PASS, SCODOC_ADMIN_PASS,
@ -444,4 +445,4 @@ if __name__ == "__main__":
] ]
process = subprocess.Popen(cmdProcess) process = subprocess.Popen(cmdProcess)
process.wait() process.wait()
unittest.main(warnings="ignore") unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output="./output"))

View File

@ -2,6 +2,7 @@ import unittest
import time import time
import subprocess import subprocess
import urllib.parse as urlparse import urllib.parse as urlparse
import HtmlTestRunner
from setting import ( from setting import (
SCODOC_ADMIN_ID, SCODOC_ADMIN_ID,
SCODOC_ADMIN_PASS, SCODOC_ADMIN_PASS,
@ -232,4 +233,4 @@ if __name__ == "__main__":
] ]
process = subprocess.Popen(cmdProcess) process = subprocess.Popen(cmdProcess)
process.wait() process.wait()
unittest.main(warnings="ignore") unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output="./output"))

View File

@ -589,28 +589,22 @@ test48:
page: *Notes page: *Notes
champsModifie: null champsModifie: null
champsInteractions: champsInteractions:
[ [id:tf_titre, id:tf_acronyme, id:tf_submit, link:ue_create]
id:tf_titre,
id:tf_acronyme,
id:tf_submit,
link:ue_create
]
role: *AdminDPT role: *AdminDPT
createur: Aurélien createur: Aurélien
test49: test49:
intitulé: Ajout d'une matière à l'UE créée intitulé: Ajout d'une matière à la formation créée
operation: Soumettre le formulaire d'ajout de matière operation: Soumettre le formulaire d'ajout de matière
resultat: La page sur laquelle on est dirigée contient la classe notes_matiere_list et un de ses enfants contient Systeme resultat: La page sur laquelle on est dirigée contient la classe notes_matiere_list et l'intitulé de la matière est présent
etat: *MatiereCreated etat: *MatiereCreated
page: *Notes page: *Notes
champsModifie: null champsModifie: null
champsInteractions: champsInteractions: [
[
id:tf_titre, id:tf_titre,
id:tf_acronyme, id:tf_acronyme,
id:tf_submit, id:tf_submit,
link:matiere_create link:matiere_create
link:matiere_edit link:matiere_edit,
] ]
role: *AdminDPT role: *AdminDPT
createur: Aurélien createur: Aurélien