-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_fixture4.py
More file actions
26 lines (22 loc) · 790 Bytes
/
Copy pathtest_fixture4.py
File metadata and controls
26 lines (22 loc) · 790 Bytes
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
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
LINK = "http://selenium1py.pythonanywhere.com/"
@pytest.fixture(scope='class')
def browser():
print('\nstart browser for test ...')
browser = webdriver.Chrome()
yield browser
print('\nquit browser ...')
browser.quit()
class TestMainPage:
def test_guest_should_see_login_link(self, browser):
print("start test1")
browser.get(LINK)
browser.find_element(By.CSS_SELECTOR, "#login_link")
print("finish test1")
def test_guest_should_see_basket_link_on_the_main_page(self, browser):
print("start test2")
browser.get(LINK)
browser.find_element(By.CSS_SELECTOR, ".basket-mini .btn-group > a")
print("finish test2")