1- from typing import Dict
2-
31import allure
42import pytest
53import requests
@@ -27,6 +25,7 @@ def goto(page: Page, request: SubRequest):
2725
2826 Example:
2927 @pytest.mark.parametrize('browser_context_args', ["standard_user"], indirect=True)
28+
3029 """
3130 if request.getfixturevalue("browser_context_args").get("storage_state"):
3231 page.goto("/inventory.html")
@@ -43,27 +42,29 @@ def axe_playwright():
4342
4443 Returns:
4544 AxeHelper: An instance of AxeHelper with Axe initialized.
45+
4646 """
47- yield AxeHelper(Axe())
47+ return AxeHelper(Axe())
4848
4949
5050@pytest.fixture(scope="function")
51- def browser_context_args(
52- browser_context_args: Dict, base_url: str, request: SubRequest
53- ):
51+ def browser_context_args(browser_context_args: dict, base_url: str, request: SubRequest) -> dict:
5452 """This fixture allows setting browser context arguments for Playwright.
5553
5654 Args:
5755 browser_context_args (dict): Base browser context arguments.
5856 request (SubRequest): Pytest request object to get the 'browser_context_args' fixture value.
5957 base_url (str): The base URL for the application under test.
58+
6059 Returns:
6160 dict: Updated browser context arguments.
61+
6262 See Also:
6363 https://playwright.dev/python/docs/api/class-browser#browser-new-contex
6464
6565 Returns:
6666 dict: Updated browser context arguments.
67+
6768 """
6869 context_args = {
6970 **browser_context_args,
@@ -85,7 +86,7 @@ def browser_context_args(
8586
8687
8788@pytest.fixture(scope="session")
88- def browser_type_launch_args(browser_type_launch_args: Dict , playwright: Playwright):
89+ def browser_type_launch_args(browser_type_launch_args: dict , playwright: Playwright) -> dict :
8990 """Fixture to set browser launch arguments.
9091
9192 This fixture updates the browser launch arguments to start the browser maximized
@@ -103,6 +104,7 @@ def browser_type_launch_args(browser_type_launch_args: Dict, playwright: Playwri
103104
104105 See Also:
105106 https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch
107+
106108 """
107109 playwright.selectors.set_test_id_attribute("data-test")
108110 return {**browser_type_launch_args, "args": ["--start-maximized"]}
@@ -113,6 +115,7 @@ def get_public_ip() -> str:
113115
114116 Returns:
115117 str: Public IP address.
118+
116119 """
117120 return requests.get(
118121 "http://checkip.amazonaws.com",
@@ -129,6 +132,7 @@ def attach_playwright_results(page: Page, request: FixtureRequest):
129132 Args:
130133 page (Page): Playwright page object.
131134 request: Pytest request object.
135+
132136 """
133137 yield
134138 if request.node.rep_call.failed:
@@ -158,6 +162,7 @@ def pytest_runtest_makereport(item: Item):
158162
159163 Yields:
160164 Outcome of the test execution.
165+
161166 """
162167 outcome = yield
163168 rep = outcome.get_result()
0 commit comments