ScodocTestClient/04_modif_etudiant_test.py

58 lines
1.8 KiB
Python

import unittest
import time
import urllib.parse as urlparse
from setup import SCODOC_ADMIN_ID,SCODOC_ADMIN_PASS,BASE_URL,NOM_DPT
from urllib.parse import parse_qs
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select, WebDriverWait
from selenium.webdriver.support.select import Select
nomEtu = "UnAutreEtudiant"
prenomEtu = "Normal"
oldnip = "11122234"
newnip = "12345678"
eid = "EID1"
class PythonOrgSearch(unittest.TestCase):
# Permet de se connecter et se remettre sur la page d'accueil avant chaque test
def setUp(self):
self.driver = webdriver.Firefox()
self.wait = WebDriverWait(self.driver, 10)
self.driver.get(
"https://"
+ SCODOC_ADMIN_ID
+ ":"
+ SCODOC_ADMIN_PASS
+ "@scodoc-dev-iutinfo.univ-lille.fr/force_admin_authentication"
)
self.driver.get("https://scodoc-dev-iutinfo.univ-lille.fr/ScoDoc")
# Test changer les données d'un étudiant
# @expected : Le nip sur la page informations de l'étudiant est mis à jour
def test_changement_info_etudiant(self):
url = (
BASE_URL
+ NOM_DPT
+ "/Scolarite/etudident_edit_form?etudid="
+ eid
)
driver = self.driver
driver.get(url)
driver.find_element_by_id("tf_code_nip").clear()
driver.find_element_by_id("tf_code_nip").send_keys(newnip)
driver.find_element_by_id("tf_submit").click()
self.wait.until(EC.url_changes(url))
time.sleep(5)
self.assertTrue(newnip in driver.page_source)
# ferme la fenetre
def tearDown(self):
self.driver.close()
if __name__ == "__main__":
unittest.main()