|
6 | 6 | from _pytest.fixtures import FixtureRequest, SubRequest
|
7 | 7 | from _pytest.nodes import Item
|
8 | 8 | from axe_playwright_python.sync_playwright import Axe
|
9 |
| -from playwright.sync_api import Page |
| 9 | +from playwright.sync_api import Page, Playwright |
10 | 10 |
|
11 | 11 | from utilities.axe_helper import AxeHelper
|
12 | 12 | from utilities.constants import Constants
|
@@ -85,17 +85,26 @@ def browser_context_args(
|
85 | 85 |
|
86 | 86 |
|
87 | 87 | @pytest.fixture(scope="session")
|
88 |
| -def browser_type_launch_args(browser_type_launch_args: Dict): |
| 88 | +def browser_type_launch_args(browser_type_launch_args: Dict, playwright: Playwright): |
89 | 89 | """Fixture to set browser launch arguments.
|
90 | 90 |
|
| 91 | + This fixture updates the browser launch arguments to start the browser maximized |
| 92 | + and sets the test ID attribute for selectors. |
| 93 | +
|
91 | 94 | Args:
|
92 |
| - browser_type_launch_args (dict): Browser type launch arguments. |
| 95 | + browser_type_launch_args (Dict): Original browser type launch arguments. |
| 96 | + playwright (Playwright): The Playwright instance. |
93 | 97 |
|
94 | 98 | Returns:
|
95 |
| - dict: Updated browser type launch arguments. |
| 99 | + Dict: Updated browser type launch arguments with maximized window setting. |
| 100 | +
|
| 101 | + Note: |
| 102 | + This fixture has a session scope, meaning it will be executed once per test session. |
| 103 | +
|
96 | 104 | See Also:
|
97 | 105 | https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch
|
98 | 106 | """
|
| 107 | + playwright.selectors.set_test_id_attribute("data-test") |
99 | 108 | return {**browser_type_launch_args, "args": ["--start-maximized"]}
|
100 | 109 |
|
101 | 110 |
|
|
0 commit comments