-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_fixture9.py
More file actions
30 lines (22 loc) · 905 Bytes
/
Copy pathtest_fixture9.py
File metadata and controls
30 lines (22 loc) · 905 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
27
28
29
30
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
link = "http://selenium1py.pythonanywhere.com/"
@pytest.fixture(scope="function")
def browser():
print("\nstart browser for test..")
browser = webdriver.Chrome()
yield browser
print("\nquit browser..")
browser.quit()
class TestMainPage1():
def test_guest_should_see_login_link(self, browser):
browser.get(link)
browser.find_element(By.CSS_SELECTOR, "#login_link")
def test_guest_should_see_basket_link_on_the_main_page(self, browser):
browser.get(link)
browser.find_element(By.CSS_SELECTOR, ".basket-mini .btn-group > a")
@pytest.mark.xfail(reason="fixing this bug right now")
def test_guest_should_see_search_button_on_the_main_page(self, browser):
browser.get(link)
browser.find_element(By.CSS_SELECTOR, "button.favorite")