forked from aurelien.plancke/ScodocTestClient
tests 02 (formation) ok
This commit is contained in:
parent
2a57748959
commit
b66631cdcc
@ -1,93 +1,94 @@
|
|||||||
# coding: utf8
|
# coding: utf8
|
||||||
import unittest
|
import unittest
|
||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
import HtmlTestRunner
|
import HtmlTestRunner
|
||||||
import createDepartement
|
import createDepartement
|
||||||
import creationSiteDepartement
|
import creationSiteDepartement
|
||||||
import deleteDepartement
|
import deleteDepartement
|
||||||
import suppressionSiteDepartement
|
import suppressionSiteDepartement
|
||||||
from setting import (
|
from setting import (
|
||||||
SCODOC_ADMIN_ID,
|
SCODOC_ADMIN_ID,
|
||||||
SCODOC_ADMIN_PASS,
|
SCODOC_ADMIN_PASS,
|
||||||
SCHEMA,
|
SCHEMA,
|
||||||
BASE_URL,
|
SCODOC_SERVER,
|
||||||
NOM_DPT,
|
SCODOC_PORT,
|
||||||
LINK_SCODOC_SERVER,
|
NOM_DPT,
|
||||||
BASE_SSH_URL,
|
LINK_SCODOC_SERVER,
|
||||||
NAVIGATEUR,
|
BASE_SSH_URL,
|
||||||
)
|
NAVIGATEUR,
|
||||||
from selenium import webdriver
|
)
|
||||||
from selenium.webdriver.common.keys import Keys
|
from selenium import webdriver
|
||||||
from selenium.webdriver.support.ui import Select
|
from selenium.webdriver.common.keys import Keys
|
||||||
from selenium.webdriver.support.select import Select
|
from selenium.webdriver.support.ui import Select
|
||||||
|
from selenium.webdriver.support.select import Select
|
||||||
URL_ROOT = SCHEMA + "://" + BASE_URL
|
|
||||||
URL_AUTH = "/".join((URL_ROOT, "auth", "login"))
|
URL_ROOT = SCHEMA + "://" + + + ":" + SCODOC_PORT
|
||||||
URL_SCODOC8 = "/".join((URL_ROOT, "index"))
|
URL_AUTH = "/".join((URL_ROOT, "auth", "login"))
|
||||||
URL_HOME = "/".join((URL_ROOT, "ScoDoc", "index"))
|
URL_SCODOC8 = "/".join((URL_ROOT, "index"))
|
||||||
URL_DEPT = "/".join((URL_ROOT, "ScoDoc", NOM_DPT, "Scolarite", "index_html"))
|
URL_HOME = "/".join((URL_ROOT, "ScoDoc", "index"))
|
||||||
URL_ADMIN = "/".join((URL_ROOT, "ScoDoc", "admin"))
|
URL_DEPT = "/".join((URL_ROOT, "ScoDoc", NOM_DPT, "Scolarite", "index_html"))
|
||||||
|
URL_ADMIN = "/".join((URL_ROOT, "ScoDoc", "admin"))
|
||||||
class PythonOrgSearch(unittest.TestCase):
|
|
||||||
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
class PythonOrgSearch(unittest.TestCase):
|
||||||
def setUp(self):
|
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
||||||
next_page = ""
|
def setUp(self):
|
||||||
if NAVIGATEUR == "firefox":
|
next_page = ""
|
||||||
self.driver = webdriver.Firefox()
|
if NAVIGATEUR == "firefox":
|
||||||
else:
|
self.driver = webdriver.Firefox()
|
||||||
self.driver = webdriver.Chrome()
|
else:
|
||||||
auth_page = URL_AUTH + "?next=%2F" + next_page
|
self.driver = webdriver.Chrome()
|
||||||
self.driver.get(auth_page)
|
auth_page = URL_AUTH + "?next=%2F" + next_page
|
||||||
self.driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
|
self.driver.get(auth_page)
|
||||||
self.driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
|
self.driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
|
||||||
self.driver.find_element_by_id("submit").click()
|
self.driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
|
||||||
self.driver.get(URL_SCODOC8)
|
self.driver.find_element_by_id("submit").click()
|
||||||
|
self.driver.get(URL_SCODOC8)
|
||||||
# Test : Verification de la connexion admin effective
|
|
||||||
# @expected : "Bonjour admin" est présent sur la page d'accueil
|
# Test : Verification de la connexion admin effective
|
||||||
def test_01_connexion_admin(self):
|
# @expected : "Bonjour admin" est présent sur la page d'accueil
|
||||||
driver = self.driver
|
def test_01_connexion_admin(self):
|
||||||
self.assertTrue("admin" in driver.page_source)
|
driver = self.driver
|
||||||
|
self.assertTrue("admin" in driver.page_source)
|
||||||
# Test : Creer un département
|
|
||||||
# @expected : Le département est présent sur la page d'accueil
|
# Test : Creer un département
|
||||||
def test_02_create_departement(self):
|
# @expected : Le département est présent sur la page d'accueil
|
||||||
driver = self.driver
|
def test_02_create_departement(self):
|
||||||
driver.get(SCHEMA + "://" + BASE_URL + "/scodoc_admin")
|
driver = self.driver
|
||||||
time.sleep(2)
|
driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + "/scodoc_admin")
|
||||||
select = Select(driver.find_element_by_id("create-dept"))
|
time.sleep(2)
|
||||||
select.select_by_visible_text(NOM_DPT)
|
select = Select(driver.find_element_by_id("create-dept"))
|
||||||
driver.find_element_by_id("create-dept").submit()
|
select.select_by_visible_text(NOM_DPT)
|
||||||
time.sleep(1)
|
driver.find_element_by_id("create-dept").submit()
|
||||||
driver.find_element_by_id("tf_submit").click()
|
time.sleep(1)
|
||||||
driver.get(URL_HOME)
|
driver.find_element_by_id("tf_submit").click()
|
||||||
self.assertTrue(NOM_DPT in driver.page_source)
|
driver.get(URL_HOME)
|
||||||
|
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
|
|
||||||
# @expected : Le département n'apparait plus sur la page d'accueil
|
# Test : Suppresion d'un département, puis lancement d'un script coté serveur pour supprimer sa base de données
|
||||||
def test_03_delete_departement(self):
|
# @expected : Le département n'apparait plus sur la page d'accueil
|
||||||
driver = self.driver
|
def test_03_delete_departement(self):
|
||||||
driver.get(SCHEMA + "://" + BASE_URL + "/scodoc_admin")
|
driver = self.driver
|
||||||
select = Select(driver.find_element_by_id("delete-dept"))
|
driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + "/scodoc_admin")
|
||||||
select.select_by_visible_text(NOM_DPT)
|
select = Select(driver.find_element_by_id("delete-dept"))
|
||||||
driver.find_element_by_id("delete-dept").submit()
|
select.select_by_visible_text(NOM_DPT)
|
||||||
driver.get(SCHEMA + "://" + BASE_URL)
|
driver.find_element_by_id("delete-dept").submit()
|
||||||
self.assertTrue(NOM_DPT not in driver.page_source)
|
driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT)
|
||||||
|
self.assertTrue(NOM_DPT not in driver.page_source)
|
||||||
# ferme la fenetre à chaque fin de test
|
|
||||||
def tearDown(self):
|
# ferme la fenetre à chaque fin de test
|
||||||
self.driver.close()
|
def tearDown(self):
|
||||||
|
self.driver.close()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
deleteDepartement.main()
|
if __name__ == "__main__":
|
||||||
createDepartement.main()
|
deleteDepartement.main()
|
||||||
suppressionSiteDepartement.main()
|
createDepartement.main()
|
||||||
unittest.main(
|
suppressionSiteDepartement.main()
|
||||||
testRunner=HtmlTestRunner.HTMLTestRunner(
|
unittest.main(
|
||||||
report_name="01_création_département",
|
testRunner=HtmlTestRunner.HTMLTestRunner(
|
||||||
output="./ResultatTest",
|
report_name="01_création_département",
|
||||||
combine_reports=True,
|
output="./ResultatTest",
|
||||||
)
|
combine_reports=True,
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
@ -1,272 +1,271 @@
|
|||||||
# coding: utf8
|
# coding: utf8
|
||||||
import unittest
|
import unittest
|
||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
import HtmlTestRunner
|
import HtmlTestRunner
|
||||||
import createDepartement
|
import createDepartement
|
||||||
import creationSiteDepartement
|
import creationSiteDepartement
|
||||||
import deleteDepartement
|
import deleteDepartement
|
||||||
from setting import (
|
import creationUtilisateurs
|
||||||
SCODOC_ADMIN_ID,
|
from setting import (
|
||||||
SCODOC_ADMIN_PASS,
|
SCODOC_ADMIN_ID,
|
||||||
SCHEMA,
|
SCODOC_ADMIN_PASS,
|
||||||
BASE_URL,
|
SCHEMA,
|
||||||
NOM_DPT,
|
SCODOC_SERVER,
|
||||||
LINK_SCODOC_SERVER,
|
SCODOC_PORT,
|
||||||
BASE_SSH_URL,
|
NOM_DPT,
|
||||||
NAVIGATEUR,
|
NAVIGATEUR,
|
||||||
)
|
)
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from selenium.webdriver.support import expected_conditions as EC
|
from selenium.webdriver.support import expected_conditions as EC
|
||||||
from selenium.webdriver.support.ui import Select, WebDriverWait
|
from selenium.webdriver.support.ui import Select, WebDriverWait
|
||||||
from selenium.common.exceptions import NoSuchElementException
|
from selenium.common.exceptions import NoSuchElementException
|
||||||
from selenium.webdriver.common.keys import Keys
|
from selenium.webdriver.common.keys import Keys
|
||||||
from selenium.webdriver.support.ui import Select
|
from selenium.webdriver.support.ui import Select
|
||||||
from selenium.webdriver.support.select import Select
|
from selenium.webdriver.support.select import Select
|
||||||
|
|
||||||
URL_ROOT = SCHEMA + "://" + BASE_URL
|
URL_ROOT = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT
|
||||||
URL_AUTH = "/".join((URL_ROOT, "auth", "login"))
|
URL_AUTH = "/".join((URL_ROOT, "auth", "login"))
|
||||||
URL_SCODOC8 = "/".join((URL_ROOT, "index"))
|
URL_SCODOC8 = "/".join((URL_ROOT, "index"))
|
||||||
URL_HOME = "/".join((URL_ROOT, "ScoDoc", "index"))
|
URL_HOME = "/".join((URL_ROOT, "ScoDoc", "index"))
|
||||||
URL_DEPT = "/".join((URL_ROOT, "ScoDoc", NOM_DPT, "Scolarite", "index_html"))
|
URL_DEPT = "/".join((URL_ROOT, "ScoDoc", NOM_DPT, "Scolarite", "index_html"))
|
||||||
URL_ADMIN = "/".join((URL_ROOT, "ScoDoc", "admin"))
|
URL_ADMIN = "/".join((URL_ROOT, "ScoDoc", "admin"))
|
||||||
|
|
||||||
ACRONYME_FORMATION = "formationtest"
|
ACRONYME_FORMATION = "formationtest"
|
||||||
URL = URL_SCODOC8
|
URL = URL_SCODOC8
|
||||||
|
|
||||||
class PythonOrgSearch(unittest.TestCase):
|
class PythonOrgSearch(unittest.TestCase):
|
||||||
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
next_page = ""
|
if NAVIGATEUR == "firefox":
|
||||||
if NAVIGATEUR == "firefox":
|
self.driver = webdriver.Firefox()
|
||||||
self.driver = webdriver.Firefox()
|
else:
|
||||||
else:
|
self.driver = webdriver.Chrome()
|
||||||
self.driver = webdriver.Chrome()
|
self.wait = WebDriverWait(self.driver, 10)
|
||||||
self.wait = WebDriverWait(self.driver, 10)
|
auth_page = URL_AUTH + ("?next=" + URL_HOME).replace("/", "%2F")
|
||||||
auth_page = URL_AUTH + ("?next=" + next_page).replace("/", "%2F")
|
self.driver.get(auth_page)
|
||||||
self.driver.get(auth_page)
|
self.driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
|
||||||
self.driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
|
self.driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
|
||||||
self.driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
|
self.driver.find_element_by_id("submit").click()
|
||||||
self.driver.find_element_by_id("submit").click()
|
|
||||||
self.driver.get(URL_HOME)
|
# Test Creer une formation
|
||||||
|
# @expected : La formation se trouve dans le tableau de la liste des formations
|
||||||
# Test Creer une formation
|
def test_011_create_formation(self):
|
||||||
# @expected : La formation se trouve dans le tableau de la liste des formations
|
global URL
|
||||||
def test_011_create_formation(self):
|
driver = self.driver
|
||||||
global URL
|
wait = self.wait
|
||||||
driver = self.driver
|
driver.get(URL_DEPT)
|
||||||
wait = self.wait
|
driver.find_element_by_id("link-programmes").click()
|
||||||
driver.get(URL_DEPT)
|
URL = driver.current_url
|
||||||
driver.find_element_by_id("link-programmes").click()
|
driver.find_element_by_id("link-create-formation").click()
|
||||||
URL = driver.current_url
|
wait.until(EC.url_changes(URL))
|
||||||
driver.find_element_by_id("link-create-formation").click()
|
driver.find_element_by_id("tf_acronyme").send_keys(ACRONYME_FORMATION)
|
||||||
wait.until(EC.url_changes(URL))
|
driver.find_element_by_id("tf_titre").send_keys("TEST")
|
||||||
driver.find_element_by_id("tf_acronyme").send_keys(ACRONYME_FORMATION)
|
driver.find_element_by_id("tf_titre_officiel").send_keys("formation de test")
|
||||||
driver.find_element_by_id("tf_titre").send_keys("TEST")
|
driver.find_element_by_id("tf_submit").click()
|
||||||
driver.find_element_by_id("tf_titre_officiel").send_keys("formation de test")
|
driver.get(URL)
|
||||||
driver.find_element_by_id("tf_submit").click()
|
formations = driver.find_elements_by_class_name("acronyme")
|
||||||
driver.get(URL)
|
textElementAcronyme = []
|
||||||
formations = driver.find_elements_by_class_name("acronyme")
|
for formation in formations:
|
||||||
textElementAcronyme = []
|
textElementAcronyme.append(formation.text)
|
||||||
for formation in formations:
|
self.assertTrue(ACRONYME_FORMATION in textElementAcronyme)
|
||||||
textElementAcronyme.append(formation.text)
|
|
||||||
self.assertTrue(ACRONYME_FORMATION in textElementAcronyme)
|
# Test : Changement du nom d'une formation
|
||||||
|
# @expected : Le nom de la formation est changé sur la page des formations
|
||||||
# Test : Changement du nom d'une formation
|
def test_012_change_name_formation(self):
|
||||||
# @expected : Le nom de la formation est changé sur la page des formations
|
driver = self.driver
|
||||||
def test_012_change_name_formation(self):
|
wait = self.wait
|
||||||
driver = self.driver
|
driver.get(URL)
|
||||||
wait = self.wait
|
id_edit_formation = "edit-formation-" + ACRONYME_FORMATION.replace(" ","-")
|
||||||
driver.get(URL)
|
driver.find_element_by_id(id_edit_formation).click()
|
||||||
id_edit_formation = "edit-formation-" + ACRONYME_FORMATION.replace(" ","-")
|
wait.until(EC.url_changes(URL))
|
||||||
driver.find_element_by_id(id_edit_formation).click()
|
driver.find_element_by_id("tf_acronyme").send_keys(ACRONYME_FORMATION)
|
||||||
wait.until(EC.url_changes(URL))
|
driver.find_element_by_id("tf_submit").click()
|
||||||
driver.find_element_by_id("tf_acronyme").send_keys(ACRONYME_FORMATION)
|
driver.get(URL)
|
||||||
driver.find_element_by_id("tf_submit").click()
|
formations = driver.find_elements_by_class_name("acronyme")
|
||||||
driver.get(URL)
|
text_element_acronyme = []
|
||||||
formations = driver.find_elements_by_class_name("acronyme")
|
for formation in formations:
|
||||||
text_element_acronyme = []
|
text_element_acronyme.append(formation.text)
|
||||||
for formation in formations:
|
self.assertTrue(ACRONYME_FORMATION + ACRONYME_FORMATION in text_element_acronyme)
|
||||||
text_element_acronyme.append(formation.text)
|
# Remise du nom à celui de départ
|
||||||
self.assertTrue(ACRONYME_FORMATION + ACRONYME_FORMATION in text_element_acronyme)
|
driver.get(URL)
|
||||||
# Remise du nom à celui de départ
|
id_edit_formation = "edit-formation-" + ACRONYME_FORMATION + ACRONYME_FORMATION
|
||||||
driver.get(URL)
|
driver.find_element_by_id(id_edit_formation).click()
|
||||||
id_edit_formation = "edit-formation-" + ACRONYME_FORMATION + ACRONYME_FORMATION
|
wait.until(EC.url_changes(URL))
|
||||||
driver.find_element_by_id(id_edit_formation).click()
|
driver.find_element_by_id("tf_acronyme").clear()
|
||||||
wait.until(EC.url_changes(URL))
|
driver.find_element_by_id("tf_acronyme").send_keys(ACRONYME_FORMATION)
|
||||||
driver.find_element_by_id("tf_acronyme").clear()
|
driver.find_element_by_id("tf_submit").click()
|
||||||
driver.find_element_by_id("tf_acronyme").send_keys(ACRONYME_FORMATION)
|
|
||||||
driver.find_element_by_id("tf_submit").click()
|
# Test : Création d'une formation avec le même nom qu'une autre déjà existante
|
||||||
|
# @expected : La formation n'as pas pu être créée et on arrive donc sur un message d'erreur à la création
|
||||||
# Test : Création d'une formation avec le même nom qu'une autre déjà existante
|
def test_013_same_name_formation(self):
|
||||||
# @expected : La formation n'as pas pu être créée et on arrive donc sur un message d'erreur à la création
|
driver = self.driver
|
||||||
def test_013_same_name_formation(self):
|
wait = self.wait
|
||||||
driver = self.driver
|
driver.get(URL)
|
||||||
wait = self.wait
|
driver.find_element_by_id("link-create-formation").click()
|
||||||
driver.get(URL)
|
wait.until(EC.url_changes(URL))
|
||||||
driver.find_element_by_id("link-create-formation").click()
|
driver.find_element_by_id("tf_acronyme").send_keys(ACRONYME_FORMATION)
|
||||||
wait.until(EC.url_changes(URL))
|
driver.find_element_by_id("tf_titre").send_keys("TEST")
|
||||||
driver.find_element_by_id("tf_acronyme").send_keys(ACRONYME_FORMATION)
|
driver.find_element_by_id("tf_titre_officiel").send_keys("formation de test")
|
||||||
driver.find_element_by_id("tf_titre").send_keys("TEST")
|
driver.find_element_by_id("tf_submit").click()
|
||||||
driver.find_element_by_id("tf_titre_officiel").send_keys("formation de test")
|
try:
|
||||||
driver.find_element_by_id("tf_submit").click()
|
driver.find_element_by_class_name("error-message")
|
||||||
try:
|
message_erreur_present = True
|
||||||
driver.find_element_by_class_name("error-message")
|
except NoSuchElementException:
|
||||||
message_erreur_present = True
|
message_erreur_present = False
|
||||||
except NoSuchElementException:
|
self.assertTrue(message_erreur_present)
|
||||||
message_erreur_present = False
|
|
||||||
self.assertTrue(message_erreur_present)
|
# Test : Ajout d'une UE dans la formation
|
||||||
|
# @Expected : L'UE est créée et elle apparait désormais dans la liste d'UE de la formation
|
||||||
# Test : Ajout d'une UE dans la formation
|
def test_014_ajout_UE(self):
|
||||||
# @Expected : L'UE est créée et elle apparait désormais dans la liste d'UE de la formation
|
driver = self.driver
|
||||||
def test_014_ajout_UE(self):
|
wait = self.wait
|
||||||
driver = self.driver
|
driver.get(URL)
|
||||||
wait = self.wait
|
id_titre = "titre-" + ACRONYME_FORMATION.lower().replace(" ", "-")
|
||||||
driver.get(URL)
|
driver.find_element_by_id(id_titre).click()
|
||||||
id_titre = "titre-" + ACRONYME_FORMATION.lower().replace(" ", "-")
|
wait.until(EC.url_changes(URL))
|
||||||
driver.find_element_by_id(id_titre).click()
|
driver.find_element_by_xpath("//a[contains(@href,'ue_create?')]").click()
|
||||||
wait.until(EC.url_changes(URL))
|
driver.find_element_by_id("tf_titre").send_keys("UE TEST")
|
||||||
driver.find_element_by_xpath("//a[contains(@href,'ue_create?')]").click()
|
driver.find_element_by_id("tf_acronyme").send_keys("TEST")
|
||||||
driver.find_element_by_id("tf_titre").send_keys("UE TEST")
|
driver.find_element_by_id("tf_submit").click()
|
||||||
driver.find_element_by_id("tf_acronyme").send_keys("TEST")
|
time.sleep(1)
|
||||||
driver.find_element_by_id("tf_submit").click()
|
driver.get(URL)
|
||||||
time.sleep(1)
|
driver.find_element_by_id(id_titre).click()
|
||||||
driver.get(URL)
|
wait.until(EC.url_changes(URL))
|
||||||
driver.find_element_by_id(id_titre).click()
|
self.assertTrue("TEST UE TEST" in driver.page_source)
|
||||||
wait.until(EC.url_changes(URL))
|
driver.get(URL)
|
||||||
self.assertTrue("TEST UE TEST" in driver.page_source)
|
|
||||||
driver.get(URL)
|
# 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
|
||||||
# Test : Ajout d'une matière dans la formation
|
def test_015_ajout_matiere(self):
|
||||||
# @Expected : La matière est créée et elle apparait désormais sur la page de détail de la formation
|
driver = self.driver
|
||||||
def test_015_ajout_matiere(self):
|
wait = self.wait
|
||||||
driver = self.driver
|
driver.get(URL)
|
||||||
wait = self.wait
|
nomMat = "unematieretest"
|
||||||
driver.get(URL)
|
time.sleep(3)
|
||||||
nomMat = "unematieretest"
|
idTitre = "titre-" + ACRONYME_FORMATION.lower().replace(" ", "-")
|
||||||
time.sleep(3)
|
driver.find_element_by_id(idTitre).click()
|
||||||
idTitre = "titre-" + ACRONYME_FORMATION.lower().replace(" ", "-")
|
wait.until(EC.url_changes(URL))
|
||||||
driver.find_element_by_id(idTitre).click()
|
time.sleep(3)
|
||||||
wait.until(EC.url_changes(URL))
|
driver.find_element_by_xpath("//a[contains(@href,'matiere_create?')]").click()
|
||||||
time.sleep(3)
|
driver.find_element_by_id("tf_titre").send_keys(nomMat)
|
||||||
driver.find_element_by_xpath("//a[contains(@href,'matiere_create?')]").click()
|
driver.find_element_by_id("tf_numero").send_keys("1")
|
||||||
driver.find_element_by_id("tf_titre").send_keys(nomMat)
|
driver.find_element_by_id("tf_submit").click()
|
||||||
driver.find_element_by_id("tf_numero").send_keys("1")
|
time.sleep(3)
|
||||||
driver.find_element_by_id("tf_submit").click()
|
driver.get(URL)
|
||||||
time.sleep(3)
|
driver.find_element_by_id(idTitre).click()
|
||||||
driver.get(URL)
|
time.sleep(3)
|
||||||
driver.find_element_by_id(idTitre).click()
|
wait.until(EC.url_changes(URL))
|
||||||
time.sleep(3)
|
elements = driver.find_elements_by_xpath("//a[contains(@href,'matiere_edit?')]")
|
||||||
wait.until(EC.url_changes(URL))
|
matIsPresent = False
|
||||||
elements = driver.find_elements_by_xpath("//a[contains(@href,'matiere_edit?')]")
|
for element in elements:
|
||||||
matIsPresent = False
|
if element.text == nomMat:
|
||||||
for element in elements:
|
matIsPresent = True
|
||||||
if element.text == nomMat:
|
self.assertTrue(matIsPresent)
|
||||||
matIsPresent = True
|
|
||||||
self.assertTrue(matIsPresent)
|
# Test : Ajout d'un semestre dans la formation
|
||||||
|
# @Expected : Le semestre est créé et il apparait désormais dans la table des formations
|
||||||
# Test : Ajout d'un semestre dans la formation
|
def test_016_ajout_Semestre(self):
|
||||||
# @Expected : Le semestre est créé et il apparait désormais dans la table des formations
|
driver = self.driver
|
||||||
def test_016_ajout_Semestre(self):
|
wait = self.wait
|
||||||
driver = self.driver
|
driver.get(URL)
|
||||||
wait = self.wait
|
idAddSemestre = "add-semestre-" + ACRONYME_FORMATION.lower().replace(" ", "-")
|
||||||
driver.get(URL)
|
driver.find_element_by_id(idAddSemestre).click()
|
||||||
idAddSemestre = "add-semestre-" + ACRONYME_FORMATION.lower().replace(" ", "-")
|
wait.until(EC.url_changes(URL))
|
||||||
driver.find_element_by_id(idAddSemestre).click()
|
driver.find_element_by_name("date_debut").send_keys("01/01/2021")
|
||||||
wait.until(EC.url_changes(URL))
|
driver.find_element_by_name("date_fin").send_keys("30/06/2021")
|
||||||
driver.find_element_by_name("date_debut").send_keys("01/01/2021")
|
driver.find_element_by_name("responsable_id").send_keys("BACH Jean-Sebastien (Bach)")
|
||||||
driver.find_element_by_name("date_fin").send_keys("30/06/2021")
|
Select(driver.find_element_by_id("tf_semestre_id")).select_by_value("4")
|
||||||
driver.find_element_by_name("responsable_id").send_keys("HAUSPIE Michael (bach)")
|
driver.find_element_by_id("tf_submit").click()
|
||||||
Select(driver.find_element_by_id("tf_semestre_id")).select_by_value("4")
|
wait.until(EC.url_changes(URL))
|
||||||
driver.find_element_by_id("tf_submit").click()
|
self.assertTrue(
|
||||||
wait.until(EC.url_changes(URL))
|
"Nouveau semestre créé"
|
||||||
self.assertTrue(
|
in driver.find_element_by_class_name("head_message").text
|
||||||
"Nouveau semestre créé"
|
)
|
||||||
in driver.find_element_by_class_name("head_message").text
|
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
|
||||||
|
# @expected : La formation est dupliquée et à la version "2"
|
||||||
# Test : Dupplique une formation sous une nouvelle version
|
def test_017_creer_nouvelle_version_formation(self):
|
||||||
# @expected : La formation est dupliquée et à la version "2"
|
driver = self.driver
|
||||||
def test_017_creer_nouvelle_version_formation(self):
|
wait = self.wait
|
||||||
driver = self.driver
|
driver.get(URL)
|
||||||
wait = self.wait
|
idTitre = "titre-" + ACRONYME_FORMATION
|
||||||
driver.get(URL)
|
driver.find_element_by_id(idTitre).click()
|
||||||
idTitre = "titre-" + ACRONYME_FORMATION
|
wait.until(EC.url_changes(URL))
|
||||||
driver.find_element_by_id(idTitre).click()
|
tmpurl = driver.current_url
|
||||||
wait.until(EC.url_changes(URL))
|
driver.find_element_by_xpath(
|
||||||
tmpurl = driver.current_url
|
"//a[contains(@href,'formation_create_new_version?')]"
|
||||||
driver.find_element_by_xpath(
|
).click()
|
||||||
"//a[contains(@href,'formation_create_new_version?')]"
|
wait.until(EC.url_changes(tmpurl))
|
||||||
).click()
|
self.assertTrue("Nouvelle version !" in driver.page_source)
|
||||||
wait.until(EC.url_changes(tmpurl))
|
driver.get(URL)
|
||||||
self.assertTrue("Nouvelle version !" in driver.page_source)
|
elements = driver.find_elements_by_class_name("version")
|
||||||
driver.get(URL)
|
version_is_present = False
|
||||||
elements = driver.find_elements_by_class_name("version")
|
for element in elements:
|
||||||
version_is_present = False
|
if element.text == "2":
|
||||||
for element in elements:
|
version_is_present = True
|
||||||
if element.text == "2":
|
self.assertTrue(version_is_present)
|
||||||
version_is_present = True
|
|
||||||
self.assertTrue(version_is_present)
|
# 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
|
||||||
# Test : Supprime une formation après avoir supprimé les semestres qui y sont rattachés
|
def test_020_delete_formation(self):
|
||||||
# @expected : La formation n'apparait plus dans le tableau des formations
|
driver = self.driver
|
||||||
def test_020_delete_formation(self):
|
wait = self.wait
|
||||||
driver = self.driver
|
driver.get(URL)
|
||||||
wait = self.wait
|
id_button_delete = "delete-formation-" + ACRONYME_FORMATION
|
||||||
driver.get(URL)
|
driver.find_element_by_id(id_button_delete).click()
|
||||||
id_button_delete = "delete-formation-" + ACRONYME_FORMATION
|
wait.until(EC.url_changes(URL))
|
||||||
driver.find_element_by_id(id_button_delete).click()
|
tmp_url_delete = driver.current_url
|
||||||
wait.until(EC.url_changes(URL))
|
liste_semestres = driver.find_elements_by_xpath(
|
||||||
tmp_url_delete = driver.current_url
|
"//a[contains(@href, 'formsemestre_status?')]"
|
||||||
liste_semestres = driver.find_elements_by_xpath(
|
)
|
||||||
"//a[contains(@href, 'formsemestre_status?')]"
|
for semestre in liste_semestres:
|
||||||
)
|
semestre.click()
|
||||||
for semestre in liste_semestres:
|
wait.until(EC.url_changes(URL))
|
||||||
semestre.click()
|
driver.find_element_by_xpath(
|
||||||
wait.until(EC.url_changes(URL))
|
"(//a[contains(text(),'Semestre')])[2]"
|
||||||
driver.find_element_by_xpath(
|
).click()
|
||||||
"(//a[contains(text(),'Semestre')])[2]"
|
driver.find_element_by_xpath(
|
||||||
).click()
|
"//a[contains(@href, 'formsemestre_delete?')]"
|
||||||
driver.find_element_by_xpath(
|
).click()
|
||||||
"//a[contains(@href, 'formsemestre_delete?')]"
|
wait.until(EC.url_changes(URL))
|
||||||
).click()
|
driver.find_element_by_id("tf_submit").click()
|
||||||
wait.until(EC.url_changes(URL))
|
time.sleep(2)
|
||||||
driver.find_element_by_id("tf_submit").click()
|
driver.find_element_by_xpath("//input[@value='OK']").click()
|
||||||
time.sleep(2)
|
driver.get(tmp_url_delete)
|
||||||
driver.find_element_by_xpath("//input[@value='OK']").click()
|
driver.find_element_by_xpath(
|
||||||
driver.get(tmp_url_delete)
|
"//input[@value='Supprimer cette formation']"
|
||||||
driver.find_element_by_xpath(
|
).click()
|
||||||
"//input[@value='Supprimer cette formation']"
|
driver.get(URL)
|
||||||
).click()
|
formations = driver.find_elements_by_class_name("version")
|
||||||
driver.get(URL)
|
formation_delete = True
|
||||||
formations = driver.find_elements_by_class_name("version")
|
for formation in formations:
|
||||||
formation_delete = True
|
if "1" in formation.text:
|
||||||
for formation in formations:
|
formation_delete = False
|
||||||
if "1" in formation.text:
|
self.assertTrue(formation_delete)
|
||||||
formation_delete = False
|
|
||||||
self.assertTrue(formation_delete)
|
# def test_create_module(self):
|
||||||
|
# driver = self.driver
|
||||||
# def test_create_module(self):
|
# element = driver.find_element_by_name("TESTDPT")
|
||||||
# driver = self.driver
|
|
||||||
# element = driver.find_element_by_name("TESTDPT")
|
# ferme la fenetre à chaque fin de test
|
||||||
|
def tearDown(self):
|
||||||
# ferme la fenetre à chaque fin de test
|
self.driver.close()
|
||||||
def tearDown(self):
|
|
||||||
self.driver.close()
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
deleteDepartement.main()
|
||||||
if __name__ == "__main__":
|
createDepartement.main()
|
||||||
deleteDepartement.main()
|
creationSiteDepartement.main()
|
||||||
createDepartement.main()
|
creationUtilisateurs.main()
|
||||||
creationSiteDepartement.main()
|
|
||||||
|
unittest.main(
|
||||||
unittest.main(
|
testRunner=HtmlTestRunner.HTMLTestRunner(
|
||||||
testRunner=HtmlTestRunner.HTMLTestRunner(
|
report_name="02_creation_formation_test",
|
||||||
report_name="02_creation_formation_test",
|
output="./ResultatTest",
|
||||||
output="./ResultatTest",
|
combine_reports=True,
|
||||||
combine_reports=True,
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
@ -1,206 +1,215 @@
|
|||||||
import unittest
|
import unittest
|
||||||
import time
|
import time
|
||||||
import HtmlTestRunner
|
import HtmlTestRunner
|
||||||
import subprocess
|
import subprocess
|
||||||
import createDepartement
|
import createDepartement
|
||||||
import creationSiteDepartement
|
import creationSiteDepartement
|
||||||
import deleteDepartement
|
import deleteDepartement
|
||||||
from setting import (
|
from setting import (
|
||||||
SCODOC_ADMIN_ID,
|
SCODOC_ADMIN_ID,
|
||||||
SCODOC_ADMIN_PASS,
|
SCODOC_ADMIN_PASS,
|
||||||
SCHEMA,
|
SCHEMA,
|
||||||
BASE_URL,
|
SCODOC_SERVER,
|
||||||
NOM_DPT,
|
SCODOC_PORT,
|
||||||
LINK_SCODOC_SERVER,
|
NOM_DPT,
|
||||||
BASE_SSH_URL,
|
LINK_SCODOC_SERVER,
|
||||||
NAVIGATEUR,
|
BASE_SSH_URL,
|
||||||
)
|
NAVIGATEUR,
|
||||||
import urllib.parse as urlparse
|
)
|
||||||
from urllib.parse import parse_qs
|
from selenium import webdriver
|
||||||
from selenium import webdriver
|
from selenium.webdriver.common.keys import Keys
|
||||||
from selenium.webdriver.common.keys import Keys
|
from selenium.webdriver.support import expected_conditions as EC
|
||||||
from selenium.webdriver.support import expected_conditions as EC
|
from selenium.common.exceptions import NoSuchElementException
|
||||||
from selenium.common.exceptions import NoSuchElementException
|
from selenium.webdriver.support.ui import Select, WebDriverWait
|
||||||
from selenium.webdriver.support.ui import Select, WebDriverWait
|
from selenium.webdriver.support.select import Select
|
||||||
from selenium.webdriver.support.select import Select
|
|
||||||
|
URL = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + NOM_DPT + "/Scolarite"
|
||||||
URL = SCHEMA + "://" + BASE_URL + NOM_DPT + "/Scolarite"
|
nomEtu = "Semestre11"
|
||||||
nomEtu = "Semestre11"
|
prenomEtu = "Etudiant1"
|
||||||
prenomEtu = "Etudiant1"
|
nip = "11122234"
|
||||||
nip = "11122234"
|
domicile = "50 rue de la marmite"
|
||||||
domicile = "50 rue de la marmite"
|
codepostaldomicile = "59000"
|
||||||
codepostaldomicile = "59000"
|
paysdomicile = "Lille"
|
||||||
paysdomicile = "Lille"
|
|
||||||
|
URL_ROOT = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT
|
||||||
|
URL_AUTH = "/".join((URL_ROOT, "auth", "login"))
|
||||||
class PythonOrgSearch(unittest.TestCase):
|
URL_SCODOC8 = "/".join((URL_ROOT, "index"))
|
||||||
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
URL_HOME = "/".join((URL_ROOT, "ScoDoc", "index"))
|
||||||
def setUp(self):
|
URL_DEPT = "/".join((URL_ROOT, "ScoDoc", NOM_DPT, "Scolarite", "index_html"))
|
||||||
next_page = ""
|
URL_ADMIN = "/".join((URL_ROOT, "ScoDoc", "admin"))
|
||||||
if NAVIGATEUR == "firefox":
|
|
||||||
self.driver = webdriver.Firefox()
|
ACRONYME_FORMATION = "formationtest"
|
||||||
else:
|
URL = URL_SCODOC8
|
||||||
self.driver = webdriver.Chrome()
|
|
||||||
auth_page = SCHEMA + "://" + BASE_SSH_URL + "auth/login?next=%2F" + next_page
|
class PythonOrgSearch(unittest.TestCase):
|
||||||
self.driver.get(auth_page)
|
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
||||||
self.driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
|
def setUp(self):
|
||||||
self.driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
|
next_page = ""
|
||||||
self.driver.find_element_by_id("submit").click()
|
if NAVIGATEUR == "firefox":
|
||||||
self.driver.get(SCHEMA + "://" + BASE_URL)
|
self.driver = webdriver.Firefox()
|
||||||
|
else:
|
||||||
# Test : creer un etudiant et verifie si sa fiche etudiante est creee
|
self.driver = webdriver.Chrome()
|
||||||
# @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
|
self.wait = WebDriverWait(self.driver, 10)
|
||||||
def test_01_creation_etudiant(self):
|
auth_page = URL_AUTH + ("?next=" + next_page).replace("/", "%2F")
|
||||||
driver = self.driver
|
self.driver.get(auth_page)
|
||||||
global URL
|
self.driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
|
||||||
driver.find_element_by_id("link-create-student").click()
|
self.driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
|
||||||
self.wait.until(EC.url_changes(URL))
|
self.driver.find_element_by_id("submit").click()
|
||||||
URL = driver.current_url
|
self.driver.get(URL_HOME)
|
||||||
driver.find_element_by_id("tf_nom").send_keys(nomEtu)
|
|
||||||
driver.find_element_by_id("tf_prenom").send_keys(prenomEtu)
|
# Test : creer un etudiant et verifie si sa fiche etudiante est creee
|
||||||
driver.find_element_by_id("tf_annee").send_keys("2021")
|
# @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
|
||||||
driver.find_element_by_id("tf_code_nip").send_keys(nip)
|
def test_01_creation_etudiant(self):
|
||||||
driver.find_element_by_name("dont_check_homonyms:list").click()
|
driver = self.driver
|
||||||
driver.find_element_by_id("tf_submit").click()
|
global URL
|
||||||
time.sleep(1)
|
driver.find_element_by_id("link-create-student").click()
|
||||||
self.assertTrue("M. " + prenomEtu + " " + nomEtu.upper() in driver.page_source)
|
self.wait.until(EC.url_changes(URL))
|
||||||
self.assertTrue(nip in driver.page_source)
|
URL = driver.current_url
|
||||||
|
driver.find_element_by_id("tf_nom").send_keys(nomEtu)
|
||||||
# Test : Creer un étudiant avec un nip qui est déjà présent dans la base Scodoc
|
driver.find_element_by_id("tf_prenom").send_keys(prenomEtu)
|
||||||
# @expected : La création mène à une page qui affiche "code étudiant dupliqué", l'étudiant n'est pas créé
|
driver.find_element_by_id("tf_annee").send_keys("2021")
|
||||||
def test_02_creation_etudiant_avec_meme_nip(self):
|
driver.find_element_by_id("tf_code_nip").send_keys(nip)
|
||||||
driver = self.driver
|
driver.find_element_by_name("dont_check_homonyms:list").click()
|
||||||
global URL
|
driver.find_element_by_id("tf_submit").click()
|
||||||
driver.get(URL)
|
time.sleep(1)
|
||||||
driver.find_element_by_id("tf_nom").send_keys(nomEtu)
|
self.assertTrue("M. " + prenomEtu + " " + nomEtu.upper() in driver.page_source)
|
||||||
driver.find_element_by_id("tf_prenom").send_keys(prenomEtu)
|
self.assertTrue(nip in driver.page_source)
|
||||||
driver.find_element_by_id("tf_annee").send_keys("2021")
|
|
||||||
driver.find_element_by_id("tf_code_nip").send_keys(nip)
|
# Test : Creer un étudiant avec un nip qui est déjà présent dans la base Scodoc
|
||||||
driver.find_element_by_name("dont_check_homonyms:list").click()
|
# @expected : La création mène à une page qui affiche "code étudiant dupliqué", l'étudiant n'est pas créé
|
||||||
driver.find_element_by_id("tf_submit").click()
|
def test_02_creation_etudiant_avec_meme_nip(self):
|
||||||
time.sleep(1)
|
driver = self.driver
|
||||||
self.assertTrue(
|
global URL
|
||||||
"Code étudiant (code_nip) dupliqué !"
|
driver.get(URL)
|
||||||
in driver.find_element_by_class_name("title-error").text
|
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")
|
||||||
# Test Modification de l'adresse étudiant
|
driver.find_element_by_id("tf_code_nip").send_keys(nip)
|
||||||
# expected : La nouvelle adresse est mise à jour sur la page information de l'étudiant
|
driver.find_element_by_name("dont_check_homonyms:list").click()
|
||||||
def test_03_modification_adresse_etudiant(self):
|
driver.find_element_by_id("tf_submit").click()
|
||||||
driver = self.driver
|
time.sleep(1)
|
||||||
global URL
|
self.assertTrue(
|
||||||
driver.get(URL)
|
"Code étudiant (code_nip) dupliqué !"
|
||||||
element = driver.find_element_by_id("in-expnom")
|
in driver.find_element_by_class_name("title-error").text
|
||||||
element.send_keys(nomEtu)
|
)
|
||||||
element.submit()
|
|
||||||
self.wait.until(EC.url_changes(URL))
|
# Test Modification de l'adresse étudiant
|
||||||
driver.find_element_by_xpath(
|
# expected : La nouvelle adresse est mise à jour sur la page information de l'étudiant
|
||||||
"//a[contains(@href,'formChangeCoordonnees')]"
|
def test_03_modification_adresse_etudiant(self):
|
||||||
).click()
|
driver = self.driver
|
||||||
time.sleep(1)
|
global URL
|
||||||
driver.find_element_by_id("tf_domicile").send_keys(domicile)
|
driver.get(URL)
|
||||||
driver.find_element_by_id("tf_codepostaldomicile").send_keys(codepostaldomicile)
|
element = driver.find_element_by_id("in-expnom")
|
||||||
driver.find_element_by_id("tf_paysdomicile").send_keys(paysdomicile)
|
element.send_keys(nomEtu)
|
||||||
driver.find_element_by_id("tf_submit").click()
|
element.submit()
|
||||||
time.sleep(1)
|
self.wait.until(EC.url_changes(URL))
|
||||||
self.assertTrue(
|
driver.find_element_by_xpath(
|
||||||
codepostaldomicile in driver.find_element_by_id("student-address").text
|
"//a[contains(@href,'formChangeCoordonnees')]"
|
||||||
)
|
).click()
|
||||||
|
time.sleep(1)
|
||||||
# Test Inscription d'un étudiant dans un semestre
|
driver.find_element_by_id("tf_domicile").send_keys(domicile)
|
||||||
# @expected :
|
driver.find_element_by_id("tf_codepostaldomicile").send_keys(codepostaldomicile)
|
||||||
def test_04_inscription_etudiant(self):
|
driver.find_element_by_id("tf_paysdomicile").send_keys(paysdomicile)
|
||||||
driver = self.driver
|
driver.find_element_by_id("tf_submit").click()
|
||||||
global URL
|
time.sleep(1)
|
||||||
driver.get(URL)
|
self.assertTrue(
|
||||||
element = driver.find_element_by_id("in-expnom")
|
codepostaldomicile in driver.find_element_by_id("student-address").text
|
||||||
element.send_keys(nomEtu)
|
)
|
||||||
element.submit()
|
|
||||||
self.wait.until(EC.url_changes(URL))
|
# Test Inscription d'un étudiant dans un semestre
|
||||||
driver.find_element_by_xpath(
|
# @expected :
|
||||||
"//a[contains(@href, 'formsemestre_inscription_with_modules_form')]"
|
def test_04_inscription_etudiant(self):
|
||||||
).click()
|
driver = self.driver
|
||||||
self.wait.until(EC.url_changes(URL))
|
global URL
|
||||||
try:
|
driver.get(URL)
|
||||||
semestres = driver.find_elements_by_xpath(
|
element = driver.find_element_by_id("in-expnom")
|
||||||
"//a[contains(@id,'inscription-semestre-')]"
|
element.send_keys(nomEtu)
|
||||||
)
|
element.submit()
|
||||||
except NoSuchElementException:
|
self.wait.until(EC.url_changes(URL))
|
||||||
self.assertFalse(True)
|
driver.find_element_by_xpath(
|
||||||
semestres[0].click()
|
"//a[contains(@href, 'formsemestre_inscription_with_modules_form')]"
|
||||||
driver.find_element_by_xpath("//input[@value='Inscrire']").click()
|
).click()
|
||||||
time.sleep(2)
|
self.wait.until(EC.url_changes(URL))
|
||||||
boutonInscrireIsNotPresent = False
|
try:
|
||||||
try:
|
semestres = driver.find_elements_by_xpath(
|
||||||
driver.find_element_by_partial_link_text("inscrire")
|
"//a[contains(@id,'inscription-semestre-')]"
|
||||||
except:
|
)
|
||||||
boutonInscrireIsNotPresent = True
|
except NoSuchElementException:
|
||||||
self.assertTrue(boutonInscrireIsNotPresent)
|
self.assertFalse(True)
|
||||||
|
semestres[0].click()
|
||||||
# Test Supprime un étudiant
|
driver.find_element_by_xpath("//input[@value='Inscrire']").click()
|
||||||
# @expected : Lors d'une recherche sur le nom de l'étudiant, aucun résultat apparait
|
time.sleep(2)
|
||||||
def test_05_suppresion_etudiant(self):
|
bouton_inscrire_is_not_present = False
|
||||||
driver = self.driver
|
try:
|
||||||
urlRecherche = (
|
driver.find_element_by_partial_link_text("inscrire")
|
||||||
SCHEMA
|
except:
|
||||||
+ "://"
|
bouton_inscrire_is_not_present = True
|
||||||
+ BASE_URL
|
self.assertTrue(bouton_inscrire_is_not_present)
|
||||||
+ "ScoDoc/"
|
|
||||||
+ NOM_DPT
|
# Test Supprime un étudiant
|
||||||
+ "/Scolarite/search_etud_in_dept"
|
# @expected : Lors d'une recherche sur le nom de l'étudiant, aucun résultat apparait
|
||||||
)
|
def test_05_suppresion_etudiant(self):
|
||||||
driver.get(urlRecherche)
|
driver = self.driver
|
||||||
element = driver.find_element_by_name("expnom")
|
urlRecherche = (
|
||||||
element.send_keys(nomEtu)
|
SCHEMA
|
||||||
element.submit()
|
+ "://"
|
||||||
time.sleep(1)
|
+ SCODOC_SERVER + ":" + SCODOC_PORT
|
||||||
etudid = driver.find_element_by_id("euid")
|
+ "ScoDoc/"
|
||||||
url = (
|
+ NOM_DPT
|
||||||
SCHEMA
|
+ "/Scolarite/search_etud_in_dept"
|
||||||
+ "://"
|
)
|
||||||
+ BASE_URL
|
driver.get(urlRecherche)
|
||||||
+ "ScoDoc/"
|
element = driver.find_element_by_name("expnom")
|
||||||
+ NOM_DPT
|
element.send_keys(nomEtu)
|
||||||
+ "/Scolarite/etudident_delete?etudid="
|
element.submit()
|
||||||
+ etudid.text
|
time.sleep(1)
|
||||||
)
|
etudid = driver.find_element_by_id("euid")
|
||||||
driver.get(url)
|
url = (
|
||||||
time.sleep(1)
|
SCHEMA
|
||||||
driver.find_element_by_xpath(
|
+ "://"
|
||||||
"//input[@value='Supprimer définitivement cet étudiant']"
|
+ SCODOC_SERVER + ":" + SCODOC_PORT
|
||||||
).click()
|
+ "ScoDoc/"
|
||||||
driver.get(urlRecherche)
|
+ NOM_DPT
|
||||||
element = driver.find_element_by_name("expnom")
|
+ "/Scolarite/etudident_delete?etudid="
|
||||||
element.send_keys(nomEtu)
|
+ etudid.text
|
||||||
element.submit()
|
)
|
||||||
time.sleep(1)
|
driver.get(url)
|
||||||
try:
|
time.sleep(1)
|
||||||
element = driver.find_element_by_id("title-no-result")
|
driver.find_element_by_xpath(
|
||||||
self.assertTrue("Aucun résultat" in element.text)
|
"//input[@value='Supprimer définitivement cet étudiant']"
|
||||||
except:
|
).click()
|
||||||
self.assertFalse(True)
|
driver.get(urlRecherche)
|
||||||
|
element = driver.find_element_by_name("expnom")
|
||||||
# ferme la fenetre
|
element.send_keys(nomEtu)
|
||||||
def tearDown(self):
|
element.submit()
|
||||||
self.driver.close()
|
time.sleep(1)
|
||||||
|
try:
|
||||||
|
element = driver.find_element_by_id("title-no-result")
|
||||||
if __name__ == "__main__":
|
self.assertTrue("Aucun résultat" in element.text)
|
||||||
deleteDepartement.main()
|
except:
|
||||||
createDepartement.main()
|
self.assertFalse(True)
|
||||||
creationSiteDepartement.main()
|
|
||||||
cmdProcess = [
|
# ferme la fenetre
|
||||||
"./scriptExecution.sh",
|
def tearDown(self):
|
||||||
LINK_SCODOC_SERVER,
|
self.driver.close()
|
||||||
NOM_DPT,
|
|
||||||
"test_scenario1_formation.py",
|
|
||||||
]
|
if __name__ == "__main__":
|
||||||
process = subprocess.Popen(cmdProcess)
|
deleteDepartement.main()
|
||||||
process.wait()
|
createDepartement.main()
|
||||||
unittest.main(
|
creationSiteDepartement.main()
|
||||||
testRunner=HtmlTestRunner.HTMLTestRunner(
|
cmdProcess = [
|
||||||
report_name="03_Etudiant_test",
|
"./scriptExecution.sh",
|
||||||
output="./ResultatTest",
|
LINK_SCODOC_SERVER,
|
||||||
combine_reports=True,
|
NOM_DPT,
|
||||||
)
|
"test_scenario1_formation.py",
|
||||||
)
|
]
|
||||||
|
process = subprocess.Popen(cmdProcess)
|
||||||
|
process.wait()
|
||||||
|
unittest.main(
|
||||||
|
testRunner=HtmlTestRunner.HTMLTestRunner(
|
||||||
|
report_name="03_Etudiant_test",
|
||||||
|
output="./ResultatTest",
|
||||||
|
combine_reports=True,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
@ -1,170 +1,171 @@
|
|||||||
import unittest
|
import unittest
|
||||||
import time
|
import time
|
||||||
import urllib.parse as urlparse
|
import urllib.parse as urlparse
|
||||||
import subprocess
|
import subprocess
|
||||||
import HtmlTestRunner
|
import HtmlTestRunner
|
||||||
import createDepartement
|
import createDepartement
|
||||||
import creationSiteDepartement
|
import creationSiteDepartement
|
||||||
import deleteDepartement
|
import deleteDepartement
|
||||||
from setting import (
|
from setting import (
|
||||||
SCODOC_ADMIN_ID,
|
SCODOC_ADMIN_ID,
|
||||||
SCODOC_ADMIN_PASS,
|
SCODOC_ADMIN_PASS,
|
||||||
SCHEMA,
|
SCHEMA,
|
||||||
BASE_URL,
|
SCODOC_SERVER,
|
||||||
NOM_DPT,
|
SCODOC_PORT,
|
||||||
LINK_SCODOC_SERVER,
|
NOM_DPT,
|
||||||
BASE_SSH_URL,
|
LINK_SCODOC_SERVER,
|
||||||
NAVIGATEUR,
|
BASE_SSH_URL,
|
||||||
)
|
NAVIGATEUR,
|
||||||
from urllib.parse import parse_qs
|
)
|
||||||
from selenium import webdriver
|
from urllib.parse import parse_qs
|
||||||
from selenium.webdriver.common.keys import Keys
|
from selenium import webdriver
|
||||||
from selenium.webdriver.support import expected_conditions as EC
|
from selenium.webdriver.common.keys import Keys
|
||||||
from selenium.webdriver.support.ui import Select, WebDriverWait
|
from selenium.webdriver.support import expected_conditions as EC
|
||||||
from selenium.webdriver.support.select import Select
|
from selenium.webdriver.support.ui import Select, WebDriverWait
|
||||||
|
from selenium.webdriver.support.select import Select
|
||||||
URL = SCHEMA + "://" + BASE_URL + NOM_DPT + "/Scolarite"
|
|
||||||
NOM_ETU = "Semestre11"
|
URL = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + NOM_DPT + "/Scolarite"
|
||||||
PRENOM_ETU = "EtudiantNumero1"
|
NOM_ETU = "Semestre11"
|
||||||
dateDebutAbsenceNonJustifiee = "31/05/2021"
|
PRENOM_ETU = "EtudiantNumero1"
|
||||||
dateDebutAbsenceJustifiee = "25/05/2021"
|
dateDebutAbsenceNonJustifiee = "31/05/2021"
|
||||||
|
dateDebutAbsenceJustifiee = "25/05/2021"
|
||||||
|
|
||||||
class PythonOrgSearch(unittest.TestCase):
|
|
||||||
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
class PythonOrgSearch(unittest.TestCase):
|
||||||
def setUp(self):
|
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
||||||
next_page = ""
|
def setUp(self):
|
||||||
if NAVIGATEUR == "firefox":
|
next_page = ""
|
||||||
self.driver = webdriver.Firefox()
|
if NAVIGATEUR == "firefox":
|
||||||
else:
|
self.driver = webdriver.Firefox()
|
||||||
self.driver = webdriver.Chrome()
|
else:
|
||||||
auth_page = SCHEMA + "://" + BASE_SSH_URL + "auth/login?next=%2F" + next_page
|
self.driver = webdriver.Chrome()
|
||||||
self.driver.get(auth_page)
|
auth_page = SCHEMA + "://" + BASE_SSH_URL + "auth/login?next=%2F" + next_page
|
||||||
self.driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
|
self.driver.get(auth_page)
|
||||||
self.driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
|
self.driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
|
||||||
self.driver.find_element_by_id("submit").click()
|
self.driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
|
||||||
self.driver.get(SCHEMA + "://" + BASE_URL)
|
self.driver.find_element_by_id("submit").click()
|
||||||
|
self.driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT)
|
||||||
def test_010_trouver_etudiant(self):
|
|
||||||
driver = self.driver
|
def test_010_trouver_etudiant(self):
|
||||||
global URL
|
driver = self.driver
|
||||||
self.driver.get(SCHEMA + "://" + BASE_URL + NOM_DPT + "/Scolarite")
|
global URL
|
||||||
element = self.driver.find_element_by_id("in-expnom")
|
self.driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + NOM_DPT + "/Scolarite")
|
||||||
element.send_keys(NOM_ETU)
|
element = self.driver.find_element_by_id("in-expnom")
|
||||||
element.submit()
|
element.send_keys(NOM_ETU)
|
||||||
self.wait.until(EC.url_changes(URL))
|
element.submit()
|
||||||
URL = driver.current_url
|
self.wait.until(EC.url_changes(URL))
|
||||||
self.assertTrue(NOM_ETU.upper() in driver.page_source)
|
URL = driver.current_url
|
||||||
|
self.assertTrue(NOM_ETU.upper() in driver.page_source)
|
||||||
# Test : creer une absence non justifiée
|
|
||||||
# @expected : La fiche étudiante est incrémentée avec le nombre d'absence injustifiée correspondant
|
# Test : creer une absence non justifiée
|
||||||
def test_020_ajout_absence_non_justifiee(self):
|
# @expected : La fiche étudiante est incrémentée avec le nombre d'absence injustifiée correspondant
|
||||||
driver = self.driver
|
def test_020_ajout_absence_non_justifiee(self):
|
||||||
global URL
|
driver = self.driver
|
||||||
driver.find_element_by_id("add-absence").click()
|
global URL
|
||||||
driver.find_element_by_name("datedebut").send_keys(dateDebutAbsenceNonJustifiee)
|
driver.find_element_by_id("add-absence").click()
|
||||||
driver.find_element_by_id("butsubmit").submit()
|
driver.find_element_by_name("datedebut").send_keys(dateDebutAbsenceNonJustifiee)
|
||||||
time.sleep(1)
|
driver.find_element_by_id("butsubmit").submit()
|
||||||
self.assertTrue(
|
time.sleep(1)
|
||||||
"Ajout de 2 absences <b>NON justifiées</b>" in driver.page_source
|
self.assertTrue(
|
||||||
)
|
"Ajout de 2 absences <b>NON justifiées</b>" in driver.page_source
|
||||||
|
)
|
||||||
driver = self.driver
|
|
||||||
driver.find_element_by_link_text("Liste").click()
|
driver = self.driver
|
||||||
self.assertTrue("2 absences non justifiées:" in driver.page_source)
|
driver.find_element_by_link_text("Liste").click()
|
||||||
|
self.assertTrue("2 absences non justifiées:" in driver.page_source)
|
||||||
# def test_modification_liste_absence_non_justifiee(self):
|
|
||||||
# driver = self.driver
|
# def test_modification_liste_absence_non_justifiee(self):
|
||||||
# driver.find_element_by_link_text("Liste").click()
|
# driver = self.driver
|
||||||
# self.assertTrue("2 absences non justifiées:" in driver.page_source)
|
# driver.find_element_by_link_text("Liste").click()
|
||||||
|
# self.assertTrue("2 absences non justifiées:" in driver.page_source)
|
||||||
# Test pour ajouter deux absences justifiées
|
|
||||||
# @expected : La fiche d'information de l'étudiant concerné à son compteur d'absence augmenté de 2
|
# Test pour ajouter deux absences justifiées
|
||||||
def test_021_ajout_absence_justifiee(self):
|
# @expected : La fiche d'information de l'étudiant concerné à son compteur d'absence augmenté de 2
|
||||||
driver = self.driver
|
def test_021_ajout_absence_justifiee(self):
|
||||||
global URL
|
driver = self.driver
|
||||||
driver.find_element_by_id("add-absence").click()
|
global URL
|
||||||
driver.find_element_by_name("datedebut").send_keys(dateDebutAbsenceJustifiee)
|
driver.find_element_by_id("add-absence").click()
|
||||||
driver.find_element_by_name("estjust").click()
|
driver.find_element_by_name("datedebut").send_keys(dateDebutAbsenceJustifiee)
|
||||||
driver.find_element_by_id("butsubmit").submit()
|
driver.find_element_by_name("estjust").click()
|
||||||
time.sleep(1)
|
driver.find_element_by_id("butsubmit").submit()
|
||||||
self.assertTrue("Ajout de 2 absences <b>justifiées</b>" in driver.page_source)
|
time.sleep(1)
|
||||||
driver = self.driver
|
self.assertTrue("Ajout de 2 absences <b>justifiées</b>" in driver.page_source)
|
||||||
driver.find_element_by_link_text("Liste").click()
|
driver = self.driver
|
||||||
self.assertTrue("2 absences justifiées:" in driver.page_source)
|
driver.find_element_by_link_text("Liste").click()
|
||||||
|
self.assertTrue("2 absences justifiées:" in driver.page_source)
|
||||||
# def test_modification_liste_absence_justifiee(self):
|
|
||||||
# driver = self.driver
|
# def test_modification_liste_absence_justifiee(self):
|
||||||
# driver.find_element_by_link_text("Liste").click()
|
# driver = self.driver
|
||||||
# self.assertTrue("2 absences justifiées:" in driver.page_source)
|
# driver.find_element_by_link_text("Liste").click()
|
||||||
|
# self.assertTrue("2 absences justifiées:" in driver.page_source)
|
||||||
# Test Justification d'une absence non justifiée
|
|
||||||
# @expected : Le champs des absences non justifiées diminue et celui des justifiés augmente du nombre d'absence
|
# Test Justification d'une absence non justifiée
|
||||||
def test_022_ajout_justification(self):
|
# @expected : Le champs des absences non justifiées diminue et celui des justifiés augmente du nombre d'absence
|
||||||
driver = self.driver
|
def test_022_ajout_justification(self):
|
||||||
global URL
|
driver = self.driver
|
||||||
driver.find_element_by_id("justify-absence").click()
|
global URL
|
||||||
driver.find_element_by_name("datedebut").send_keys(dateDebutAbsenceJustifiee)
|
driver.find_element_by_id("justify-absence").click()
|
||||||
driver.find_element_by_name("description").send_keys("Un test selenium")
|
driver.find_element_by_name("datedebut").send_keys(dateDebutAbsenceJustifiee)
|
||||||
driver.find_element_by_xpath("//input[@value='Envoyer']").click()
|
driver.find_element_by_name("description").send_keys("Un test selenium")
|
||||||
self.wait.until(EC.url_changes(URL))
|
driver.find_element_by_xpath("//input[@value='Envoyer']").click()
|
||||||
self.assertTrue("Ajout de 2 <b>justifications</b>" in driver.page_source)
|
self.wait.until(EC.url_changes(URL))
|
||||||
driver = self.driver
|
self.assertTrue("Ajout de 2 <b>justifications</b>" in driver.page_source)
|
||||||
driver.find_element_by_link_text("Liste").click()
|
driver = self.driver
|
||||||
self.assertTrue("2 absences justifiées:" in driver.page_source)
|
driver.find_element_by_link_text("Liste").click()
|
||||||
self.assertTrue("absences non justifiées:" in driver.page_source)
|
self.assertTrue("2 absences justifiées:" in driver.page_source)
|
||||||
|
self.assertTrue("absences non justifiées:" in driver.page_source)
|
||||||
# def test_modification_liste_ajout_justification(self):
|
|
||||||
# driver = self.driver
|
# def test_modification_liste_ajout_justification(self):
|
||||||
# driver.find_element_by_link_text("Liste").click()
|
# driver = self.driver
|
||||||
# self.assertTrue("4 absences justifiées:" in driver.page_source)
|
# driver.find_element_by_link_text("Liste").click()
|
||||||
# self.assertTrue("absences non justifiées:" not in driver.page_source)
|
# self.assertTrue("4 absences justifiées:" in driver.page_source)
|
||||||
|
# self.assertTrue("absences non justifiées:" not in driver.page_source)
|
||||||
# Test Suppression des absences pour un élève
|
|
||||||
# @expected : Les compteurs d'absences sont remplacés par "Pas d'absences"
|
# Test Suppression des absences pour un élève
|
||||||
def test_024_supprimer_absence(self):
|
# @expected : Les compteurs d'absences sont remplacés par "Pas d'absences"
|
||||||
driver = self.driver
|
def test_024_supprimer_absence(self):
|
||||||
global URL
|
driver = self.driver
|
||||||
driver.find_element_by_id("delete-absence").click()
|
global URL
|
||||||
driver.find_element_by_name("datedebut").send_keys(dateDebutAbsenceJustifiee)
|
driver.find_element_by_id("delete-absence").click()
|
||||||
driver.find_element_by_xpath("//input[@value='Supprimer les absences']").click()
|
driver.find_element_by_name("datedebut").send_keys(dateDebutAbsenceJustifiee)
|
||||||
self.wait.until(EC.url_changes(URL))
|
driver.find_element_by_xpath("//input[@value='Supprimer les absences']").click()
|
||||||
self.assertTrue("Annulation sur 2 demi-journées " in driver.page_source)
|
self.wait.until(EC.url_changes(URL))
|
||||||
driver.find_element_by_id("delete-absence").click()
|
self.assertTrue("Annulation sur 2 demi-journées " in driver.page_source)
|
||||||
driver.find_element_by_name("datedebut").send_keys(dateDebutAbsenceNonJustifiee)
|
driver.find_element_by_id("delete-absence").click()
|
||||||
driver.find_element_by_xpath("//input[@value='Supprimer les absences']").click()
|
driver.find_element_by_name("datedebut").send_keys(dateDebutAbsenceNonJustifiee)
|
||||||
self.wait.until(EC.url_changes(URL))
|
driver.find_element_by_xpath("//input[@value='Supprimer les absences']").click()
|
||||||
driver.find_element_by_id("display-list-absence").click()
|
self.wait.until(EC.url_changes(URL))
|
||||||
self.assertTrue("Pas d'absences justifiées" in driver.page_source)
|
driver.find_element_by_id("display-list-absence").click()
|
||||||
self.assertTrue("Pas d'absences non justifiées" in driver.page_source)
|
self.assertTrue("Pas d'absences justifiées" in driver.page_source)
|
||||||
|
self.assertTrue("Pas d'absences non justifiées" in driver.page_source)
|
||||||
# def test_modification_liste_supression_absence(self):
|
|
||||||
# driver = self.driver
|
# def test_modification_liste_supression_absence(self):
|
||||||
# driver.find_element_by_link_text("Liste").click()
|
# driver = self.driver
|
||||||
# self.assertTrue("2 absences justifiées:" in driver.page_source)
|
# driver.find_element_by_link_text("Liste").click()
|
||||||
# self.assertTrue("absences non justifiées:" not in driver.page_source)
|
# self.assertTrue("2 absences justifiées:" in driver.page_source)
|
||||||
|
# self.assertTrue("absences non justifiées:" not in driver.page_source)
|
||||||
# ferme la fenetre
|
|
||||||
def tearDown(self):
|
# ferme la fenetre
|
||||||
self.driver.close()
|
def tearDown(self):
|
||||||
|
self.driver.close()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
deleteDepartement.main()
|
if __name__ == "__main__":
|
||||||
createDepartement.main()
|
deleteDepartement.main()
|
||||||
creationSiteDepartement.main()
|
createDepartement.main()
|
||||||
cmdProcess = [
|
creationSiteDepartement.main()
|
||||||
"./scriptExecution.sh",
|
cmdProcess = [
|
||||||
LINK_SCODOC_SERVER,
|
"./scriptExecution.sh",
|
||||||
NOM_DPT,
|
LINK_SCODOC_SERVER,
|
||||||
"test_scenario2_formation.py",
|
NOM_DPT,
|
||||||
]
|
"test_scenario2_formation.py",
|
||||||
process = subprocess.Popen(cmdProcess)
|
]
|
||||||
process.wait()
|
process = subprocess.Popen(cmdProcess)
|
||||||
unittest.main(
|
process.wait()
|
||||||
testRunner=HtmlTestRunner.HTMLTestRunner(
|
unittest.main(
|
||||||
report_name="04_Absences_tests",
|
testRunner=HtmlTestRunner.HTMLTestRunner(
|
||||||
output="./ResultatTest",
|
report_name="04_Absences_tests",
|
||||||
combine_reports=True,
|
output="./ResultatTest",
|
||||||
)
|
combine_reports=True,
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
@ -1,403 +1,404 @@
|
|||||||
import unittest
|
import unittest
|
||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
import urllib.parse as urlparse
|
import urllib.parse as urlparse
|
||||||
import HtmlTestRunner
|
import HtmlTestRunner
|
||||||
import createDepartement
|
import createDepartement
|
||||||
import creationSiteDepartement
|
import creationSiteDepartement
|
||||||
import deleteDepartement
|
import deleteDepartement
|
||||||
from setting import (
|
from setting import (
|
||||||
SCODOC_ADMIN_ID,
|
SCODOC_ADMIN_ID,
|
||||||
SCODOC_ADMIN_PASS,
|
SCODOC_ADMIN_PASS,
|
||||||
SCHEMA,
|
SCHEMA,
|
||||||
BASE_URL,
|
SCODOC_SERVER,
|
||||||
NOM_DPT,
|
SCODOC_PORT,
|
||||||
SCODOC_ENS_ID,
|
NOM_DPT,
|
||||||
SCODOC_ENS_PASS,
|
SCODOC_ENS_ID,
|
||||||
SCODOC_CHEF_ID,
|
SCODOC_ENS_PASS,
|
||||||
SCODOC_CHEF_PASS,
|
SCODOC_CHEF_ID,
|
||||||
NAVIGATEUR,
|
SCODOC_CHEF_PASS,
|
||||||
LINK_SCODOC_SERVER,
|
NAVIGATEUR,
|
||||||
BASE_SSH_URL,
|
LINK_SCODOC_SERVER,
|
||||||
)
|
BASE_SSH_URL,
|
||||||
from urllib.parse import parse_qs
|
)
|
||||||
from selenium import webdriver
|
from urllib.parse import parse_qs
|
||||||
from selenium.webdriver.common.keys import Keys
|
from selenium import webdriver
|
||||||
from selenium.common.exceptions import NoSuchElementException
|
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 import expected_conditions as EC
|
||||||
from selenium.webdriver.support.select import Select
|
from selenium.webdriver.support.ui import Select, WebDriverWait
|
||||||
|
from selenium.webdriver.support.select import Select
|
||||||
URL_MATIERE = ""
|
|
||||||
URL_SEMESTRE = ""
|
URL_MATIERE = ""
|
||||||
URL = SCHEMA + "://" + BASE_URL + NOM_DPT + "/Scolarite"
|
URL_SEMESTRE = ""
|
||||||
PRENOM_ENS = "Ens"
|
URL = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + NOM_DPT + "/Scolarite"
|
||||||
PRENOM_CHEF = "Chef"
|
PRENOM_ENS = "Ens"
|
||||||
isAdmin = True
|
PRENOM_CHEF = "Chef"
|
||||||
isChef = False
|
isAdmin = True
|
||||||
isEns = False
|
isChef = False
|
||||||
# Prérequis
|
isEns = False
|
||||||
class PythonOrgSearch(unittest.TestCase):
|
# Prérequis
|
||||||
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
class PythonOrgSearch(unittest.TestCase):
|
||||||
def setUp(self):
|
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
||||||
next_page = ""
|
def setUp(self):
|
||||||
if NAVIGATEUR == "firefox":
|
next_page = ""
|
||||||
self.driver = webdriver.Firefox()
|
if NAVIGATEUR == "firefox":
|
||||||
else:
|
self.driver = webdriver.Firefox()
|
||||||
self.driver = webdriver.Chrome()
|
else:
|
||||||
self.wait = WebDriverWait(self.driver, 10)
|
self.driver = webdriver.Chrome()
|
||||||
auth_page = SCHEMA + "://" + BASE_SSH_URL + "auth/login?next=%2F" + next_page
|
self.wait = WebDriverWait(self.driver, 10)
|
||||||
self.driver.get(auth_page)
|
auth_page = SCHEMA + "://" + BASE_SSH_URL + "auth/login?next=%2F" + next_page
|
||||||
if isAdmin:
|
self.driver.get(auth_page)
|
||||||
self.driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
|
if isAdmin:
|
||||||
self.driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
|
self.driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
|
||||||
elif isChef:
|
self.driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
|
||||||
self.driver.find_element_by_id("user_name").send_keys(SCODOC_CHEF_ID)
|
elif isChef:
|
||||||
self.driver.find_element_by_id("password").send_keys(SCODOC_CHEF_PASS)
|
self.driver.find_element_by_id("user_name").send_keys(SCODOC_CHEF_ID)
|
||||||
elif isEns:
|
self.driver.find_element_by_id("password").send_keys(SCODOC_CHEF_PASS)
|
||||||
self.driver.find_element_by_id("user_name").send_keys(SCODOC_ENS_ID)
|
elif isEns:
|
||||||
self.driver.find_element_by_id("password").send_keys(SCODOC_ENS_PASS)
|
self.driver.find_element_by_id("user_name").send_keys(SCODOC_ENS_ID)
|
||||||
self.driver.find_element_by_id("submit").click()
|
self.driver.find_element_by_id("password").send_keys(SCODOC_ENS_PASS)
|
||||||
self.driver.get(SCHEMA + "://" + BASE_URL)
|
self.driver.find_element_by_id("submit").click()
|
||||||
|
self.driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT)
|
||||||
# Test : Vérifie s'il y a un semestre en cours
|
|
||||||
# @expected : La class listesems n'est pas vide et contient "Session en cours"
|
# Test : Vérifie s'il y a un semestre en cours
|
||||||
def test_010_semestre_en_cours(self):
|
# @expected : La class listesems n'est pas vide et contient "Session en cours"
|
||||||
driver = self.driver
|
def test_010_semestre_en_cours(self):
|
||||||
global URL
|
driver = self.driver
|
||||||
driver.get(URL)
|
global URL
|
||||||
# time.sleep(1)
|
driver.get(URL)
|
||||||
self.assertTrue(
|
# time.sleep(1)
|
||||||
"Sessions en cours" in driver.find_element_by_class_name("listesems").text
|
self.assertTrue(
|
||||||
)
|
"Sessions en cours" in driver.find_element_by_class_name("listesems").text
|
||||||
|
)
|
||||||
# Test : Vérifie si une matière existe
|
|
||||||
# @expected : Le nom de la matière est présent dans le semestre préalablement testé
|
# Test : Vérifie si une matière existe
|
||||||
def test_020_matiere_existante(self):
|
# @expected : Le nom de la matière est présent dans le semestre préalablement testé
|
||||||
driver = self.driver
|
def test_020_matiere_existante(self):
|
||||||
global URL
|
driver = self.driver
|
||||||
driver.get(URL)
|
global URL
|
||||||
driver.find_element_by_link_text("semestre 4").click()
|
driver.get(URL)
|
||||||
self.wait.until(EC.url_changes(URL))
|
driver.find_element_by_link_text("semestre 4").click()
|
||||||
matiereExist = False
|
self.wait.until(EC.url_changes(URL))
|
||||||
try:
|
matiereExist = False
|
||||||
driver.find_element_by_class_name("formsemestre_status_ue")
|
try:
|
||||||
global URL_SEMESTRE
|
driver.find_element_by_class_name("formsemestre_status_ue")
|
||||||
URL_SEMESTRE = driver.current_url
|
global URL_SEMESTRE
|
||||||
matiereExist = True
|
URL_SEMESTRE = driver.current_url
|
||||||
except NoSuchElementException:
|
matiereExist = True
|
||||||
matiereExist = False
|
except NoSuchElementException:
|
||||||
self.assertTrue(matiereExist)
|
matiereExist = False
|
||||||
|
self.assertTrue(matiereExist)
|
||||||
#Test : Changement de responsable sur module
|
|
||||||
# @expected : Le nom du responsable choisi apparait désormais sur le module concerné
|
#Test : Changement de responsable sur module
|
||||||
def test_030_changement_responsable_sur_module(self):
|
# @expected : Le nom du responsable choisi apparait désormais sur le module concerné
|
||||||
driver = self.driver
|
def test_030_changement_responsable_sur_module(self):
|
||||||
isThere = False
|
driver = self.driver
|
||||||
driver.get(URL_SEMESTRE)
|
isThere = False
|
||||||
driver.find_element_by_link_text("M4101C").click()
|
driver.get(URL_SEMESTRE)
|
||||||
time.sleep(1)
|
driver.find_element_by_link_text("M4101C").click()
|
||||||
global URL_MATIERE
|
time.sleep(1)
|
||||||
URL_MATIERE = driver.current_url
|
global URL_MATIERE
|
||||||
driver.find_element_by_xpath(
|
URL_MATIERE = driver.current_url
|
||||||
"//a[contains(@href,'edit_moduleimpl_resp?')]"
|
driver.find_element_by_xpath(
|
||||||
).click()
|
"//a[contains(@href,'edit_moduleimpl_resp?')]"
|
||||||
self.wait.until(EC.url_changes(URL_MATIERE))
|
).click()
|
||||||
constructIdResponsable = (
|
self.wait.until(EC.url_changes(URL_MATIERE))
|
||||||
SCODOC_CHEF_ID.upper()
|
constructIdResponsable = (
|
||||||
+ " "
|
SCODOC_CHEF_ID.upper()
|
||||||
+ PRENOM_CHEF
|
+ " "
|
||||||
+ " ("
|
+ PRENOM_CHEF
|
||||||
+ SCODOC_CHEF_ID.lower()
|
+ " ("
|
||||||
+ ")"
|
+ SCODOC_CHEF_ID.lower()
|
||||||
)
|
+ ")"
|
||||||
idInput = driver.find_element_by_name("responsable_id")
|
)
|
||||||
idInput.clear()
|
idInput = driver.find_element_by_name("responsable_id")
|
||||||
idInput.send_keys(constructIdResponsable)
|
idInput.clear()
|
||||||
driver.find_element_by_id("tf_submit").click()
|
idInput.send_keys(constructIdResponsable)
|
||||||
time.sleep(1)
|
driver.find_element_by_id("tf_submit").click()
|
||||||
driver.get(URL_MATIERE)
|
time.sleep(1)
|
||||||
nomResponsable = driver.find_element_by_id("ens-responsable")
|
driver.get(URL_MATIERE)
|
||||||
self.assertTrue(SCODOC_CHEF_ID.lower() in nomResponsable.text.lower())
|
nomResponsable = driver.find_element_by_id("ens-responsable")
|
||||||
global isAdmin
|
self.assertTrue(SCODOC_CHEF_ID.lower() in nomResponsable.text.lower())
|
||||||
isAdmin = False
|
global isAdmin
|
||||||
global isChef
|
isAdmin = False
|
||||||
isChef = True
|
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
|
# Test : Ajout d'un enseignant comme résponsable d'un module
|
||||||
def test_031_ajout_enseignant_sur_module(self):
|
# @expected : Le nom de l'enseignant apparait désormais sur la page d'information du module
|
||||||
driver = self.driver
|
def test_031_ajout_enseignant_sur_module(self):
|
||||||
global URL_MATIERE
|
driver = self.driver
|
||||||
driver.get(URL_MATIERE)
|
global URL_MATIERE
|
||||||
time.sleep(2)
|
driver.get(URL_MATIERE)
|
||||||
driver.find_element_by_partial_link_text("modifier les enseignants").click()
|
time.sleep(2)
|
||||||
time.sleep(1)
|
driver.find_element_by_partial_link_text("modifier les enseignants").click()
|
||||||
constructIDEns = (
|
time.sleep(1)
|
||||||
SCODOC_ENS_ID.upper() + " " + PRENOM_ENS + " (" + SCODOC_ENS_ID + ")"
|
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()
|
driver.find_element_by_id("ens_id").send_keys(constructIDEns)
|
||||||
time.sleep(1)
|
driver.find_element_by_id("tf_submit").click()
|
||||||
driver.get(URL_MATIERE)
|
time.sleep(1)
|
||||||
professeurDansModule = driver.find_elements_by_class_name("ens-in-module")
|
driver.get(URL_MATIERE)
|
||||||
time.sleep(5)
|
professeurDansModule = driver.find_elements_by_class_name("ens-in-module")
|
||||||
professeurString = []
|
time.sleep(5)
|
||||||
for professeur in professeurDansModule:
|
professeurString = []
|
||||||
professeurString.append(professeur.text)
|
for professeur in professeurDansModule:
|
||||||
for professeurS in professeurString:
|
professeurString.append(professeur.text)
|
||||||
if SCODOC_ENS_ID.lower() in professeurS.lower():
|
for professeurS in professeurString:
|
||||||
isThere = True
|
if SCODOC_ENS_ID.lower() in professeurS.lower():
|
||||||
self.assertTrue(isThere)
|
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
|
# Test : Création d'une interrogation en tant que chef des études
|
||||||
def test_040_creation_interrogation(self):
|
# @eexpected : L'interrogation apparait désormais dans ce module
|
||||||
descriptionInterrogation = "Interrogation numero 2"
|
def test_040_creation_interrogation(self):
|
||||||
driver = self.driver
|
descriptionInterrogation = "Interrogation numero 2"
|
||||||
global URL_MATIERE
|
driver = self.driver
|
||||||
driver.get(
|
global URL_MATIERE
|
||||||
SCHEMA
|
driver.get(
|
||||||
+ "://"
|
SCHEMA
|
||||||
+ SCODOC_ADMIN_ID
|
+ "://"
|
||||||
+ ":"
|
+ SCODOC_ADMIN_ID
|
||||||
+ SCODOC_ADMIN_PASS
|
+ ":"
|
||||||
+ "@"
|
+ SCODOC_ADMIN_PASS
|
||||||
+ BASE_SSH_URL
|
+ "@"
|
||||||
+ "force_admin_authentication"
|
+ BASE_SSH_URL
|
||||||
)
|
+ "force_admin_authentication"
|
||||||
# driver.get(SCHEMA + "://" + BASE_URL)
|
)
|
||||||
# driver.find_element_by_link_text("déconnecter").click()
|
# driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT)
|
||||||
# driver.get(SCHEMA + "://" + BASE_URL)
|
# driver.find_element_by_link_text("déconnecter").click()
|
||||||
# driver.find_element_by_id("name").send_keys(SCODOC_CHEF_ID)
|
# driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT)
|
||||||
# driver.find_element_by_id("password").send_keys(SCODOC_CHEF_PASS)
|
# driver.find_element_by_id("name").send_keys(SCODOC_CHEF_ID)
|
||||||
# driver.find_element_by_id("submit").click()
|
# driver.find_element_by_id("password").send_keys(SCODOC_CHEF_PASS)
|
||||||
driver.get(URL_MATIERE)
|
# driver.find_element_by_id("submit").click()
|
||||||
time.sleep(1)
|
driver.get(URL_MATIERE)
|
||||||
driver.find_element_by_link_text("Créer nouvelle évaluation").click()
|
time.sleep(1)
|
||||||
time.sleep(1)
|
driver.find_element_by_link_text("Créer nouvelle évaluation").click()
|
||||||
driver.find_element_by_name("jour").clear()
|
time.sleep(1)
|
||||||
driver.find_element_by_name("jour").send_keys("31/05/2021")
|
driver.find_element_by_name("jour").clear()
|
||||||
driver.find_element_by_id("tf_description").send_keys(descriptionInterrogation)
|
driver.find_element_by_name("jour").send_keys("31/05/2021")
|
||||||
driver.find_element_by_id("tf_coefficient").send_keys("2")
|
driver.find_element_by_id("tf_description").send_keys(descriptionInterrogation)
|
||||||
driver.find_element_by_id("tf_submit").click()
|
driver.find_element_by_id("tf_coefficient").send_keys("2")
|
||||||
time.sleep(1)
|
driver.find_element_by_id("tf_submit").click()
|
||||||
global isChef
|
time.sleep(1)
|
||||||
isChef = False
|
global isChef
|
||||||
global isEns
|
isChef = False
|
||||||
isEns = True
|
global isEns
|
||||||
self.assertTrue(descriptionInterrogation in driver.page_source)
|
isEns = True
|
||||||
|
self.assertTrue(descriptionInterrogation in driver.page_source)
|
||||||
# Test Vérifie si une interrogation existe sur un module
|
|
||||||
# @expected "Module" est présent dans le "formsemetre"
|
# Test Vérifie si une interrogation existe sur un module
|
||||||
def test_050_interro_existante(self):
|
# @expected "Module" est présent dans le "formsemetre"
|
||||||
driver = self.driver
|
def test_050_interro_existante(self):
|
||||||
global URL_MATIERE
|
driver = self.driver
|
||||||
driver.get(URL_MATIERE)
|
global URL_MATIERE
|
||||||
time.sleep(1)
|
driver.get(URL_MATIERE)
|
||||||
self.assertTrue(
|
time.sleep(1)
|
||||||
"Module" in driver.find_element_by_class_name("formsemestre").text
|
self.assertTrue(
|
||||||
)
|
"Module" in driver.find_element_by_class_name("formsemestre").text
|
||||||
|
)
|
||||||
# Test Entree des notes pour le premier étudiant inscrit à un module
|
|
||||||
# @expected : "saisir note" est remplacé par "afficher" sur la page d'information de l'interrogation concernée
|
# Test Entree des notes pour le premier étudiant inscrit à un module
|
||||||
def test_060_entree_note(self):
|
# @expected : "saisir note" est remplacé par "afficher" sur la page d'information de l'interrogation concernée
|
||||||
driver = self.driver
|
def test_060_entree_note(self):
|
||||||
global URL_MATIERE
|
driver = self.driver
|
||||||
driver.get(URL_MATIERE)
|
global URL_MATIERE
|
||||||
driver.find_element_by_class_name("notes_img").click()
|
driver.get(URL_MATIERE)
|
||||||
time.sleep(1)
|
driver.find_element_by_class_name("notes_img").click()
|
||||||
element = driver.find_element_by_class_name("note")
|
time.sleep(1)
|
||||||
element.send_keys("12")
|
element = driver.find_element_by_class_name("note")
|
||||||
driver.find_element_by_id("formnotes_submit").click()
|
element.send_keys("12")
|
||||||
# self.wait.until(EC.url_changes(url))
|
driver.find_element_by_id("formnotes_submit").click()
|
||||||
self.assertTrue(
|
# self.wait.until(EC.url_changes(url))
|
||||||
driver.find_element_by_link_text("afficher").text in driver.page_source
|
self.assertTrue(
|
||||||
)
|
driver.find_element_by_link_text("afficher").text in driver.page_source
|
||||||
|
)
|
||||||
# Test : Ajoute les notes manquante poru les étudiants concernés dans une interrogation
|
|
||||||
# @expected : Tout les étudiants on une note
|
# Test : Ajoute les notes manquante poru les étudiants concernés dans une interrogation
|
||||||
def test_070_ajout_note_incomplete(self):
|
# @expected : Tout les étudiants on une note
|
||||||
driver = self.driver
|
def test_070_ajout_note_incomplete(self):
|
||||||
global URL_MATIERE
|
driver = self.driver
|
||||||
driver.get(URL_MATIERE)
|
global URL_MATIERE
|
||||||
time.sleep(1)
|
driver.get(URL_MATIERE)
|
||||||
driver.find_element_by_class_name("notes_img").click()
|
time.sleep(1)
|
||||||
elements = driver.find_elements_by_class_name("note")
|
driver.find_element_by_class_name("notes_img").click()
|
||||||
for element in elements:
|
elements = driver.find_elements_by_class_name("note")
|
||||||
if element.get_attribute("value") == "":
|
for element in elements:
|
||||||
element.send_keys(15)
|
if element.get_attribute("value") == "":
|
||||||
driver.find_element_by_id("formnotes_submit").click()
|
element.send_keys(15)
|
||||||
time.sleep(5)
|
driver.find_element_by_id("formnotes_submit").click()
|
||||||
element = driver.find_element_by_id("in-expnom")
|
time.sleep(5)
|
||||||
element.send_keys("SEMESTRE47")
|
element = driver.find_element_by_id("in-expnom")
|
||||||
element.submit()
|
element.send_keys("SEMESTRE47")
|
||||||
time.sleep(5)
|
element.submit()
|
||||||
self.assertTrue("12" in driver.find_element_by_class_name("rcp_moy").text)
|
time.sleep(5)
|
||||||
|
self.assertTrue("12" in driver.find_element_by_class_name("rcp_moy").text)
|
||||||
# Test : Suppresion des notes pour tout les étudiants concernés dans une interrogation
|
|
||||||
# @expected : La moyenne ne s'affiche plus, "afficher" disparait de la page d'information de l'interrogation
|
# Test : Suppresion des notes pour tout les étudiants concernés dans une interrogation
|
||||||
def test_080_suppression_note(self):
|
# @expected : La moyenne ne s'affiche plus, "afficher" disparait de la page d'information de l'interrogation
|
||||||
driver = self.driver
|
def test_080_suppression_note(self):
|
||||||
global URL_MATIERE
|
driver = self.driver
|
||||||
driver.get(URL_MATIERE)
|
global URL_MATIERE
|
||||||
time.sleep(1)
|
driver.get(URL_MATIERE)
|
||||||
driver.find_element_by_class_name("notes_img").click()
|
time.sleep(1)
|
||||||
time.sleep(1)
|
driver.find_element_by_class_name("notes_img").click()
|
||||||
elements = driver.find_elements_by_class_name("note")
|
time.sleep(1)
|
||||||
for element in elements:
|
elements = driver.find_elements_by_class_name("note")
|
||||||
element.clear()
|
for element in elements:
|
||||||
element.send_keys("SUPR")
|
element.clear()
|
||||||
driver.find_element_by_id("formnotes_submit").click()
|
element.send_keys("SUPR")
|
||||||
time.sleep(1)
|
driver.find_element_by_id("formnotes_submit").click()
|
||||||
interro_non_Presente = False
|
time.sleep(1)
|
||||||
try:
|
interro_non_Presente = False
|
||||||
driver.find_element_by_link_text("afficher")
|
try:
|
||||||
interro_non_Presente = False
|
driver.find_element_by_link_text("afficher")
|
||||||
except NoSuchElementException:
|
interro_non_Presente = False
|
||||||
interro_non_Presente = True
|
except NoSuchElementException:
|
||||||
self.assertTrue(interro_non_Presente)
|
interro_non_Presente = True
|
||||||
global isChef
|
self.assertTrue(interro_non_Presente)
|
||||||
isChef = True
|
global isChef
|
||||||
global isEns
|
isChef = True
|
||||||
isEns = False
|
global isEns
|
||||||
|
isEns = False
|
||||||
# Test : SUppression d'une interrogation par le chef des études
|
|
||||||
# @expected : L'interrogation n'apparait plus sur le module, les notes sont supprimées également
|
# Test : SUppression d'une interrogation par le chef des études
|
||||||
def test_090_suppresion_interrogation(self):
|
# @expected : L'interrogation n'apparait plus sur le module, les notes sont supprimées également
|
||||||
global URL_MATIERE
|
def test_090_suppresion_interrogation(self):
|
||||||
descriptionInterrogation = "Interrogation à supprimer"
|
global URL_MATIERE
|
||||||
driver = self.driver
|
descriptionInterrogation = "Interrogation à supprimer"
|
||||||
driver.get(URL_MATIERE)
|
driver = self.driver
|
||||||
time.sleep(1)
|
driver.get(URL_MATIERE)
|
||||||
driver.find_element_by_link_text("Créer nouvelle évaluation").click()
|
time.sleep(1)
|
||||||
time.sleep(1)
|
driver.find_element_by_link_text("Créer nouvelle évaluation").click()
|
||||||
driver.find_element_by_name("jour").clear()
|
time.sleep(1)
|
||||||
driver.find_element_by_name("jour").send_keys("30/05/2021")
|
driver.find_element_by_name("jour").clear()
|
||||||
driver.find_element_by_id("tf_description").send_keys(descriptionInterrogation)
|
driver.find_element_by_name("jour").send_keys("30/05/2021")
|
||||||
driver.find_element_by_id("tf_coefficient").send_keys("2")
|
driver.find_element_by_id("tf_description").send_keys(descriptionInterrogation)
|
||||||
driver.find_element_by_id("tf_submit").click()
|
driver.find_element_by_id("tf_coefficient").send_keys("2")
|
||||||
time.sleep(1)
|
driver.find_element_by_id("tf_submit").click()
|
||||||
self.assertTrue(descriptionInterrogation in driver.page_source)
|
time.sleep(1)
|
||||||
driver.find_element_by_class_name("delete_img").click()
|
self.assertTrue(descriptionInterrogation in driver.page_source)
|
||||||
time.sleep(1)
|
driver.find_element_by_class_name("delete_img").click()
|
||||||
driver.find_element_by_id("tf_submit").click()
|
time.sleep(1)
|
||||||
# global isAdmin
|
driver.find_element_by_id("tf_submit").click()
|
||||||
# isAdmin = True
|
# global isAdmin
|
||||||
# global isEns
|
# isAdmin = True
|
||||||
# isEns = False
|
# global isEns
|
||||||
self.assertFalse(descriptionInterrogation in driver.page_source)
|
# isEns = False
|
||||||
|
self.assertFalse(descriptionInterrogation in driver.page_source)
|
||||||
# Test : Suppression d'un enseignant responsable d'un module
|
|
||||||
# @expected : L'enseignant n'apparait plus comme responsable dans ce module
|
# Test : Suppression d'un enseignant responsable d'un module
|
||||||
def test_200_suppression_enseignant_sur_module(self):
|
# @expected : L'enseignant n'apparait plus comme responsable dans ce module
|
||||||
driver = self.driver
|
def test_200_suppression_enseignant_sur_module(self):
|
||||||
driver.get(URL_MATIERE)
|
driver = self.driver
|
||||||
time.sleep(1)
|
driver.get(URL_MATIERE)
|
||||||
driver.find_element_by_partial_link_text("modifier les enseignants").click()
|
time.sleep(1)
|
||||||
time.sleep(1)
|
driver.find_element_by_partial_link_text("modifier les enseignants").click()
|
||||||
elements = driver.find_elements_by_link_text("supprimer")
|
time.sleep(1)
|
||||||
for element in elements:
|
elements = driver.find_elements_by_link_text("supprimer")
|
||||||
element.click()
|
for element in elements:
|
||||||
time.sleep(1)
|
element.click()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
driver.get(URL_MATIERE)
|
time.sleep(1)
|
||||||
time.sleep(5)
|
driver.get(URL_MATIERE)
|
||||||
self.assertTrue(SCODOC_ENS_ID not in driver.page_source)
|
time.sleep(5)
|
||||||
|
self.assertTrue(SCODOC_ENS_ID not in driver.page_source)
|
||||||
# Test : Suppresion du reste des interrogations sans notes
|
|
||||||
# @expected Tout les interrogation sans notes sont supprimées
|
# Test : Suppresion du reste des interrogations sans notes
|
||||||
def test_910_suppresion_interrogation_restante(self):
|
# @expected Tout les interrogation sans notes sont supprimées
|
||||||
driver = self.driver
|
def test_910_suppresion_interrogation_restante(self):
|
||||||
driver.get(URL_MATIERE)
|
driver = self.driver
|
||||||
time.sleep(1)
|
driver.get(URL_MATIERE)
|
||||||
elements = driver.find_elements_by_xpath(
|
time.sleep(1)
|
||||||
"//a[contains(@href,'evaluation_delete?')]"
|
elements = driver.find_elements_by_xpath(
|
||||||
)
|
"//a[contains(@href,'evaluation_delete?')]"
|
||||||
while elements:
|
)
|
||||||
elements[0].click()
|
while elements:
|
||||||
driver.find_element_by_id("tf_submit").click()
|
elements[0].click()
|
||||||
self.wait.until(EC.url_changes(URL))
|
driver.find_element_by_id("tf_submit").click()
|
||||||
driver.find_element_by_partial_link_text("Continuer").click()
|
self.wait.until(EC.url_changes(URL))
|
||||||
self.wait.until(EC.url_changes(URL))
|
driver.find_element_by_partial_link_text("Continuer").click()
|
||||||
elements = driver.find_elements_by_xpath(
|
self.wait.until(EC.url_changes(URL))
|
||||||
"//a[contains(@href,'evaluation_delete?')]"
|
elements = driver.find_elements_by_xpath(
|
||||||
)
|
"//a[contains(@href,'evaluation_delete?')]"
|
||||||
|
)
|
||||||
# ferme la fenetre et fais du clean up
|
|
||||||
def tearDown(self):
|
# ferme la fenetre et fais du clean up
|
||||||
self.driver.close()
|
def tearDown(self):
|
||||||
|
self.driver.close()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
if NAVIGATEUR == "firefox":
|
if __name__ == "__main__":
|
||||||
driver = webdriver.Firefox()
|
if NAVIGATEUR == "firefox":
|
||||||
else:
|
driver = webdriver.Firefox()
|
||||||
driver = webdriver.Chrome()
|
else:
|
||||||
deleteDepartement.main()
|
driver = webdriver.Chrome()
|
||||||
createDepartement.main()
|
deleteDepartement.main()
|
||||||
creationSiteDepartement.main()
|
createDepartement.main()
|
||||||
cmdProcess = [
|
creationSiteDepartement.main()
|
||||||
"./scriptExecution.sh",
|
cmdProcess = [
|
||||||
LINK_SCODOC_SERVER,
|
"./scriptExecution.sh",
|
||||||
NOM_DPT,
|
LINK_SCODOC_SERVER,
|
||||||
"test_scenario2_formation.py",
|
NOM_DPT,
|
||||||
]
|
"test_scenario2_formation.py",
|
||||||
process = subprocess.Popen(cmdProcess)
|
]
|
||||||
process.wait()
|
process = subprocess.Popen(cmdProcess)
|
||||||
time.sleep(5)
|
process.wait()
|
||||||
driver.get(
|
time.sleep(5)
|
||||||
SCHEMA
|
driver.get(
|
||||||
+ "://"
|
SCHEMA
|
||||||
+ SCODOC_ADMIN_ID
|
+ "://"
|
||||||
+ ":"
|
+ SCODOC_ADMIN_ID
|
||||||
+ SCODOC_ADMIN_PASS
|
+ ":"
|
||||||
+ "@"
|
+ SCODOC_ADMIN_PASS
|
||||||
+ BASE_SSH_URL
|
+ "@"
|
||||||
+ "force_admin_authentication"
|
+ BASE_SSH_URL
|
||||||
)
|
+ "force_admin_authentication"
|
||||||
driver.get(SCHEMA + "://" + BASE_URL + NOM_DPT + "/Scolarite")
|
)
|
||||||
driver.find_element_by_id("link-view-users").click()
|
driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + NOM_DPT + "/Scolarite")
|
||||||
time.sleep(5)
|
driver.find_element_by_id("link-view-users").click()
|
||||||
noms = driver.find_elements_by_class_name("nom_fmt")
|
time.sleep(5)
|
||||||
chefCree = False
|
noms = driver.find_elements_by_class_name("nom_fmt")
|
||||||
ensCree = False
|
chefCree = False
|
||||||
for nom in noms:
|
ensCree = False
|
||||||
if nom.text.lower() == SCODOC_CHEF_ID.lower():
|
for nom in noms:
|
||||||
chefCree = True
|
if nom.text.lower() == SCODOC_CHEF_ID.lower():
|
||||||
if nom.text.lower() == SCODOC_ENS_ID.lower():
|
chefCree = True
|
||||||
ensCree = True
|
if nom.text.lower() == SCODOC_ENS_ID.lower():
|
||||||
if not chefCree:
|
ensCree = True
|
||||||
time.sleep(2)
|
if not chefCree:
|
||||||
constructValue = "Ens" + NOM_DPT
|
time.sleep(2)
|
||||||
driver.find_element_by_id("create-user").click()
|
constructValue = "Ens" + NOM_DPT
|
||||||
driver.find_element_by_id("tf_nom").send_keys(SCODOC_CHEF_ID)
|
driver.find_element_by_id("create-user").click()
|
||||||
driver.find_element_by_id("tf_user_name").send_keys(SCODOC_CHEF_ID)
|
driver.find_element_by_id("tf_nom").send_keys(SCODOC_CHEF_ID)
|
||||||
driver.find_element_by_id("tf_prenom").send_keys("chef")
|
driver.find_element_by_id("tf_user_name").send_keys(SCODOC_CHEF_ID)
|
||||||
driver.find_element_by_id("tf_passwd").send_keys(SCODOC_CHEF_PASS)
|
driver.find_element_by_id("tf_prenom").send_keys("chef")
|
||||||
driver.find_element_by_id("tf_passwd2").send_keys(SCODOC_CHEF_PASS)
|
driver.find_element_by_id("tf_passwd").send_keys(SCODOC_CHEF_PASS)
|
||||||
driver.find_element_by_xpath("//input[@value='" + constructValue + "']").click()
|
driver.find_element_by_id("tf_passwd2").send_keys(SCODOC_CHEF_PASS)
|
||||||
driver.find_element_by_xpath("//input[@name='force:list']").click()
|
driver.find_element_by_xpath("//input[@value='" + constructValue + "']").click()
|
||||||
driver.find_element_by_id("tf_submit").click()
|
driver.find_element_by_xpath("//input[@name='force:list']").click()
|
||||||
driver.find_element_by_id("link-view-users").click()
|
driver.find_element_by_id("tf_submit").click()
|
||||||
if not ensCree:
|
driver.find_element_by_id("link-view-users").click()
|
||||||
time.sleep(2)
|
if not ensCree:
|
||||||
constructValue = "Ens" + NOM_DPT
|
time.sleep(2)
|
||||||
driver.find_element_by_id("create-user").click()
|
constructValue = "Ens" + NOM_DPT
|
||||||
driver.find_element_by_id("tf_nom").send_keys(SCODOC_ENS_ID)
|
driver.find_element_by_id("create-user").click()
|
||||||
driver.find_element_by_id("tf_user_name").send_keys(SCODOC_ENS_ID)
|
driver.find_element_by_id("tf_nom").send_keys(SCODOC_ENS_ID)
|
||||||
driver.find_element_by_id("tf_prenom").send_keys(PRENOM_ENS)
|
driver.find_element_by_id("tf_user_name").send_keys(SCODOC_ENS_ID)
|
||||||
driver.find_element_by_id("tf_passwd").send_keys(SCODOC_ENS_PASS)
|
driver.find_element_by_id("tf_prenom").send_keys(PRENOM_ENS)
|
||||||
driver.find_element_by_id("tf_passwd2").send_keys(SCODOC_ENS_PASS)
|
driver.find_element_by_id("tf_passwd").send_keys(SCODOC_ENS_PASS)
|
||||||
driver.find_element_by_xpath("//input[@value='" + constructValue + "']").click()
|
driver.find_element_by_id("tf_passwd2").send_keys(SCODOC_ENS_PASS)
|
||||||
driver.find_element_by_xpath("//input[@name='force:list']").click()
|
driver.find_element_by_xpath("//input[@value='" + constructValue + "']").click()
|
||||||
driver.find_element_by_id("tf_submit").click()
|
driver.find_element_by_xpath("//input[@name='force:list']").click()
|
||||||
driver.find_element_by_id("link-view-users").click()
|
driver.find_element_by_id("tf_submit").click()
|
||||||
driver.close()
|
driver.find_element_by_id("link-view-users").click()
|
||||||
unittest.main(
|
driver.close()
|
||||||
testRunner=HtmlTestRunner.HTMLTestRunner(
|
unittest.main(
|
||||||
report_name="05_Saisie_note_tests",
|
testRunner=HtmlTestRunner.HTMLTestRunner(
|
||||||
output="./ResultatTest",
|
report_name="05_Saisie_note_tests",
|
||||||
combine_reports=True,
|
output="./ResultatTest",
|
||||||
)
|
combine_reports=True,
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
@ -1,456 +1,457 @@
|
|||||||
import unittest
|
import unittest
|
||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
import urllib.parse as urlparse
|
import urllib.parse as urlparse
|
||||||
import HtmlTestRunner
|
import HtmlTestRunner
|
||||||
import createDepartement
|
import createDepartement
|
||||||
import creationSiteDepartement
|
import creationSiteDepartement
|
||||||
import deleteDepartement
|
import deleteDepartement
|
||||||
from setting import (
|
from setting import (
|
||||||
SCODOC_ADMIN_ID,
|
SCODOC_ADMIN_ID,
|
||||||
SCODOC_ADMIN_PASS,
|
SCODOC_ADMIN_PASS,
|
||||||
SCHEMA,
|
SCHEMA,
|
||||||
BASE_URL,
|
SCODOC_SERVER,
|
||||||
BASE_SSH_URL,
|
SCODOC_PORT,
|
||||||
LINK_SCODOC_SERVER,
|
BASE_SSH_URL,
|
||||||
NOM_DPT,
|
LINK_SCODOC_SERVER,
|
||||||
SCODOC_ENS_ID,
|
NOM_DPT,
|
||||||
SCODOC_ENS_PASS,
|
SCODOC_ENS_ID,
|
||||||
SCODOC_CHEF_ID,
|
SCODOC_ENS_PASS,
|
||||||
SCODOC_CHEF_PASS,
|
SCODOC_CHEF_ID,
|
||||||
NAVIGATEUR,
|
SCODOC_CHEF_PASS,
|
||||||
)
|
NAVIGATEUR,
|
||||||
from urllib.parse import parse_qs
|
)
|
||||||
from selenium import webdriver
|
from urllib.parse import parse_qs
|
||||||
from selenium.webdriver.common.keys import Keys
|
from selenium import webdriver
|
||||||
from selenium.common.exceptions import NoSuchElementException
|
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 import expected_conditions as EC
|
||||||
from selenium.webdriver.support.select import Select
|
from selenium.webdriver.support.ui import Select, WebDriverWait
|
||||||
|
from selenium.webdriver.support.select import Select
|
||||||
urlMatiere = ""
|
|
||||||
listeEtudiant = []
|
urlMatiere = ""
|
||||||
global MOY_UE1
|
listeEtudiant = []
|
||||||
global MOY_UE2
|
global MOY_UE1
|
||||||
global URL_SEMESTRE
|
global MOY_UE2
|
||||||
global COEFFUE1
|
global URL_SEMESTRE
|
||||||
global COEFFUE2
|
global COEFFUE1
|
||||||
|
global COEFFUE2
|
||||||
|
|
||||||
class PythonOrgSearch(unittest.TestCase):
|
|
||||||
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
class PythonOrgSearch(unittest.TestCase):
|
||||||
def setUp(self):
|
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
||||||
if NAVIGATEUR == "firefox":
|
def setUp(self):
|
||||||
self.driver = webdriver.Firefox()
|
if NAVIGATEUR == "firefox":
|
||||||
elif NAVIGATEUR == "chrome":
|
self.driver = webdriver.Firefox()
|
||||||
self.driver = webdriver.Chrome()
|
elif NAVIGATEUR == "chrome":
|
||||||
self.url = SCHEMA + "://" + BASE_URL + NOM_DPT + "/Scolarite"
|
self.driver = webdriver.Chrome()
|
||||||
self.wait = WebDriverWait(self.driver, 10)
|
self.url = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + NOM_DPT + "/Scolarite"
|
||||||
self.driver.get(
|
self.wait = WebDriverWait(self.driver, 10)
|
||||||
SCHEMA
|
self.driver.get(
|
||||||
+ "://"
|
SCHEMA
|
||||||
+ SCODOC_ADMIN_ID
|
+ "://"
|
||||||
+ ":"
|
+ SCODOC_ADMIN_ID
|
||||||
+ SCODOC_ADMIN_PASS
|
+ ":"
|
||||||
+ "@"
|
+ SCODOC_ADMIN_PASS
|
||||||
+ BASE_SSH_URL
|
+ "@"
|
||||||
+ "force_admin_authentication"
|
+ BASE_SSH_URL
|
||||||
)
|
+ "force_admin_authentication"
|
||||||
|
)
|
||||||
# Test: Ajout de note pour deux élèves dans une seule UE et vérifie si la moyenne de cet UE sur la fiche étudiante correspondant à la valeur rentrée
|
|
||||||
# @expected : La note rentrée et la moyenne sont identiques
|
# Test: Ajout de note pour deux élèves dans une seule UE et vérifie si la moyenne de cet UE sur la fiche étudiante correspondant à la valeur rentrée
|
||||||
def test_010_ajout_note_multiple_pour_une_ue(self):
|
# @expected : La note rentrée et la moyenne sont identiques
|
||||||
global listeEtudiant
|
def test_010_ajout_note_multiple_pour_une_ue(self):
|
||||||
global MOY_UE1
|
global listeEtudiant
|
||||||
global URL_SEMESTRE
|
global MOY_UE1
|
||||||
driver = self.driver
|
global URL_SEMESTRE
|
||||||
url = self.url
|
driver = self.driver
|
||||||
driver.get(url)
|
url = self.url
|
||||||
linkAddNote = "formnotes_note_"
|
driver.get(url)
|
||||||
driver.find_element_by_link_text("semestre 1").click()
|
linkAddNote = "formnotes_note_"
|
||||||
self.wait.until(EC.url_changes(url))
|
driver.find_element_by_link_text("semestre 1").click()
|
||||||
URL_SEMESTRE = driver.current_url
|
self.wait.until(EC.url_changes(url))
|
||||||
ue_name = driver.find_elements_by_class_name("status_ue_acro")[0].text
|
URL_SEMESTRE = driver.current_url
|
||||||
driver.find_element_by_link_text("M1101").click()
|
ue_name = driver.find_elements_by_class_name("status_ue_acro")[0].text
|
||||||
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
driver.find_element_by_link_text("M1101").click()
|
||||||
driver.find_element_by_xpath("//a[contains(@href,'saisie_notes?')]").click()
|
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
||||||
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
driver.find_element_by_xpath("//a[contains(@href,'saisie_notes?')]").click()
|
||||||
URL = driver.current_url
|
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
||||||
for champs in driver.find_elements_by_xpath(
|
URL = driver.current_url
|
||||||
"//input[contains(@id,'" + linkAddNote + "')]"
|
for champs in driver.find_elements_by_xpath(
|
||||||
):
|
"//input[contains(@id,'" + linkAddNote + "')]"
|
||||||
champs.clear()
|
):
|
||||||
champs.send_keys(12)
|
champs.clear()
|
||||||
idChamp = champs.get_attribute("id")
|
champs.send_keys(12)
|
||||||
idEtud = idChamp[len(linkAddNote) : len(idChamp)]
|
idChamp = champs.get_attribute("id")
|
||||||
if idEtud not in listeEtudiant:
|
idEtud = idChamp[len(linkAddNote) : len(idChamp)]
|
||||||
listeEtudiant.append(idEtud)
|
if idEtud not in listeEtudiant:
|
||||||
driver.find_element_by_id("formnotes_submit").click()
|
listeEtudiant.append(idEtud)
|
||||||
self.wait.until(EC.url_changes(URL))
|
driver.find_element_by_id("formnotes_submit").click()
|
||||||
driver.get(URL_SEMESTRE)
|
self.wait.until(EC.url_changes(URL))
|
||||||
noteBonne = True
|
driver.get(URL_SEMESTRE)
|
||||||
# print(listeEtudiant)
|
noteBonne = True
|
||||||
for etudiant in listeEtudiant:
|
# print(listeEtudiant)
|
||||||
searchBar = driver.find_element_by_id("in-expnom")
|
for etudiant in listeEtudiant:
|
||||||
searchBar.send_keys(etudiant)
|
searchBar = driver.find_element_by_id("in-expnom")
|
||||||
searchBar.submit()
|
searchBar.send_keys(etudiant)
|
||||||
time.sleep(5)
|
searchBar.submit()
|
||||||
MOY_UE1 = driver.find_element_by_id("ue-" + ue_name.lower().replace(" ","-")).text
|
time.sleep(5)
|
||||||
if "12" not in MOY_UE1:
|
MOY_UE1 = driver.find_element_by_id("ue-" + ue_name.lower().replace(" ","-")).text
|
||||||
noteBonne = False
|
if "12" not in MOY_UE1:
|
||||||
self.assertTrue(noteBonne)
|
noteBonne = False
|
||||||
|
self.assertTrue(noteBonne)
|
||||||
# Test : Ajoute une note à la seconde UE pour les deux élèves
|
|
||||||
# @expected : La moyenne de la seconde UE apparait et corresponds à la note rentrée
|
# Test : Ajoute une note à la seconde UE pour les deux élèves
|
||||||
def test_020_ajout_note_seconde_ue(self):
|
# @expected : La moyenne de la seconde UE apparait et corresponds à la note rentrée
|
||||||
global listeEtudiant
|
def test_020_ajout_note_seconde_ue(self):
|
||||||
global MOY_UE2
|
global listeEtudiant
|
||||||
global URL_SEMESTRE
|
global MOY_UE2
|
||||||
linkAddNote = "formnotes_note_"
|
global URL_SEMESTRE
|
||||||
driver = self.driver
|
linkAddNote = "formnotes_note_"
|
||||||
url = self.url
|
driver = self.driver
|
||||||
driver.get(URL_SEMESTRE)
|
url = self.url
|
||||||
ue_name = driver.find_elements_by_class_name("status_ue_acro")[1].text
|
driver.get(URL_SEMESTRE)
|
||||||
driver.find_element_by_link_text("M1201").click()
|
ue_name = driver.find_elements_by_class_name("status_ue_acro")[1].text
|
||||||
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
driver.find_element_by_link_text("M1201").click()
|
||||||
driver.find_element_by_xpath("//a[contains(@href,'saisie_notes?')]").click()
|
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
||||||
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
driver.find_element_by_xpath("//a[contains(@href,'saisie_notes?')]").click()
|
||||||
URL = driver.current_url
|
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
||||||
for champs in driver.find_elements_by_xpath(
|
URL = driver.current_url
|
||||||
"//input[contains(@id,'" + linkAddNote + "')]"
|
for champs in driver.find_elements_by_xpath(
|
||||||
):
|
"//input[contains(@id,'" + linkAddNote + "')]"
|
||||||
champs.clear()
|
):
|
||||||
champs.send_keys(8)
|
champs.clear()
|
||||||
driver.find_element_by_id("formnotes_submit").click()
|
champs.send_keys(8)
|
||||||
self.wait.until(EC.url_changes(URL))
|
driver.find_element_by_id("formnotes_submit").click()
|
||||||
driver.get(URL_SEMESTRE)
|
self.wait.until(EC.url_changes(URL))
|
||||||
noteBonne = True
|
driver.get(URL_SEMESTRE)
|
||||||
for etudiant in listeEtudiant:
|
noteBonne = True
|
||||||
URL = driver.current_url
|
for etudiant in listeEtudiant:
|
||||||
searchBar = driver.find_element_by_id("in-expnom")
|
URL = driver.current_url
|
||||||
searchBar.send_keys(etudiant)
|
searchBar = driver.find_element_by_id("in-expnom")
|
||||||
searchBar.submit()
|
searchBar.send_keys(etudiant)
|
||||||
time.sleep(5)
|
searchBar.submit()
|
||||||
MOY_UE2 = driver.find_element_by_id("ue-" + ue_name.lower().replace(" ","-")).text
|
time.sleep(5)
|
||||||
if "8" not in MOY_UE2:
|
MOY_UE2 = driver.find_element_by_id("ue-" + ue_name.lower().replace(" ","-")).text
|
||||||
noteBonne = False
|
if "8" not in MOY_UE2:
|
||||||
|
noteBonne = False
|
||||||
self.assertTrue(noteBonne)
|
|
||||||
|
self.assertTrue(noteBonne)
|
||||||
# Test : Vérification calcul de la moyenne générale
|
|
||||||
# @expected La moyenne prends en compte les deux ue et leur coefficiant
|
# Test : Vérification calcul de la moyenne générale
|
||||||
def test_030_verification_moyenne_generale(self):
|
# @expected La moyenne prends en compte les deux ue et leur coefficiant
|
||||||
global COEFF_UE1
|
def test_030_verification_moyenne_generale(self):
|
||||||
global COEFF_UE2
|
global COEFF_UE1
|
||||||
COEFF_UE1 = 2
|
global COEFF_UE2
|
||||||
COEFF_UE2 = 2
|
COEFF_UE1 = 2
|
||||||
driver = self.driver
|
COEFF_UE2 = 2
|
||||||
url = self.url
|
driver = self.driver
|
||||||
driver.get(url)
|
url = self.url
|
||||||
moyenneBonne = True
|
driver.get(url)
|
||||||
for etudiant in listeEtudiant:
|
moyenneBonne = True
|
||||||
searchBar = driver.find_element_by_id("in-expnom")
|
for etudiant in listeEtudiant:
|
||||||
searchBar.send_keys(etudiant)
|
searchBar = driver.find_element_by_id("in-expnom")
|
||||||
searchBar.submit()
|
searchBar.send_keys(etudiant)
|
||||||
time.sleep(5)
|
searchBar.submit()
|
||||||
if (
|
time.sleep(5)
|
||||||
(float(MOY_UE1) * COEFF_UE1 + float(MOY_UE2) * COEFF_UE2)
|
if (
|
||||||
/ (COEFF_UE1 + COEFF_UE2)
|
(float(MOY_UE1) * COEFF_UE1 + float(MOY_UE2) * COEFF_UE2)
|
||||||
) != float(driver.find_element_by_class_name("rcp_moy").text):
|
/ (COEFF_UE1 + COEFF_UE2)
|
||||||
moyenneBonne = False
|
) != float(driver.find_element_by_class_name("rcp_moy").text):
|
||||||
self.assertTrue(moyenneBonne)
|
moyenneBonne = False
|
||||||
|
self.assertTrue(moyenneBonne)
|
||||||
# Test : Changement du coefficiant d'un module et de ce fait, du coefficiant de l'UE
|
|
||||||
# @expected : La moyenne générale se modifie en fonction de ce changement de coefficiant
|
# Test : Changement du coefficiant d'un module et de ce fait, du coefficiant de l'UE
|
||||||
def test_040_modification_coefficiant_module(self):
|
# @expected : La moyenne générale se modifie en fonction de ce changement de coefficiant
|
||||||
global COEFF_UE1
|
def test_040_modification_coefficiant_module(self):
|
||||||
COEFF_UE1 = 3
|
global COEFF_UE1
|
||||||
driver = self.driver
|
COEFF_UE1 = 3
|
||||||
url = self.url
|
driver = self.driver
|
||||||
driver.get(url)
|
url = self.url
|
||||||
driver.find_element_by_id("link-programmes").click()
|
driver.get(url)
|
||||||
driver.find_element_by_id("titre-dut-info").click()
|
driver.find_element_by_id("link-programmes").click()
|
||||||
driver.find_element_by_xpath("//span[contains(text(),'M1101')]").click()
|
driver.find_element_by_id("titre-dut-info").click()
|
||||||
driver.find_element_by_id("tf_coefficient").clear()
|
driver.find_element_by_xpath("//span[contains(text(),'M1101')]").click()
|
||||||
driver.find_element_by_id("tf_coefficient").send_keys(COEFF_UE1)
|
driver.find_element_by_id("tf_coefficient").clear()
|
||||||
URL = driver.current_url
|
driver.find_element_by_id("tf_coefficient").send_keys(COEFF_UE1)
|
||||||
driver.find_element_by_id("tf_submit").click()
|
URL = driver.current_url
|
||||||
self.wait.until(EC.url_changes(URL))
|
driver.find_element_by_id("tf_submit").click()
|
||||||
moyenneBonne = True
|
self.wait.until(EC.url_changes(URL))
|
||||||
for etudiant in listeEtudiant:
|
moyenneBonne = True
|
||||||
URL = driver.current_url
|
for etudiant in listeEtudiant:
|
||||||
searchBar = driver.find_element_by_id("in-expnom")
|
URL = driver.current_url
|
||||||
searchBar.send_keys(etudiant)
|
searchBar = driver.find_element_by_id("in-expnom")
|
||||||
searchBar.submit()
|
searchBar.send_keys(etudiant)
|
||||||
time.sleep(5)
|
searchBar.submit()
|
||||||
if (
|
time.sleep(5)
|
||||||
(float(MOY_UE1) * COEFF_UE1 + float(MOY_UE2) * COEFF_UE2)
|
if (
|
||||||
/ (COEFF_UE1 + COEFF_UE2)
|
(float(MOY_UE1) * COEFF_UE1 + float(MOY_UE2) * COEFF_UE2)
|
||||||
) != float(driver.find_element_by_class_name("rcp_moy").text):
|
/ (COEFF_UE1 + COEFF_UE2)
|
||||||
moyenneBonne = False
|
) != float(driver.find_element_by_class_name("rcp_moy").text):
|
||||||
self.assertTrue(moyenneBonne)
|
moyenneBonne = False
|
||||||
|
self.assertTrue(moyenneBonne)
|
||||||
# Test : Ajout d'une note bonus pour un étudiant et d'une note malus pour un autre
|
|
||||||
# @expected : La moyenne de l'UE où est ajouté la note bonus/malus est impactée par cette dernière, la moyenne générale change avec ce changement de moyenne d'UE
|
# Test : Ajout d'une note bonus pour un étudiant et d'une note malus pour un autre
|
||||||
def test_050_ajout_note_bonus(self):
|
# @expected : La moyenne de l'UE où est ajouté la note bonus/malus est impactée par cette dernière, la moyenne générale change avec ce changement de moyenne d'UE
|
||||||
moyenneBonusEtudiant1 = "0.25"
|
def test_050_ajout_note_bonus(self):
|
||||||
moyenneBonusEtudiant2 = "0.25"
|
moyenneBonusEtudiant1 = "0.25"
|
||||||
linkAddNote = "formnotes_note_"
|
moyenneBonusEtudiant2 = "0.25"
|
||||||
driver = self.driver
|
linkAddNote = "formnotes_note_"
|
||||||
driver.get(URL_SEMESTRE)
|
driver = self.driver
|
||||||
driver.find_element_by_partial_link_text("malus").click()
|
driver.get(URL_SEMESTRE)
|
||||||
driver.find_element_by_link_text("Créer nouvelle évaluation").click()
|
driver.find_element_by_partial_link_text("malus").click()
|
||||||
time.sleep(1)
|
driver.find_element_by_link_text("Créer nouvelle évaluation").click()
|
||||||
driver.find_element_by_name("jour").clear()
|
time.sleep(1)
|
||||||
driver.find_element_by_name("jour").send_keys("31/01/2021")
|
driver.find_element_by_name("jour").clear()
|
||||||
driver.find_element_by_id("tf_description").send_keys("une interrogation bonus")
|
driver.find_element_by_name("jour").send_keys("31/01/2021")
|
||||||
driver.find_element_by_id("tf_submit").click()
|
driver.find_element_by_id("tf_description").send_keys("une interrogation bonus")
|
||||||
time.sleep(1)
|
driver.find_element_by_id("tf_submit").click()
|
||||||
driver.find_element_by_xpath("//a[contains(@href,'saisie_notes?')]").click()
|
time.sleep(1)
|
||||||
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
driver.find_element_by_xpath("//a[contains(@href,'saisie_notes?')]").click()
|
||||||
champsNote = driver.find_elements_by_xpath(
|
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
||||||
"//input[contains(@id,'" + linkAddNote + "')]"
|
champsNote = driver.find_elements_by_xpath(
|
||||||
)
|
"//input[contains(@id,'" + linkAddNote + "')]"
|
||||||
champsNote[0].clear()
|
)
|
||||||
champsNote[1].clear()
|
champsNote[0].clear()
|
||||||
champsNote[0].send_keys("-" + moyenneBonusEtudiant1)
|
champsNote[1].clear()
|
||||||
champsNote[1].send_keys(moyenneBonusEtudiant2)
|
champsNote[0].send_keys("-" + moyenneBonusEtudiant1)
|
||||||
driver.find_element_by_id("formnotes_submit").click()
|
champsNote[1].send_keys(moyenneBonusEtudiant2)
|
||||||
numeroEtu = 0
|
driver.find_element_by_id("formnotes_submit").click()
|
||||||
moyenneBonne = True
|
numeroEtu = 0
|
||||||
for etudiant in listeEtudiant:
|
moyenneBonne = True
|
||||||
URL = driver.current_url
|
for etudiant in listeEtudiant:
|
||||||
searchBar = driver.find_element_by_id("in-expnom")
|
URL = driver.current_url
|
||||||
searchBar.send_keys(etudiant)
|
searchBar = driver.find_element_by_id("in-expnom")
|
||||||
searchBar.submit()
|
searchBar.send_keys(etudiant)
|
||||||
time.sleep(5)
|
searchBar.submit()
|
||||||
if numeroEtu == 0:
|
time.sleep(5)
|
||||||
if (
|
if numeroEtu == 0:
|
||||||
(
|
if (
|
||||||
float(MOY_UE1) * COEFF_UE1
|
(
|
||||||
+ (float(MOY_UE2) + float(moyenneBonusEtudiant1)) * COEFF_UE2
|
float(MOY_UE1) * COEFF_UE1
|
||||||
)
|
+ (float(MOY_UE2) + float(moyenneBonusEtudiant1)) * COEFF_UE2
|
||||||
/ (COEFF_UE1 + COEFF_UE2)
|
)
|
||||||
) != float(driver.find_element_by_class_name("rcp_moy").text):
|
/ (COEFF_UE1 + COEFF_UE2)
|
||||||
moyenneBonne = False
|
) != float(driver.find_element_by_class_name("rcp_moy").text):
|
||||||
elif numeroEtu == 1:
|
moyenneBonne = False
|
||||||
if (
|
elif numeroEtu == 1:
|
||||||
(
|
if (
|
||||||
float(MOY_UE1) * COEFF_UE1
|
(
|
||||||
+ (float(MOY_UE2) - float(moyenneBonusEtudiant2)) * COEFF_UE2
|
float(MOY_UE1) * COEFF_UE1
|
||||||
)
|
+ (float(MOY_UE2) - float(moyenneBonusEtudiant2)) * COEFF_UE2
|
||||||
/ (COEFF_UE1 + COEFF_UE2)
|
)
|
||||||
) != float(driver.find_element_by_class_name("rcp_moy").text):
|
/ (COEFF_UE1 + COEFF_UE2)
|
||||||
moyenneBonne = False
|
) != float(driver.find_element_by_class_name("rcp_moy").text):
|
||||||
numeroEtu = numeroEtu + 1
|
moyenneBonne = False
|
||||||
self.assertTrue(moyenneBonne)
|
numeroEtu = numeroEtu + 1
|
||||||
|
self.assertTrue(moyenneBonne)
|
||||||
# Test : Ajout d'une note en attente pour un étudiant, et d'une note entrée pour un autre sur une même évaluation
|
|
||||||
# @expected :
|
# Test : Ajout d'une note en attente pour un étudiant, et d'une note entrée pour un autre sur une même évaluation
|
||||||
def test_060_note_attente(self):
|
# @expected :
|
||||||
moyenneBonusEtudiant1 = "0.25"
|
def test_060_note_attente(self):
|
||||||
moyenneBonusEtudiant2 = "0.25"
|
moyenneBonusEtudiant1 = "0.25"
|
||||||
linkAddNote = "formnotes_note_"
|
moyenneBonusEtudiant2 = "0.25"
|
||||||
champsNote = []
|
linkAddNote = "formnotes_note_"
|
||||||
driver = self.driver
|
champsNote = []
|
||||||
driver.get(URL_SEMESTRE)
|
driver = self.driver
|
||||||
driver.find_element_by_link_text("M1101").click()
|
driver.get(URL_SEMESTRE)
|
||||||
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
driver.find_element_by_link_text("M1101").click()
|
||||||
driver.find_element_by_xpath("//a[contains(@href,'saisie_notes?')]").click()
|
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
||||||
URL = driver.current_url
|
driver.find_element_by_xpath("//a[contains(@href,'saisie_notes?')]").click()
|
||||||
champsNote = driver.find_elements_by_xpath(
|
URL = driver.current_url
|
||||||
"//input[contains(@id,'" + linkAddNote + "')]"
|
champsNote = driver.find_elements_by_xpath(
|
||||||
)
|
"//input[contains(@id,'" + linkAddNote + "')]"
|
||||||
champsNote[0].clear()
|
)
|
||||||
champsNote[0].send_keys("ATT")
|
champsNote[0].clear()
|
||||||
driver.find_element_by_id("formnotes_submit").click()
|
champsNote[0].send_keys("ATT")
|
||||||
self.wait.until(EC.url_changes(URL))
|
driver.find_element_by_id("formnotes_submit").click()
|
||||||
numeroEtu = 0
|
self.wait.until(EC.url_changes(URL))
|
||||||
moyenneBonne = True
|
numeroEtu = 0
|
||||||
affichageMoyenne = True
|
moyenneBonne = True
|
||||||
for etudiant in listeEtudiant:
|
affichageMoyenne = True
|
||||||
URL = driver.current_url
|
for etudiant in listeEtudiant:
|
||||||
searchBar = driver.find_element_by_id("in-expnom")
|
URL = driver.current_url
|
||||||
searchBar.send_keys(etudiant)
|
searchBar = driver.find_element_by_id("in-expnom")
|
||||||
searchBar.submit()
|
searchBar.send_keys(etudiant)
|
||||||
time.sleep(5)
|
searchBar.submit()
|
||||||
ueListElement = driver.find_elements_by_class_name("ue_acro")
|
time.sleep(5)
|
||||||
ueListText = []
|
ueListElement = driver.find_elements_by_class_name("ue_acro")
|
||||||
for ueElement in ueListElement:
|
ueListText = []
|
||||||
ueListText.append(ueElement.text)
|
for ueElement in ueListElement:
|
||||||
if numeroEtu == 0:
|
ueListText.append(ueElement.text)
|
||||||
moyEtudiant1 = float(MOY_UE2) + float(moyenneBonusEtudiant1)
|
if numeroEtu == 0:
|
||||||
if moyEtudiant1 != float(
|
moyEtudiant1 = float(MOY_UE2) + float(moyenneBonusEtudiant1)
|
||||||
driver.find_element_by_class_name("rcp_moy").text
|
if moyEtudiant1 != float(
|
||||||
):
|
driver.find_element_by_class_name("rcp_moy").text
|
||||||
moyenneBonne = False
|
):
|
||||||
if "UE11" in ueListText:
|
moyenneBonne = False
|
||||||
affichageMoyenne = False
|
if "UE11" in ueListText:
|
||||||
elif numeroEtu == 1:
|
affichageMoyenne = False
|
||||||
moyEtudiant2 = (
|
elif numeroEtu == 1:
|
||||||
float(MOY_UE1) * COEFF_UE1
|
moyEtudiant2 = (
|
||||||
+ (float(MOY_UE2) - float(moyenneBonusEtudiant2)) * COEFF_UE2
|
float(MOY_UE1) * COEFF_UE1
|
||||||
) / (COEFF_UE1 + COEFF_UE2)
|
+ (float(MOY_UE2) - float(moyenneBonusEtudiant2)) * COEFF_UE2
|
||||||
if moyEtudiant2 != float(
|
) / (COEFF_UE1 + COEFF_UE2)
|
||||||
driver.find_element_by_class_name("rcp_moy").text
|
if moyEtudiant2 != float(
|
||||||
):
|
driver.find_element_by_class_name("rcp_moy").text
|
||||||
moyenneBonne = False
|
):
|
||||||
if "UE11" not in ueListText:
|
moyenneBonne = False
|
||||||
affichageMoyenne = False
|
if "UE11" not in ueListText:
|
||||||
numeroEtu = numeroEtu + 1
|
affichageMoyenne = False
|
||||||
self.assertTrue(moyenneBonne and affichageMoyenne)
|
numeroEtu = numeroEtu + 1
|
||||||
|
self.assertTrue(moyenneBonne and affichageMoyenne)
|
||||||
def test_070_note_absent(self):
|
|
||||||
ue_name = "UE11"
|
def test_070_note_absent(self):
|
||||||
moyenneBonusEtudiant1 = "0.25"
|
ue_name = "UE11"
|
||||||
moyenneBonusEtudiant2 = "0.25"
|
moyenneBonusEtudiant1 = "0.25"
|
||||||
linkAddNote = "formnotes_note_"
|
moyenneBonusEtudiant2 = "0.25"
|
||||||
MOY_UE1_EXC = 0
|
linkAddNote = "formnotes_note_"
|
||||||
champsNote = []
|
MOY_UE1_EXC = 0
|
||||||
driver = self.driver
|
champsNote = []
|
||||||
driver.get(URL_SEMESTRE)
|
driver = self.driver
|
||||||
driver.find_element_by_link_text("M1101").click()
|
driver.get(URL_SEMESTRE)
|
||||||
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
driver.find_element_by_link_text("M1101").click()
|
||||||
driver.find_element_by_xpath("//a[contains(@href,'saisie_notes?')]").click()
|
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
||||||
URL = driver.current_url
|
driver.find_element_by_xpath("//a[contains(@href,'saisie_notes?')]").click()
|
||||||
champsNote = driver.find_elements_by_xpath(
|
URL = driver.current_url
|
||||||
"//input[contains(@id,'" + linkAddNote + "')]"
|
champsNote = driver.find_elements_by_xpath(
|
||||||
)
|
"//input[contains(@id,'" + linkAddNote + "')]"
|
||||||
champsNote[0].clear()
|
)
|
||||||
champsNote[0].send_keys("ABS")
|
champsNote[0].clear()
|
||||||
driver.find_element_by_id("formnotes_submit").click()
|
champsNote[0].send_keys("ABS")
|
||||||
self.wait.until(EC.url_changes(URL))
|
driver.find_element_by_id("formnotes_submit").click()
|
||||||
numeroEtu = 0
|
self.wait.until(EC.url_changes(URL))
|
||||||
moyenneBonne = True
|
numeroEtu = 0
|
||||||
affichageMoyenne = True
|
moyenneBonne = True
|
||||||
noteExcuseeEgaleAZero = True
|
affichageMoyenne = True
|
||||||
ueList = []
|
noteExcuseeEgaleAZero = True
|
||||||
for etudiant in listeEtudiant:
|
ueList = []
|
||||||
URL = driver.current_url
|
for etudiant in listeEtudiant:
|
||||||
searchBar = driver.find_element_by_id("in-expnom")
|
URL = driver.current_url
|
||||||
searchBar.send_keys(etudiant)
|
searchBar = driver.find_element_by_id("in-expnom")
|
||||||
searchBar.submit()
|
searchBar.send_keys(etudiant)
|
||||||
self.wait.until(EC.url_changes(URL))
|
searchBar.submit()
|
||||||
ueListElement = driver.find_elements_by_class_name("ue_acro")
|
self.wait.until(EC.url_changes(URL))
|
||||||
ueListText = []
|
ueListElement = driver.find_elements_by_class_name("ue_acro")
|
||||||
for ueElement in ueListElement:
|
ueListText = []
|
||||||
ueListText.append(ueElement.text)
|
for ueElement in ueListElement:
|
||||||
if numeroEtu == 0:
|
ueListText.append(ueElement.text)
|
||||||
moyEtudiant1 = (
|
if numeroEtu == 0:
|
||||||
float(MOY_UE1_EXC) * COEFF_UE1
|
moyEtudiant1 = (
|
||||||
+ ((float(MOY_UE2) + float(moyenneBonusEtudiant1)) * COEFF_UE2)
|
float(MOY_UE1_EXC) * COEFF_UE1
|
||||||
) / (COEFF_UE1 + COEFF_UE2)
|
+ ((float(MOY_UE2) + float(moyenneBonusEtudiant1)) * COEFF_UE2)
|
||||||
# print(format(moyEtudiant1, "2.2f"))
|
) / (COEFF_UE1 + COEFF_UE2)
|
||||||
# print(
|
# print(format(moyEtudiant1, "2.2f"))
|
||||||
# format(
|
# print(
|
||||||
# float(driver.find_element_by_class_name("rcp_moy").text), "2.2f"
|
# format(
|
||||||
# )
|
# float(driver.find_element_by_class_name("rcp_moy").text), "2.2f"
|
||||||
# )
|
# )
|
||||||
if format(moyEtudiant1, "2.2f") != format(
|
# )
|
||||||
float(driver.find_element_by_class_name("rcp_moy").text), "2.2f"
|
if format(moyEtudiant1, "2.2f") != format(
|
||||||
):
|
float(driver.find_element_by_class_name("rcp_moy").text), "2.2f"
|
||||||
moyenneBonne = False
|
):
|
||||||
if ue_name not in ueListText:
|
moyenneBonne = False
|
||||||
affichageMoyenne = False
|
if ue_name not in ueListText:
|
||||||
MOY_UE1 = driver.find_element_by_id("ue-" + ue_name.lower().replace(" ","-")).text
|
affichageMoyenne = False
|
||||||
if float(0) != float(MOY_UE1):
|
MOY_UE1 = driver.find_element_by_id("ue-" + ue_name.lower().replace(" ","-")).text
|
||||||
noteExcuseeEgaleAZero = False
|
if float(0) != float(MOY_UE1):
|
||||||
elif numeroEtu == 1:
|
noteExcuseeEgaleAZero = False
|
||||||
MOY_UE1 = driver.find_element_by_id("ue-" + ue_name.lower().replace(" ","-")).text
|
elif numeroEtu == 1:
|
||||||
moyEtudiant2 = (
|
MOY_UE1 = driver.find_element_by_id("ue-" + ue_name.lower().replace(" ","-")).text
|
||||||
float(MOY_UE1) * COEFF_UE1
|
moyEtudiant2 = (
|
||||||
+ (float(MOY_UE2) - float(moyenneBonusEtudiant2)) * COEFF_UE2
|
float(MOY_UE1) * COEFF_UE1
|
||||||
) / (COEFF_UE1 + COEFF_UE2)
|
+ (float(MOY_UE2) - float(moyenneBonusEtudiant2)) * COEFF_UE2
|
||||||
if moyEtudiant2 != float(
|
) / (COEFF_UE1 + COEFF_UE2)
|
||||||
driver.find_element_by_class_name("rcp_moy").text
|
if moyEtudiant2 != float(
|
||||||
):
|
driver.find_element_by_class_name("rcp_moy").text
|
||||||
moyenneBonne = False
|
):
|
||||||
if "UE11" not in ueListText:
|
moyenneBonne = False
|
||||||
affichageMoyenne = False
|
if "UE11" not in ueListText:
|
||||||
numeroEtu = numeroEtu + 1
|
affichageMoyenne = False
|
||||||
self.assertTrue(moyenneBonne and affichageMoyenne and noteExcuseeEgaleAZero)
|
numeroEtu = numeroEtu + 1
|
||||||
|
self.assertTrue(moyenneBonne and affichageMoyenne and noteExcuseeEgaleAZero)
|
||||||
def test_080_note_excuse(self):
|
|
||||||
moyenneBonusEtudiant1 = "0.25"
|
def test_080_note_excuse(self):
|
||||||
moyenneBonusEtudiant2 = "0.25"
|
moyenneBonusEtudiant1 = "0.25"
|
||||||
linkAddNote = "formnotes_note_"
|
moyenneBonusEtudiant2 = "0.25"
|
||||||
champsNote = []
|
linkAddNote = "formnotes_note_"
|
||||||
driver = self.driver
|
champsNote = []
|
||||||
driver.get(URL_SEMESTRE)
|
driver = self.driver
|
||||||
driver.find_element_by_link_text("M1101").click()
|
driver.get(URL_SEMESTRE)
|
||||||
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
driver.find_element_by_link_text("M1101").click()
|
||||||
driver.find_element_by_xpath("//a[contains(@href,'saisie_notes?')]").click()
|
self.wait.until(EC.url_changes(URL_SEMESTRE))
|
||||||
URL = driver.current_url
|
driver.find_element_by_xpath("//a[contains(@href,'saisie_notes?')]").click()
|
||||||
champsNote = driver.find_elements_by_xpath(
|
URL = driver.current_url
|
||||||
"//input[contains(@id,'" + linkAddNote + "')]"
|
champsNote = driver.find_elements_by_xpath(
|
||||||
)
|
"//input[contains(@id,'" + linkAddNote + "')]"
|
||||||
champsNote[0].clear()
|
)
|
||||||
champsNote[0].send_keys("EXC")
|
champsNote[0].clear()
|
||||||
driver.find_element_by_id("formnotes_submit").click()
|
champsNote[0].send_keys("EXC")
|
||||||
self.wait.until(EC.url_changes(URL))
|
driver.find_element_by_id("formnotes_submit").click()
|
||||||
numeroEtu = 0
|
self.wait.until(EC.url_changes(URL))
|
||||||
moyenneBonne = True
|
numeroEtu = 0
|
||||||
affichageMoyenne = True
|
moyenneBonne = True
|
||||||
ueList = []
|
affichageMoyenne = True
|
||||||
for etudiant in listeEtudiant:
|
ueList = []
|
||||||
URL = driver.current_url
|
for etudiant in listeEtudiant:
|
||||||
searchBar = driver.find_element_by_id("in-expnom")
|
URL = driver.current_url
|
||||||
searchBar.send_keys(etudiant)
|
searchBar = driver.find_element_by_id("in-expnom")
|
||||||
searchBar.submit()
|
searchBar.send_keys(etudiant)
|
||||||
self.wait.until(EC.url_changes(URL))
|
searchBar.submit()
|
||||||
ueListElement = driver.find_elements_by_class_name("ue_acro")
|
self.wait.until(EC.url_changes(URL))
|
||||||
ueListText = []
|
ueListElement = driver.find_elements_by_class_name("ue_acro")
|
||||||
for ueElement in ueListElement:
|
ueListText = []
|
||||||
ueListText.append(ueElement.text)
|
for ueElement in ueListElement:
|
||||||
if numeroEtu == 0:
|
ueListText.append(ueElement.text)
|
||||||
moyEtudiant1 = float(MOY_UE2) + float(moyenneBonusEtudiant1)
|
if numeroEtu == 0:
|
||||||
if moyEtudiant1 != float(
|
moyEtudiant1 = float(MOY_UE2) + float(moyenneBonusEtudiant1)
|
||||||
driver.find_element_by_class_name("rcp_moy").text
|
if moyEtudiant1 != float(
|
||||||
):
|
driver.find_element_by_class_name("rcp_moy").text
|
||||||
moyenneBonne = False
|
):
|
||||||
if "UE11" in ueListText:
|
moyenneBonne = False
|
||||||
affichageMoyenne = False
|
if "UE11" in ueListText:
|
||||||
elif numeroEtu == 1:
|
affichageMoyenne = False
|
||||||
moyEtudiant2 = (
|
elif numeroEtu == 1:
|
||||||
float(MOY_UE1) * COEFF_UE1
|
moyEtudiant2 = (
|
||||||
+ (float(MOY_UE2) - float(moyenneBonusEtudiant2)) * COEFF_UE2
|
float(MOY_UE1) * COEFF_UE1
|
||||||
) / (COEFF_UE1 + COEFF_UE2)
|
+ (float(MOY_UE2) - float(moyenneBonusEtudiant2)) * COEFF_UE2
|
||||||
if moyEtudiant2 != float(
|
) / (COEFF_UE1 + COEFF_UE2)
|
||||||
driver.find_element_by_class_name("rcp_moy").text
|
if moyEtudiant2 != float(
|
||||||
):
|
driver.find_element_by_class_name("rcp_moy").text
|
||||||
moyenneBonne = False
|
):
|
||||||
if "UE11" not in ueListText:
|
moyenneBonne = False
|
||||||
affichageMoyenne = False
|
if "UE11" not in ueListText:
|
||||||
numeroEtu = numeroEtu + 1
|
affichageMoyenne = False
|
||||||
self.assertTrue(moyenneBonne and affichageMoyenne)
|
numeroEtu = numeroEtu + 1
|
||||||
|
self.assertTrue(moyenneBonne and affichageMoyenne)
|
||||||
# TOdo
|
|
||||||
def test_090_note_bonus(self):
|
# TOdo
|
||||||
global listeEtudiant
|
def test_090_note_bonus(self):
|
||||||
global COEFF_UE1
|
global listeEtudiant
|
||||||
global COEFF_UE2
|
global COEFF_UE1
|
||||||
global URL_SEMESTRE
|
global COEFF_UE2
|
||||||
|
global URL_SEMESTRE
|
||||||
def tearDown(self):
|
|
||||||
self.driver.close()
|
def tearDown(self):
|
||||||
|
self.driver.close()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
deleteDepartement.main()
|
if __name__ == "__main__":
|
||||||
createDepartement.main()
|
deleteDepartement.main()
|
||||||
creationSiteDepartement.main()
|
createDepartement.main()
|
||||||
cmdProcess = [
|
creationSiteDepartement.main()
|
||||||
"./scriptExecution.sh",
|
cmdProcess = [
|
||||||
LINK_SCODOC_SERVER,
|
"./scriptExecution.sh",
|
||||||
NOM_DPT,
|
LINK_SCODOC_SERVER,
|
||||||
"test_scenario3_formation.py",
|
NOM_DPT,
|
||||||
]
|
"test_scenario3_formation.py",
|
||||||
process = subprocess.Popen(cmdProcess)
|
]
|
||||||
process.wait()
|
process = subprocess.Popen(cmdProcess)
|
||||||
unittest.main(
|
process.wait()
|
||||||
testRunner=HtmlTestRunner.HTMLTestRunner(
|
unittest.main(
|
||||||
report_name="06_Moyenne_tests",
|
testRunner=HtmlTestRunner.HTMLTestRunner(
|
||||||
output="./ResultatTest",
|
report_name="06_Moyenne_tests",
|
||||||
combine_reports=True,
|
output="./ResultatTest",
|
||||||
)
|
combine_reports=True,
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
@ -1,244 +1,245 @@
|
|||||||
import unittest
|
import unittest
|
||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
import urllib.parse as urlparse
|
import urllib.parse as urlparse
|
||||||
import HtmlTestRunner
|
import HtmlTestRunner
|
||||||
import createDepartement
|
import createDepartement
|
||||||
import creationSiteDepartement
|
import creationSiteDepartement
|
||||||
import deleteDepartement
|
import deleteDepartement
|
||||||
from setting import (
|
from setting import (
|
||||||
SCODOC_ADMIN_ID,
|
SCODOC_ADMIN_ID,
|
||||||
SCODOC_ADMIN_PASS,
|
SCODOC_ADMIN_PASS,
|
||||||
SCHEMA,
|
SCHEMA,
|
||||||
BASE_URL,
|
SCODOC_SERVER,
|
||||||
BASE_SSH_URL,
|
SCODOC_PORT,
|
||||||
LINK_SCODOC_SERVER,
|
BASE_SSH_URL,
|
||||||
NOM_DPT,
|
LINK_SCODOC_SERVER,
|
||||||
SCODOC_ENS_ID,
|
NOM_DPT,
|
||||||
SCODOC_ENS_PASS,
|
SCODOC_ENS_ID,
|
||||||
SCODOC_CHEF_ID,
|
SCODOC_ENS_PASS,
|
||||||
SCODOC_CHEF_PASS,
|
SCODOC_CHEF_ID,
|
||||||
NAVIGATEUR,
|
SCODOC_CHEF_PASS,
|
||||||
)
|
NAVIGATEUR,
|
||||||
from urllib.parse import parse_qs
|
)
|
||||||
from selenium import webdriver
|
from urllib.parse import parse_qs
|
||||||
from selenium.webdriver.common.keys import Keys
|
from selenium import webdriver
|
||||||
from selenium.common.exceptions import NoSuchElementException
|
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 import expected_conditions as EC
|
||||||
from selenium.webdriver.support.select import Select
|
from selenium.webdriver.support.ui import Select, WebDriverWait
|
||||||
|
from selenium.webdriver.support.select import Select
|
||||||
|
|
||||||
URL_ETUDIANT = ""
|
|
||||||
URL_DECISION = ""
|
URL_ETUDIANT = ""
|
||||||
|
URL_DECISION = ""
|
||||||
|
|
||||||
class PythonOrgSearch(unittest.TestCase):
|
|
||||||
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
class PythonOrgSearch(unittest.TestCase):
|
||||||
def setUp(self):
|
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
|
||||||
if NAVIGATEUR == "firefox":
|
def setUp(self):
|
||||||
self.driver = webdriver.Firefox()
|
if NAVIGATEUR == "firefox":
|
||||||
elif NAVIGATEUR == "chrome":
|
self.driver = webdriver.Firefox()
|
||||||
self.driver = webdriver.Chrome()
|
elif NAVIGATEUR == "chrome":
|
||||||
self.url = SCHEMA + "://" + BASE_URL + NOM_DPT + "/Scolarite"
|
self.driver = webdriver.Chrome()
|
||||||
self.wait = WebDriverWait(self.driver, 10)
|
self.url = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + NOM_DPT + "/Scolarite"
|
||||||
self.driver.get(
|
self.wait = WebDriverWait(self.driver, 10)
|
||||||
SCHEMA
|
self.driver.get(
|
||||||
+ "://"
|
SCHEMA
|
||||||
+ SCODOC_ADMIN_ID
|
+ "://"
|
||||||
+ ":"
|
+ SCODOC_ADMIN_ID
|
||||||
+ SCODOC_ADMIN_PASS
|
+ ":"
|
||||||
+ "@"
|
+ SCODOC_ADMIN_PASS
|
||||||
+ BASE_SSH_URL
|
+ "@"
|
||||||
+ "force_admin_authentication"
|
+ BASE_SSH_URL
|
||||||
)
|
+ "force_admin_authentication"
|
||||||
|
)
|
||||||
def test_010_etudiantS1_assidu_avec_moy_admis(self):
|
|
||||||
driver = self.driver
|
def test_010_etudiantS1_assidu_avec_moy_admis(self):
|
||||||
url = self.url
|
driver = self.driver
|
||||||
driver.get(url)
|
url = self.url
|
||||||
searchBar = driver.find_element_by_id("in-expnom")
|
driver.get(url)
|
||||||
searchBar.send_keys("EID1")
|
searchBar = driver.find_element_by_id("in-expnom")
|
||||||
searchBar.submit()
|
searchBar.send_keys("EID1")
|
||||||
time.sleep(5)
|
searchBar.submit()
|
||||||
URL_ETUDIANT = driver.current_url
|
time.sleep(5)
|
||||||
driver.find_element_by_xpath("//a[contains(text(),'Scolarité')]").click()
|
URL_ETUDIANT = driver.current_url
|
||||||
driver.find_element_by_xpath(
|
driver.find_element_by_xpath("//a[contains(text(),'Scolarité')]").click()
|
||||||
"//a[contains(@href,'formsemestre_validation_etud_form?')]"
|
driver.find_element_by_xpath(
|
||||||
).click()
|
"//a[contains(@href,'formsemestre_validation_etud_form?')]"
|
||||||
self.wait.until(EC.url_changes(URL_ETUDIANT))
|
).click()
|
||||||
URL_DECISION = driver.current_url
|
self.wait.until(EC.url_changes(URL_ETUDIANT))
|
||||||
driver.find_element_by_id("input-choice-10").click()
|
URL_DECISION = driver.current_url
|
||||||
driver.find_element_by_id("subut").click()
|
driver.find_element_by_id("input-choice-10").click()
|
||||||
time.sleep(1)
|
driver.find_element_by_id("subut").click()
|
||||||
driver.get(URL_ETUDIANT)
|
time.sleep(1)
|
||||||
self.assertTrue("ADM" in driver.find_element_by_class_name("rcp_dec").text)
|
driver.get(URL_ETUDIANT)
|
||||||
|
self.assertTrue("ADM" in driver.find_element_by_class_name("rcp_dec").text)
|
||||||
def test_020_etudiantS1_non_assidu_avec_moy_semestre_non_valide(self):
|
|
||||||
driver = self.driver
|
def test_020_etudiantS1_non_assidu_avec_moy_semestre_non_valide(self):
|
||||||
url = self.url
|
driver = self.driver
|
||||||
driver.get(url)
|
url = self.url
|
||||||
searchBar = driver.find_element_by_id("in-expnom")
|
driver.get(url)
|
||||||
searchBar.send_keys("EID1")
|
searchBar = driver.find_element_by_id("in-expnom")
|
||||||
searchBar.submit()
|
searchBar.send_keys("EID1")
|
||||||
time.sleep(5)
|
searchBar.submit()
|
||||||
URL_ETUDIANT = driver.current_url
|
time.sleep(5)
|
||||||
driver.find_element_by_xpath("//a[contains(text(),'Scolarité')]").click()
|
URL_ETUDIANT = driver.current_url
|
||||||
driver.find_element_by_xpath(
|
driver.find_element_by_xpath("//a[contains(text(),'Scolarité')]").click()
|
||||||
"//a[contains(@href,'formsemestre_validation_etud_form?')]"
|
driver.find_element_by_xpath(
|
||||||
).click()
|
"//a[contains(@href,'formsemestre_validation_etud_form?')]"
|
||||||
self.wait.until(EC.url_changes(URL_ETUDIANT))
|
).click()
|
||||||
URL_DECISION = driver.current_url
|
self.wait.until(EC.url_changes(URL_ETUDIANT))
|
||||||
driver.find_element_by_id("input-choice-40").click()
|
URL_DECISION = driver.current_url
|
||||||
driver.find_element_by_id("subut").click()
|
driver.find_element_by_id("input-choice-40").click()
|
||||||
driver.get(URL_ETUDIANT)
|
driver.find_element_by_id("subut").click()
|
||||||
self.assertTrue("ATJ" in driver.find_element_by_class_name("rcp_dec").text)
|
driver.get(URL_ETUDIANT)
|
||||||
|
self.assertTrue("ATJ" in driver.find_element_by_class_name("rcp_dec").text)
|
||||||
def test_030_etudiantS1_assidu_sous_la_moy_semestre_valide(self):
|
|
||||||
driver = self.driver
|
def test_030_etudiantS1_assidu_sous_la_moy_semestre_valide(self):
|
||||||
url = self.url
|
driver = self.driver
|
||||||
driver.get(url)
|
url = self.url
|
||||||
searchBar = driver.find_element_by_id("in-expnom")
|
driver.get(url)
|
||||||
searchBar.send_keys("EID4")
|
searchBar = driver.find_element_by_id("in-expnom")
|
||||||
searchBar.submit()
|
searchBar.send_keys("EID4")
|
||||||
time.sleep(5)
|
searchBar.submit()
|
||||||
URL_ETUDIANT = driver.current_url
|
time.sleep(5)
|
||||||
driver.find_element_by_xpath("//a[contains(text(),'Scolarité')]").click()
|
URL_ETUDIANT = driver.current_url
|
||||||
driver.find_element_by_xpath(
|
driver.find_element_by_xpath("//a[contains(text(),'Scolarité')]").click()
|
||||||
"//a[contains(@href,'formsemestre_validation_etud_form?')]"
|
driver.find_element_by_xpath(
|
||||||
).click()
|
"//a[contains(@href,'formsemestre_validation_etud_form?')]"
|
||||||
self.wait.until(EC.url_changes(URL_ETUDIANT))
|
).click()
|
||||||
URL_DECISION = driver.current_url
|
self.wait.until(EC.url_changes(URL_ETUDIANT))
|
||||||
driver.find_element_by_id("input-choice-30").click()
|
URL_DECISION = driver.current_url
|
||||||
driver.find_element_by_id("subut").click()
|
driver.find_element_by_id("input-choice-30").click()
|
||||||
driver.get(URL_ETUDIANT)
|
driver.find_element_by_id("subut").click()
|
||||||
self.assertTrue("ATB" in driver.find_element_by_class_name("rcp_dec").text)
|
driver.get(URL_ETUDIANT)
|
||||||
driver.find_element_by_xpath("//a[contains(text(),'Scolarité')]").click()
|
self.assertTrue("ATB" in driver.find_element_by_class_name("rcp_dec").text)
|
||||||
driver.find_element_by_xpath(
|
driver.find_element_by_xpath("//a[contains(text(),'Scolarité')]").click()
|
||||||
"//a[contains(@href,'formsemestre_validation_etud_form?')]"
|
driver.find_element_by_xpath(
|
||||||
).click()
|
"//a[contains(@href,'formsemestre_validation_etud_form?')]"
|
||||||
self.wait.until(EC.url_changes(URL_ETUDIANT))
|
).click()
|
||||||
URL_DECISION = driver.current_url
|
self.wait.until(EC.url_changes(URL_ETUDIANT))
|
||||||
driver.find_element_by_id("input-choice-580").click()
|
URL_DECISION = driver.current_url
|
||||||
driver.find_element_by_id("subut").click()
|
driver.find_element_by_id("input-choice-580").click()
|
||||||
driver.get(URL_ETUDIANT)
|
driver.find_element_by_id("subut").click()
|
||||||
self.assertTrue("ATB" in driver.find_element_by_class_name("rcp_dec").text)
|
driver.get(URL_ETUDIANT)
|
||||||
|
self.assertTrue("ATB" in driver.find_element_by_class_name("rcp_dec").text)
|
||||||
def test_040_etudiantS1_non_assidu_sous_la_moy_semestre_valide(self):
|
|
||||||
driver = self.driver
|
def test_040_etudiantS1_non_assidu_sous_la_moy_semestre_valide(self):
|
||||||
url = self.url
|
driver = self.driver
|
||||||
driver.get(url)
|
url = self.url
|
||||||
searchBar = driver.find_element_by_id("in-expnom")
|
driver.get(url)
|
||||||
searchBar.send_keys("EID4")
|
searchBar = driver.find_element_by_id("in-expnom")
|
||||||
searchBar.submit()
|
searchBar.send_keys("EID4")
|
||||||
time.sleep(5)
|
searchBar.submit()
|
||||||
URL_ETUDIANT = driver.current_url
|
time.sleep(5)
|
||||||
driver.find_element_by_xpath("//a[contains(text(),'Scolarité')]").click()
|
URL_ETUDIANT = driver.current_url
|
||||||
driver.find_element_by_xpath(
|
driver.find_element_by_xpath("//a[contains(text(),'Scolarité')]").click()
|
||||||
"//a[contains(@href,'formsemestre_validation_etud_form?')]"
|
driver.find_element_by_xpath(
|
||||||
).click()
|
"//a[contains(@href,'formsemestre_validation_etud_form?')]"
|
||||||
self.wait.until(EC.url_changes(URL_ETUDIANT))
|
).click()
|
||||||
URL_DECISION = driver.current_url
|
self.wait.until(EC.url_changes(URL_ETUDIANT))
|
||||||
driver.find_element_by_id("input-choice-40").click()
|
URL_DECISION = driver.current_url
|
||||||
driver.find_element_by_id("subut").click()
|
driver.find_element_by_id("input-choice-40").click()
|
||||||
driver.get(URL_ETUDIANT)
|
driver.find_element_by_id("subut").click()
|
||||||
self.assertTrue("ATJ" in driver.find_element_by_class_name("rcp_dec").text)
|
driver.get(URL_ETUDIANT)
|
||||||
driver.find_element_by_xpath("//a[contains(text(),'Scolarité')]").click()
|
self.assertTrue("ATJ" in driver.find_element_by_class_name("rcp_dec").text)
|
||||||
driver.find_element_by_xpath(
|
driver.find_element_by_xpath("//a[contains(text(),'Scolarité')]").click()
|
||||||
"//a[contains(@href,'formsemestre_validation_etud_form?')]"
|
driver.find_element_by_xpath(
|
||||||
).click()
|
"//a[contains(@href,'formsemestre_validation_etud_form?')]"
|
||||||
self.wait.until(EC.url_changes(URL_ETUDIANT))
|
).click()
|
||||||
URL_DECISION = driver.current_url
|
self.wait.until(EC.url_changes(URL_ETUDIANT))
|
||||||
driver.find_element_by_id("input-choice-580").click()
|
URL_DECISION = driver.current_url
|
||||||
driver.find_element_by_id("subut").click()
|
driver.find_element_by_id("input-choice-580").click()
|
||||||
driver.get(URL_ETUDIANT)
|
driver.find_element_by_id("subut").click()
|
||||||
self.assertTrue("ATB" in driver.find_element_by_class_name("rcp_dec").text)
|
driver.get(URL_ETUDIANT)
|
||||||
|
self.assertTrue("ATB" in driver.find_element_by_class_name("rcp_dec").text)
|
||||||
def test_050_calcul_automatiqueS2_jury(self):
|
|
||||||
driver = self.driver
|
def test_050_calcul_automatiqueS2_jury(self):
|
||||||
url = self.url
|
driver = self.driver
|
||||||
driver.get(url)
|
url = self.url
|
||||||
driver.find_element_by_link_text("semestre 2").click()
|
driver.get(url)
|
||||||
self.wait.until(EC.url_changes(url))
|
driver.find_element_by_link_text("semestre 2").click()
|
||||||
urlTmp = driver.current_url
|
self.wait.until(EC.url_changes(url))
|
||||||
driver.find_element_by_xpath("//a[contains(text(),'Jury')]").click()
|
urlTmp = driver.current_url
|
||||||
driver.find_element_by_link_text("Saisie des décisions du jury").click()
|
driver.find_element_by_xpath("//a[contains(text(),'Jury')]").click()
|
||||||
self.wait.until(EC.url_changes(urlTmp))
|
driver.find_element_by_link_text("Saisie des décisions du jury").click()
|
||||||
urlTmp = driver.current_url
|
self.wait.until(EC.url_changes(urlTmp))
|
||||||
driver.find_element_by_partial_link_text("Calcul automatique").click()
|
urlTmp = driver.current_url
|
||||||
self.wait.until(EC.url_changes(urlTmp))
|
driver.find_element_by_partial_link_text("Calcul automatique").click()
|
||||||
urlTmp = driver.current_url
|
self.wait.until(EC.url_changes(urlTmp))
|
||||||
driver.find_element_by_xpath("//input[@type='submit']").click()
|
urlTmp = driver.current_url
|
||||||
self.wait.until(EC.url_changes(urlTmp))
|
driver.find_element_by_xpath("//input[@type='submit']").click()
|
||||||
searchBar = driver.find_element_by_id("in-expnom")
|
self.wait.until(EC.url_changes(urlTmp))
|
||||||
searchBar.send_keys("EID7")
|
searchBar = driver.find_element_by_id("in-expnom")
|
||||||
searchBar.submit()
|
searchBar.send_keys("EID7")
|
||||||
time.sleep(5)
|
searchBar.submit()
|
||||||
self.assertTrue("ADM" in driver.find_element_by_class_name("rcp_dec").text)
|
time.sleep(5)
|
||||||
searchBar = driver.find_element_by_id("in-expnom")
|
self.assertTrue("ADM" in driver.find_element_by_class_name("rcp_dec").text)
|
||||||
searchBar.send_keys("EID10")
|
searchBar = driver.find_element_by_id("in-expnom")
|
||||||
searchBar.submit()
|
searchBar.send_keys("EID10")
|
||||||
time.sleep(5)
|
searchBar.submit()
|
||||||
self.assertTrue("en cours" in driver.page_source)
|
time.sleep(5)
|
||||||
|
self.assertTrue("en cours" in driver.page_source)
|
||||||
def test_060_declarer_defaillance(self):
|
|
||||||
driver = self.driver
|
def test_060_declarer_defaillance(self):
|
||||||
url = self.url
|
driver = self.driver
|
||||||
driver.get(url)
|
url = self.url
|
||||||
searchBar = driver.find_element_by_id("in-expnom")
|
driver.get(url)
|
||||||
searchBar.send_keys("EID10")
|
searchBar = driver.find_element_by_id("in-expnom")
|
||||||
searchBar.submit()
|
searchBar.send_keys("EID10")
|
||||||
time.sleep(5)
|
searchBar.submit()
|
||||||
URL_ETUDIANT = driver.current_url
|
time.sleep(5)
|
||||||
driver.find_element_by_xpath("//a[contains(text(),'Scolarité')]").click()
|
URL_ETUDIANT = driver.current_url
|
||||||
driver.find_element_by_xpath("//a[contains(@href,'formDef?')]").click()
|
driver.find_element_by_xpath("//a[contains(text(),'Scolarité')]").click()
|
||||||
self.wait.until(EC.url_changes(URL_ETUDIANT))
|
driver.find_element_by_xpath("//a[contains(@href,'formDef?')]").click()
|
||||||
input = driver.find_element_by_name("event_date")
|
self.wait.until(EC.url_changes(URL_ETUDIANT))
|
||||||
input.clear()
|
input = driver.find_element_by_name("event_date")
|
||||||
input.send_keys("11/06/2021")
|
input.clear()
|
||||||
driver.find_element_by_xpath("//input[@type='submit']").click()
|
input.send_keys("11/06/2021")
|
||||||
driver.get(URL_ETUDIANT)
|
driver.find_element_by_xpath("//input[@type='submit']").click()
|
||||||
self.assertTrue("Défaillant" in driver.page_source)
|
driver.get(URL_ETUDIANT)
|
||||||
|
self.assertTrue("Défaillant" in driver.page_source)
|
||||||
def test_070_declarer_demission(self):
|
|
||||||
driver = self.driver
|
def test_070_declarer_demission(self):
|
||||||
url = self.url
|
driver = self.driver
|
||||||
driver.get(url)
|
url = self.url
|
||||||
searchBar = driver.find_element_by_id("in-expnom")
|
driver.get(url)
|
||||||
searchBar.send_keys("EID10")
|
searchBar = driver.find_element_by_id("in-expnom")
|
||||||
searchBar.submit()
|
searchBar.send_keys("EID10")
|
||||||
time.sleep(5)
|
searchBar.submit()
|
||||||
URL_ETUDIANT = driver.current_url
|
time.sleep(5)
|
||||||
driver.find_element_by_xpath("//a[contains(text(),'Scolarité')]").click()
|
URL_ETUDIANT = driver.current_url
|
||||||
driver.find_element_by_xpath("//a[contains(@href,'formDem?')]").click()
|
driver.find_element_by_xpath("//a[contains(text(),'Scolarité')]").click()
|
||||||
self.wait.until(EC.url_changes(URL_ETUDIANT))
|
driver.find_element_by_xpath("//a[contains(@href,'formDem?')]").click()
|
||||||
input = driver.find_element_by_name("event_date")
|
self.wait.until(EC.url_changes(URL_ETUDIANT))
|
||||||
input.clear()
|
input = driver.find_element_by_name("event_date")
|
||||||
input.send_keys("11/06/2021")
|
input.clear()
|
||||||
driver.find_element_by_xpath("//input[@type='submit']").click()
|
input.send_keys("11/06/2021")
|
||||||
driver.get(URL_ETUDIANT)
|
driver.find_element_by_xpath("//input[@type='submit']").click()
|
||||||
self.assertTrue("Démission le " in driver.page_source)
|
driver.get(URL_ETUDIANT)
|
||||||
|
self.assertTrue("Démission le " in driver.page_source)
|
||||||
def tearDown(self):
|
|
||||||
self.driver.close()
|
def tearDown(self):
|
||||||
|
self.driver.close()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
deleteDepartement.main()
|
if __name__ == "__main__":
|
||||||
createDepartement.main()
|
deleteDepartement.main()
|
||||||
creationSiteDepartement.main()
|
createDepartement.main()
|
||||||
cmdProcess = [
|
creationSiteDepartement.main()
|
||||||
"./scriptExecution.sh",
|
cmdProcess = [
|
||||||
LINK_SCODOC_SERVER,
|
"./scriptExecution.sh",
|
||||||
NOM_DPT,
|
LINK_SCODOC_SERVER,
|
||||||
"test_scenario4_formation.py",
|
NOM_DPT,
|
||||||
]
|
"test_scenario4_formation.py",
|
||||||
process = subprocess.Popen(cmdProcess)
|
]
|
||||||
process.wait()
|
process = subprocess.Popen(cmdProcess)
|
||||||
unittest.main(
|
process.wait()
|
||||||
testRunner=HtmlTestRunner.HTMLTestRunner(
|
unittest.main(
|
||||||
report_name="07_Admission_et_passages_tests",
|
testRunner=HtmlTestRunner.HTMLTestRunner(
|
||||||
output="./ResultatTest",
|
report_name="07_Admission_et_passages_tests",
|
||||||
combine_reports=True,
|
output="./ResultatTest",
|
||||||
)
|
combine_reports=True,
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
@ -1,54 +1,55 @@
|
|||||||
# coding: utf8
|
# coding: utf8
|
||||||
import unittest
|
import unittest
|
||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
import HtmlTestRunner
|
import HtmlTestRunner
|
||||||
from setting import (
|
from setting import (
|
||||||
SCODOC_ADMIN_ID,
|
SCODOC_ADMIN_ID,
|
||||||
SCODOC_ADMIN_PASS,
|
SCODOC_ADMIN_PASS,
|
||||||
SCHEMA,
|
SCHEMA,
|
||||||
BASE_URL,
|
SCODOC_SERVER,
|
||||||
NOM_DPT,
|
SCODOC_PORT,
|
||||||
LINK_SCODOC_SERVER,
|
NOM_DPT,
|
||||||
BASE_SSH_URL,
|
LINK_SCODOC_SERVER,
|
||||||
NAVIGATEUR,
|
BASE_SSH_URL,
|
||||||
)
|
NAVIGATEUR,
|
||||||
from selenium import webdriver
|
)
|
||||||
from selenium.webdriver.support import expected_conditions as EC
|
from selenium import webdriver
|
||||||
from selenium.webdriver.support.ui import Select, WebDriverWait
|
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.common.keys import Keys
|
from selenium.common.exceptions import NoSuchElementException
|
||||||
from selenium.webdriver.support.ui import Select
|
from selenium.webdriver.common.keys import Keys
|
||||||
from selenium.webdriver.support.select import Select
|
from selenium.webdriver.support.ui import Select
|
||||||
|
from selenium.webdriver.support.select import Select
|
||||||
URL_ROOT = SCHEMA + "://" + BASE_URL
|
|
||||||
URL_AUTH = "/".join((URL_ROOT, "auth", "login"))
|
URL_ROOT = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT
|
||||||
URL_SCODOC8 = "/".join((URL_ROOT, "index"))
|
URL_AUTH = "/".join((URL_ROOT, "auth", "login"))
|
||||||
URL_HOME = "/".join((URL_ROOT, "ScoDoc", "index"))
|
URL_SCODOC8 = "/".join((URL_ROOT, "index"))
|
||||||
URL_DEPT = "/".join((URL_ROOT, "ScoDoc", NOM_DPT, "Scolarite", "index_html"))
|
URL_HOME = "/".join((URL_ROOT, "ScoDoc", "index"))
|
||||||
URL_ADMIN = "/".join((URL_ROOT, "ScoDoc", "admin"))
|
URL_DEPT = "/".join((URL_ROOT, "ScoDoc", NOM_DPT, "Scolarite", "index_html"))
|
||||||
|
URL_ADMIN = "/".join((URL_ROOT, "ScoDoc", "admin"))
|
||||||
ACRONYME_FORMATION = "FormationTEST"
|
|
||||||
|
ACRONYME_FORMATION = "FormationTEST"
|
||||||
def main():
|
|
||||||
next_page = URL_HOME
|
def main():
|
||||||
if NAVIGATEUR == "firefox":
|
next_page = URL_HOME
|
||||||
driver = webdriver.Firefox()
|
if NAVIGATEUR == "firefox":
|
||||||
else:
|
driver = webdriver.Firefox()
|
||||||
driver = webdriver.Chrome()
|
else:
|
||||||
auth_page = URL_AUTH + ("?next=" + next_page).replace("/", "%2F")
|
driver = webdriver.Chrome()
|
||||||
driver.get(auth_page)
|
auth_page = URL_AUTH + ("?next=" + next_page).replace("/", "%2F")
|
||||||
driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
|
driver.get(auth_page)
|
||||||
driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
|
driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
|
||||||
driver.find_element_by_id("submit").click()
|
driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
|
||||||
time.sleep(2)
|
driver.find_element_by_id("submit").click()
|
||||||
try:
|
time.sleep(2)
|
||||||
select = Select(driver.find_element_by_id("create-dept"))
|
try:
|
||||||
select.select_by_visible_text(NOM_DPT)
|
select = Select(driver.find_element_by_id("create-dept"))
|
||||||
driver.find_element_by_id("create-dept").submit()
|
select.select_by_visible_text(NOM_DPT)
|
||||||
time.sleep(1)
|
driver.find_element_by_id("create-dept").submit()
|
||||||
driver.find_element_by_id("tf_submit").click()
|
time.sleep(1)
|
||||||
time.sleep(1)
|
driver.find_element_by_id("tf_submit").click()
|
||||||
driver.close()
|
time.sleep(1)
|
||||||
except NoSuchElementException:
|
driver.close()
|
||||||
|
except NoSuchElementException:
|
||||||
driver.close()
|
driver.close()
|
8
importFormationXml.py
Normal file
8
importFormationXml.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import subprocess
|
||||||
|
from setting import LINK_SCODOC_SERVER, NOM_DPT
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
cmdProcess = ["./scriptImportFormation.sh", LINK_SCODOC_SERVER, NOM_DPT]
|
||||||
|
process = subprocess.Popen(cmdProcess)
|
||||||
|
process.wait()
|
214
readme.md
214
readme.md
@ -1,102 +1,112 @@
|
|||||||
#Tests E2E du logiciel Scodoc
|
#Tests E2E du logiciel Scodoc
|
||||||
|
|
||||||
Ces jeux de tests ont été conçus pour tester automatiquement Scodoc d'un point de vue E2E (End to End). Ils sont en théorie indépendants les uns des autres. Ils ont étés développés en python 3.
|
Ces jeux de tests ont été conçus pour tester automatiquement Scodoc d'un point de vue E2E (End to End). Ils sont en théorie indépendants les uns des autres. Ils ont étés développés en python 3.
|
||||||
## I Configuration
|
## I Configuration
|
||||||
Dans cette partie je vais détailler les prérequis pour l'environnement de développement
|
Dans cette partie je vais détailler les prérequis pour l'environnement de développement
|
||||||
### Prérequis Module
|
### Prérequis Module
|
||||||
Ces prérequis peuvent être trouvés dans requirements.txt qui se trouvent à la base du projet.
|
Ces prérequis peuvent être trouvés dans requirements.txt qui se trouvent à la base du projet.
|
||||||
Vous devez avoir pip d'installé, normalement il est fourni avec les versions de python3, sinon vous trouverez les étapes d'installation [ici](https://pip.pypa.io/en/stable/installing/)
|
Vous devez avoir pip d'installé, normalement il est fourni avec les versions de python3, sinon vous trouverez les étapes d'installation [ici](https://pip.pypa.io/en/stable/installing/)
|
||||||
Les modules suivant sont nécessaire :
|
Les modules suivant sont nécessaire :
|
||||||
>selenium==3.141.0
|
>selenium==3.141.0
|
||||||
>python-dotenv==0.17.1
|
>python-dotenv==0.17.1
|
||||||
>HtmlTestRunner==0.8.0
|
>HtmlTestRunner==0.8.0
|
||||||
|
|
||||||
Vous pouvez les installer manuellement avec pip avec la commande suivante :
|
Vous pouvez les installer manuellement avec pip avec la commande suivante :
|
||||||
>pip install selenium
|
>pip install selenium
|
||||||
|
|
||||||
ou alternativement avec
|
ou alternativement avec
|
||||||
>pip install -r requirements.txt
|
>pip install -r requirements.txt
|
||||||
### Environnement de test
|
### Environnement de test
|
||||||
Un modèle de .env est fourni dans ce projet, pour que les tests soient fonctionnel vous devez le remplir et le renommer en .env. Ce dernier servira à remplir différentes informations spécifiques concernant votre environnement Scodoc. Nous allons le voir ici en détail
|
Un modèle de .env est fourni dans ce projet, pour que les tests soient fonctionnel vous devez le remplir et le renommer en .env. Ce dernier servira à remplir différentes informations spécifiques concernant votre environnement Scodoc. Nous allons le voir ici en détail
|
||||||
#### .env
|
#### .env
|
||||||
|
|
||||||
>SCHEMA = "https"
|
SCHEMA="http"
|
||||||
>BASE_URL = "scodoc-dev-iutinfo.univ-lille.fr/ScoDoc/"
|
BASE_URL = "scodoc_server:5000"
|
||||||
|
NOM_DPT = "TEST01"
|
||||||
Ici sera le lien vers la page d'accueil de votre Scodoc
|
SCODOC_ADMIN_ID = "admin_id"
|
||||||
|
SCODOC_ADMIN_PASS = "admin_password"
|
||||||
>NOM_DPT = "test01"
|
SCODOC_ENS_ID = "enseignant_id"
|
||||||
|
SCODOC_ENS_PASS = "enseignant_password@10"
|
||||||
Le nom du département surlequel vous allez effectuer vos tests, il est **FORTEMENT** conseillés de mettre ici un nom de département qui n'existe pas, sous risque de perte de données.
|
SCODOC_CHEF_ID = "chef_id"
|
||||||
|
SCODOC_CHEF_PASS = "p@ssword42@"
|
||||||
>SCODOC_ADMIN_ID = "admin_id"
|
LINK_SCODOC_SERVER = "scodoc_server"
|
||||||
|
BASE_SSH_URL = "scodoc_server:5000/"
|
||||||
Le nom d'utilisateur d'un Admin Scodoc.
|
NAVIGATEUR = "firefox"
|
||||||
|
|
||||||
>SCODOC_ADMIN_PASS = "admin_password"
|
Ici sera le lien vers la page d'accueil de votre Scodoc
|
||||||
|
|
||||||
Le mot de passe d'un Admin Scodoc.
|
>NOM_DPT = "test01"
|
||||||
|
|
||||||
>SCODOC_ENS_ID = "enseignant_id"
|
Le nom du département surlequel vous allez effectuer vos tests, il est **FORTEMENT** conseillés de mettre ici un nom de département qui n'existe pas, sous risque de perte de données.
|
||||||
|
|
||||||
Le nom d'utilisateur d'un enseignant lambda qui servira pour rentrer des notes, soit qui existe, soit qui sera créé.
|
>SCODOC_ADMIN_ID = "admin_id"
|
||||||
|
|
||||||
>SCODOC_ENS_PASS = "enseignant_password@10"
|
Le nom d'utilisateur d'un Admin Scodoc.
|
||||||
|
|
||||||
Le mot de passe de l'utilisateur précédent, si l'utilisateur précédent n'existe pas, veillez à avoir un mot de passe suffisamenent compliqué pour la création de ce dernier.
|
>SCODOC_ADMIN_PASS = "admin_password"
|
||||||
|
|
||||||
>SCODOC_CHEF_ID = "chef_id"
|
Le mot de passe d'un Admin Scodoc.
|
||||||
|
|
||||||
Le nom d'utilisateur d'un enseignant lambda qui se verra attribué le rôle de résponsable d'un module afin de créer des interrogations , soit qui existe, soit qui sera créé.
|
>SCODOC_ENS_ID = "enseignant_id"
|
||||||
|
|
||||||
>SCODOC_CHEF_PASS = "p@ssword42@"
|
Le nom d'utilisateur d'un enseignant lambda qui servira pour rentrer des notes, soit qui existe, soit qui sera créé.
|
||||||
|
|
||||||
Le mot de passe de l'utilisateur précédent, si l'utilisateur précédent n'existe pas, veillez à avoir un mot de passe suffisamenent compliqué pour la
|
>SCODOC_ENS_PASS = "enseignant_password@10"
|
||||||
|
|
||||||
>LINK_SCODOC_SERVER = "root@ssh_server_scodoc"
|
Le mot de passe de l'utilisateur précédent, si l'utilisateur précédent n'existe pas, veillez à avoir un mot de passe suffisamenent compliqué pour la création de ce dernier.
|
||||||
|
|
||||||
Le lien vers votre serveur Scodoc, ce dernier servira à lancer des scripts de mise en place sur le serveur. Veillez donc à avoir une connexion avec les droits root sur votre serveur, de préférences avec échange de clef ssh.
|
>SCODOC_CHEF_ID = "chef_id"
|
||||||
|
|
||||||
>BASE_SSH_URL = "scodoc-dev-iutinfo.univ-lille.fr/"
|
Le nom d'utilisateur d'un enseignant lambda qui se verra attribué le rôle de résponsable d'un module afin de créer des interrogations , soit qui existe, soit qui sera créé.
|
||||||
|
|
||||||
Le lien vers la page de choix de département, avec le format précisé.
|
>SCODOC_CHEF_PASS = "p@ssword42@"
|
||||||
|
|
||||||
>NAVIGATEUR = "firefox"
|
Le mot de passe de l'utilisateur précédent, si l'utilisateur précédent n'existe pas, veillez à avoir un mot de passe suffisamenent compliqué pour la
|
||||||
|
|
||||||
Ici vous pouvez choisir entre firefox et chrome,choisissez le navigateur dans lequel vous voulez que vos tests se déroulent. Cette ligne permettra au programme de choisir le webdriver correspondant.
|
>LINK_SCODOC_SERVER = "root@ssh_server_scodoc"
|
||||||
|
|
||||||
#### Explications du fonctionnement des tests
|
Le lien vers votre serveur Scodoc, ce dernier servira à lancer des scripts de mise en place sur le serveur. Veillez donc à avoir une connexion avec les droits root sur votre serveur, de préférences avec échange de clef ssh.
|
||||||
|
|
||||||
Les tests sont prévus pour fonctionner avec firefox ou chrome les webdrivers sont intégrés dans le projet pour éviter de devoir les installer manuellement. Ces webdrivers servent à faire la connexion entre python et le navigateur.
|
>BASE_SSH_URL = "scodoc-dev-iutinfo.univ-lille.fr/"
|
||||||
|
|
||||||
##Lancement des tests
|
Le lien vers la page de choix de département, avec le format précisé.
|
||||||
|
|
||||||
Pour lancer les tests, assurez vous d'avoir une connexion possible avec votre serveur. Positionnez vous à la racine de ce projet et il suffit donc de lancer la commande par exemple pour le premier jeux de tests
|
>NAVIGATEUR = "firefox"
|
||||||
|
|
||||||
>python3 01_creation_departement_test.py
|
Ici vous pouvez choisir entre firefox et chrome,choisissez le navigateur dans lequel vous voulez que vos tests se déroulent. Cette ligne permettra au programme de choisir le webdriver correspondant.
|
||||||
|
|
||||||
Alternativement vous pouvez lancer l'ensemble des tests avec la commande
|
#### Explications du fonctionnement des tests
|
||||||
|
|
||||||
>./lancement_de_tout_les_tests.sh
|
Les tests sont prévus pour fonctionner avec firefox ou chrome les webdrivers sont intégrés dans le projet pour éviter de devoir les installer manuellement. Ces webdrivers servent à faire la connexion entre python et le navigateur.
|
||||||
|
|
||||||
L'option --c ou --cleanup est disponible si vous souhaitez effacer tout les rapports précédents
|
##Lancement des tests
|
||||||
|
|
||||||
###Resultats des tests
|
Pour lancer les tests, assurez vous d'avoir une connexion possible avec votre serveur. Positionnez vous à la racine de ce projet et il suffit donc de lancer la commande par exemple pour le premier jeux de tests
|
||||||
|
|
||||||
Les tests sont présentés sur une page HTML qui se trouve dans le dossier ResultatTest, il y a une page HTML par jeux de tests créée. Un récapitulatif est également créé par le biais du script
|
>python3 01_creation_departement_test.py
|
||||||
|
|
||||||
>./scriptGenerateReportPage.sh
|
Alternativement vous pouvez lancer l'ensemble des tests avec la commande
|
||||||
|
|
||||||
Celui ci est lancé automatiquement à la fin du script
|
>./lancement_de_tout_les_tests.sh
|
||||||
|
|
||||||
>./lancement_de_tout_les_tests.sh
|
L'option --c ou --cleanup est disponible si vous souhaitez effacer tout les rapports précédents
|
||||||
|
|
||||||
Vous y retrouverez les liens menant au détails de chaque rapport ainsi qu'un résumé du nombre de test passés/échoués
|
###Resultats des tests
|
||||||
|
|
||||||
##Correctifs
|
Les tests sont présentés sur une page HTML qui se trouve dans le dossier ResultatTest, il y a une page HTML par jeux de tests créée. Un récapitulatif est également créé par le biais du script
|
||||||
|
|
||||||
* Modifier le PATH pour que geckodriver soit executable `export PATH=".:$PATH"`
|
>./scriptGenerateReportPage.sh
|
||||||
|
|
||||||
* pip install HtmlTestRunner-Python3
|
Celui ci est lancé automatiquement à la fin du script
|
||||||
|
|
||||||
* Créer un utilisateur Nom:BACH Prenom:Test User:Bach TODO: utiliser enseignant_id à la place
|
>./lancement_de_tout_les_tests.sh
|
||||||
|
|
||||||
|
Vous y retrouverez les liens menant au détails de chaque rapport ainsi qu'un résumé du nombre de test passés/échoués
|
||||||
|
|
||||||
|
##Correctifs
|
||||||
|
|
||||||
|
* Modifier le PATH pour que geckodriver soit executable `export PATH=".:$PATH"`
|
||||||
|
|
||||||
|
* pip install HtmlTestRunner-Python3
|
||||||
|
|
||||||
|
* Créer un utilisateur Nom:BACH Prenom:Test User:Bach TODO: utiliser enseignant_id à la place
|
||||||
|
12
scriptCreationUtilisateurs.sh
Executable file
12
scriptCreationUtilisateurs.sh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#Ce script se charge de se connecter au serveur scodoc et créer les enseignants requis pour le département donné en paramètre
|
||||||
|
if [ "$#" -ne 2 ];
|
||||||
|
then
|
||||||
|
echo "Pas assez d'arguments"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
ssh $1 /bin/bash<< EOF
|
||||||
|
cd /opt/scodoc
|
||||||
|
source venv/bin/activate
|
||||||
|
flask user-create -n BACH -p Jean-Sebastien Bach Ens $2
|
||||||
|
EOF
|
12
scriptImportFormation.sh
Executable file
12
scriptImportFormation.sh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#Ce script se charge de se connecter au serveur scodoc et créer les enseignants requis pour le département donné en paramètre
|
||||||
|
if [ "$#" -ne 2 ];
|
||||||
|
then
|
||||||
|
echo "Pas assez d'arguments"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
ssh scodoc@$1 /bin/bash<< EOF
|
||||||
|
cd /opt/scodoc
|
||||||
|
source venv/bin/activate
|
||||||
|
flask import-xml tests/scenario/export_formation1.xml $2
|
||||||
|
EOF
|
37
setting.py
37
setting.py
@ -1,19 +1,20 @@
|
|||||||
import os
|
import os
|
||||||
from os.path import join, dirname
|
from os.path import join, dirname
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
dotenv_path = join(dirname(__file__), ".env")
|
dotenv_path = join(dirname(__file__), ".env")
|
||||||
load_dotenv(dotenv_path)
|
load_dotenv(dotenv_path)
|
||||||
|
|
||||||
SCHEMA = os.environ.get("SCHEMA")
|
SCHEMA = os.environ.get("SCHEMA")
|
||||||
BASE_URL = os.environ.get("BASE_URL")
|
SCODOC_SERVER = os.environ.get("SCODOC_SERVER")
|
||||||
NOM_DPT = os.environ.get("NOM_DPT")
|
SCODOC_PORT = os.environ.get("SCODOC_PORT")
|
||||||
SCODOC_ADMIN_ID = os.environ.get("SCODOC_ADMIN_ID")
|
NOM_DPT = os.environ.get("NOM_DPT")
|
||||||
SCODOC_ADMIN_PASS = os.environ.get("SCODOC_ADMIN_PASS")
|
SCODOC_ADMIN_ID = os.environ.get("SCODOC_ADMIN_ID")
|
||||||
SCODOC_ENS_ID = os.environ.get("SCODOC_ENS_ID")
|
SCODOC_ADMIN_PASS = os.environ.get("SCODOC_ADMIN_PASS")
|
||||||
SCODOC_ENS_PASS = os.environ.get("SCODOC_ENS_PASS")
|
SCODOC_ENS_ID = os.environ.get("SCODOC_ENS_ID")
|
||||||
SCODOC_CHEF_ID = os.environ.get("SCODOC_CHEF_ID")
|
SCODOC_ENS_PASS = os.environ.get("SCODOC_ENS_PASS")
|
||||||
SCODOC_CHEF_PASS = os.environ.get("SCODOC_CHEF_PASS")
|
SCODOC_CHEF_ID = os.environ.get("SCODOC_CHEF_ID")
|
||||||
LINK_SCODOC_SERVER = os.environ.get("LINK_SCODOC_SERVER")
|
SCODOC_CHEF_PASS = os.environ.get("SCODOC_CHEF_PASS")
|
||||||
BASE_SSH_URL = os.environ.get("BASE_SSH_URL")
|
LINK_SCODOC_SERVER = os.environ.get("LINK_SCODOC_SERVER")
|
||||||
|
BASE_SSH_URL = os.environ.get("BASE_SSH_URL")
|
||||||
NAVIGATEUR = os.environ.get("NAVIGATEUR")
|
NAVIGATEUR = os.environ.get("NAVIGATEUR")
|
@ -1,48 +1,38 @@
|
|||||||
# coding: utf8
|
# coding: utf8
|
||||||
import unittest
|
from setting import (
|
||||||
import time
|
SCODOC_ADMIN_ID,
|
||||||
import subprocess
|
SCODOC_ADMIN_PASS,
|
||||||
import HtmlTestRunner
|
SCHEMA,
|
||||||
from setting import (
|
SCODOC_SERVER,
|
||||||
SCODOC_ADMIN_ID,
|
SCODOC_PORT,
|
||||||
SCODOC_ADMIN_PASS,
|
NOM_DPT,
|
||||||
SCHEMA,
|
LINK_SCODOC_SERVER,
|
||||||
BASE_URL,
|
BASE_SSH_URL,
|
||||||
NOM_DPT,
|
NAVIGATEUR,
|
||||||
LINK_SCODOC_SERVER,
|
)
|
||||||
BASE_SSH_URL,
|
from selenium import webdriver
|
||||||
NAVIGATEUR,
|
|
||||||
)
|
URL = SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + NOM_DPT + "/Scolarite"
|
||||||
from selenium import webdriver
|
|
||||||
from selenium.webdriver.support import expected_conditions as EC
|
ACRONYME_FORMATION = "FormationTEST"
|
||||||
from selenium.webdriver.support.ui import Select, WebDriverWait
|
|
||||||
from selenium.common.exceptions import NoSuchElementException
|
|
||||||
from selenium.webdriver.common.keys import Keys
|
def main():
|
||||||
from selenium.webdriver.support.ui import Select
|
if NAVIGATEUR == "firefox":
|
||||||
from selenium.webdriver.support.select import Select
|
driver = webdriver.Firefox()
|
||||||
|
else:
|
||||||
URL = SCHEMA + "://" + BASE_URL + NOM_DPT + "/Scolarite"
|
driver = webdriver.Chrome()
|
||||||
|
auth_page = URL_AUTH + ("?next=" + URL_HOME).replace("/", "%2F")
|
||||||
ACRONYME_FORMATION = "FormationTEST"
|
driver.get(auth_page)
|
||||||
|
driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
|
||||||
|
driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
|
||||||
def main():
|
driver.find_element_by_id("submit").click()
|
||||||
next_page = "test_vue"
|
# driver.get(SCHEMA + "://" + SCODOC_SERVER + ":" + SCODOC_PORT + "scodoc_admin")
|
||||||
if NAVIGATEUR == "firefox":
|
# time.sleep(2)
|
||||||
driver = webdriver.Firefox()
|
# try:
|
||||||
else:
|
# select = Select(driver.find_element_by_id("delete-dept"))
|
||||||
driver = webdriver.Chrome()
|
# select.select_by_visible_text(NOM_DPT)
|
||||||
auth_page = SCHEMA + "://" + BASE_SSH_URL + "auth/login?next=%2F" + next_page
|
# driver.find_element_by_id("delete-dept").submit()
|
||||||
driver.get(auth_page)
|
# driver.close()
|
||||||
driver.find_element_by_id("user_name").send_keys(SCODOC_ADMIN_ID)
|
# except NoSuchElementException:
|
||||||
driver.find_element_by_id("password").send_keys(SCODOC_ADMIN_PASS)
|
driver.close()
|
||||||
driver.find_element_by_id("submit").click()
|
|
||||||
# driver.get(SCHEMA + "://" + BASE_URL + "scodoc_admin")
|
|
||||||
# time.sleep(2)
|
|
||||||
# try:
|
|
||||||
# select = Select(driver.find_element_by_id("delete-dept"))
|
|
||||||
# select.select_by_visible_text(NOM_DPT)
|
|
||||||
# driver.find_element_by_id("delete-dept").submit()
|
|
||||||
# driver.close()
|
|
||||||
# except NoSuchElementException:
|
|
||||||
driver.close()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user