-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
26 lines (20 loc) · 718 Bytes
/
Copy pathconftest.py
File metadata and controls
26 lines (20 loc) · 718 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
from __future__ import annotations
from typing import Generator
import pytest
from playwright.sync_api import sync_playwright, Browser, BrowserContext, Page
@pytest.fixture(scope="session")
def browser() -> Generator[Browser, None, None]:
with sync_playwright() as pw:
browser: Browser = pw.chromium.launch(headless=True)
yield browser
browser.close()
@pytest.fixture()
def context(browser: Browser) -> Generator[BrowserContext, None, None]:
context: BrowserContext = browser.new_context()
yield context
context.close()
@pytest.fixture()
def page(context: BrowserContext) -> Generator[Page, None, None]:
page: Page = context.new_page()
yield page
page.close()