-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_fixture1.py
50 lines (35 loc) · 1.33 KB
/
test_fixture1.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
from selenium import webdriver
from os import system
link = "http://selenium1py.pythonanywhere.com/"
class TestMainPage1():
@classmethod
def setup_class(self):
print("\nstart browser for test suite..")
self.browser = webdriver.Chrome()
@classmethod
def teardown_class(self):
print("quit browser for test suite..")
self.browser.quit()
def test_guest_should_see_login_link(self):
self.browser.get(link)
self.browser.find_element_by_css_selector("#login_link")
def test_guest_should_see_basket_link_on_the_main_page(self):
self.browser.get(link)
self.browser.find_element_by_css_selector(".basket-mini .btn-group > a")
class TestMainPage2():
def setup_method(self):
print("start browser for test..")
self.browser = webdriver.Chrome()
def teardown_method(self):
print("quit browser for test..")
self.browser.quit()
def test_guest_should_see_login_link(self):
self.browser.get(link)
self.browser.find_element_by_css_selector("#login_link")
def test_guest_should_see_basket_link_on_the_main_page(self):
self.browser.get(link)
self.browser.find_element_by_css_selector(".basket-mini .btn-group > a")
def main():
system(f'pytest -s "{__file__}"')
if __name__ == "__main__":
main()