-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
39 lines (30 loc) · 967 Bytes
/
Copy pathconftest.py
File metadata and controls
39 lines (30 loc) · 967 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
31
32
33
34
35
36
37
38
39
import pytest
from playwright.sync_api import sync_playwright, expect
from pages.loginPage import LoginPage
@pytest.fixture(scope="session")
def playwright_instance():
with sync_playwright() as p:
yield p
@pytest.fixture(scope="session")
def browser(playwright_instance):
browser = playwright_instance.chromium.launch()
yield browser
browser.close()
@pytest.fixture
def context(browser):
context = browser.new_context()
yield context
context.close()
@pytest.fixture
def page(context):
page = context.new_page()
yield page
@pytest.fixture
def login_page(page):
login_page = LoginPage(page)
login_page.navigate('https://practicesoftwaretesting.com/')
expect(login_page.get_by_role("link", name="Practice Software Testing - Toolshop")).to_be_visible()
sign_in_link = login_page.get_by_role("link", name="Sign in")
expect(sign_in_link).to_be_visible()
sign_in_link.click()
yield login_page