forked from aurelien.plancke/ScodocTestClient
54 lines
1.8 KiB
Python
54 lines
1.8 KiB
Python
import unittest
|
|
import time
|
|
from setup import SCODOC_ADMIN_ID,SCODOC_ADMIN_PASS,BASE_URL,NOM_DPT
|
|
from selenium import webdriver
|
|
from selenium.webdriver.common.keys import Keys
|
|
from selenium.webdriver.support.ui import Select
|
|
from selenium.webdriver.support.select import Select
|
|
|
|
SCODOC_ADMIN_ID = "admin"
|
|
SCODOC_ADMIN_PASS = "root_pass_42"
|
|
NOM_DPT = "AurelienUS"
|
|
baseURL = "https://scodoc-dev-iutinfo.univ-lille.fr"
|
|
|
|
|
|
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.driver.get(
|
|
"https://"
|
|
+ SCODOC_ADMIN_ID
|
|
+ ":"
|
|
+ SCODOC_ADMIN_PASS
|
|
+ "@scodoc-dev-iutinfo.univ-lille.fr/force_admin_authentication"
|
|
)
|
|
self.driver.get(baseURL + "/ScoDoc")
|
|
|
|
# Test Creer une formation
|
|
# @expected :
|
|
def test_create_formation(self):
|
|
driver = self.driver
|
|
url = baseURL + "/ScoDoc/" + NOM_DPT + "/Scolarite/Notes/formation_create"
|
|
driver.get(url)
|
|
select = Select(driver.find_element_by_name("DeptId"))
|
|
select.select_by_visible_text(NOM_DPT)
|
|
self.assertTrue(select.first_selected_option.text == NOM_DPT)
|
|
element = driver.find_element_by_name("DeptId")
|
|
element = driver.find_element_by_id("gtrcontent").find_element_by_tag_name("h6")
|
|
element.submit()
|
|
time.sleep(2)
|
|
driver.get(baseURL + "/ScoDoc")
|
|
self.assertTrue("TESTDPT" in driver.page_source)
|
|
|
|
# def test_create_module(self):
|
|
# driver = self.driver
|
|
# element = driver.find_element_by_name("TESTDPT")
|
|
|
|
# ferme la fenetre à chaque fin de test
|
|
def tearDown(self):
|
|
self.driver.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main() |