forked from dyt811/SeleRed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLORIS_TestingModule.py
99 lines (72 loc) · 2.82 KB
/
LORIS_TestingModule.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
from unittest import TestCase, main
from collections import namedtuple
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.support.ui import Select
from time import time
from datetime import date
# Create a Firefox Session
binary = FirefoxBinary(r'C:\Program Files\Mozilla Firefox\firefox.exe')
driver = webdriver.Firefox(firefox_binary=binary)
driver.implicitly_wait(30)
driver.maximize_window()
# Instantiate a named tuple class to contain the information
Credential = namedtuple("Credential", "URL username password")
class TestLORIS_setup():
def __init__(self, credential_loris: Credential):
self.credential = credential_loris
class TestLORIS(TestLORIS_setup, TestCase):
def test_login(self):
driver.get(self.credential.URL)
field_username = driver.find_element_by_xpath('//*[placeholder="Username"]')
field_username.sendKeys(self.credential.username)
field_password = driver.find_element_by_xpath('//*[placeholder="Password"]')
field_password.sendKeys(self.credential.password)
button_login = driver.find_element_by_xpath('//*[value = "Login"]')
button_login.click()
# Check to see if we are still on the same page:
field_username = driver.find_element_by_xpath('//*[placeholder="Username"]')
assert field_username is []
def test_imaging_browser(self):
pass
def test_imaging_uploader(self):
pass
def test_logout(self):
pass
def test_candidate_list(self):
pass
def test_candidate_creation(self):
pass
def test_candidate_deletion(self):
pass
def test_visit_timeopint_creation(self):
pass
def test_imaging_browser(self):
pass
def test_imaging_browser(self):
pass
def test_imaging_browser(self):
pass
driver.get("https://inscription.ymcaquebec.org/Facilities/FacilitiesSearchWizard.asp")
# Type in search date.
field_facility_booking = driver.find_element_by_id("search-facbook-radio")
field_facility_booking.click()
field_facility_function = Select(driver.find_element_by_id("FacilityFunctions"))
field_facility_function.select_by_visible_text('CV Badminton')
field_centre = driver.find_element_by_xpath('//*[@title="Centre-ville"]')
field_centre.click()
# Get the current date:
today = date.today()
print(f"{today.year}, {today.day}, {today.month}")
date_operations = [
("YearFrom", today.year),
("MonthFrom", today.strftime("%b")),
("DayFrom", today.day),
("YearTo", today.year),
("MonthTo", today.strftime("%b")),
("DayTo", today.day),
]
for operation in date_operations:
field_year = Select(driver.find_element_by_id(operation[0]))
field_year.select_by_visible_text(str(operation[1]))