-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
25 lines (18 loc) · 743 Bytes
/
Copy pathconftest.py
File metadata and controls
25 lines (18 loc) · 743 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
from playwright.sync_api import Page, expect
from src.test_data import CREDENTIALS, PRODUCT_DATA
import pytest
@pytest.fixture
def auth_page(page: Page):
page.goto("https://www.saucedemo.com/")
page.locator("#user-name").fill(CREDENTIALS["username"])
page.locator("#password").fill(CREDENTIALS["password"])
page.locator("#login-button").click()
return page
@pytest.fixture
def auth_page_with_cart(auth_page):
for product in PRODUCT_DATA.values():
add_button = auth_page.locator(product["btn_selectors"]["add_button"])
remove_button = auth_page.locator(product["btn_selectors"]["remove_button"])
add_button.click()
expect(remove_button).to_be_visible()
return auth_page