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,31 @@ 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" )
5151def browser_context_args (
52- browser_context_args : Dict , base_url : str , request : SubRequest
52+ browser_context_args : dict , base_url : str , request : SubRequest
5353):
5454 """This fixture allows setting browser context arguments for Playwright.
5555
5656 Args:
5757 browser_context_args (dict): Base browser context arguments.
5858 request (SubRequest): Pytest request object to get the 'browser_context_args' fixture value.
5959 base_url (str): The base URL for the application under test.
60+
6061 Returns:
6162 dict: Updated browser context arguments.
63+
6264 See Also:
6365 https://playwright.dev/python/docs/api/class-browser#browser-new-contex
6466
6567 Returns:
6668 dict: Updated browser context arguments.
69+
6770 """
6871 context_args = {
6972 ** browser_context_args ,
@@ -85,7 +88,7 @@ def browser_context_args(
8588
8689
8790@pytest .fixture (scope = "session" )
88- def browser_type_launch_args (browser_type_launch_args : Dict , playwright : Playwright ):
91+ def browser_type_launch_args (browser_type_launch_args : dict , playwright : Playwright ):
8992 """Fixture to set browser launch arguments.
9093
9194 This fixture updates the browser launch arguments to start the browser maximized
@@ -103,6 +106,7 @@ def browser_type_launch_args(browser_type_launch_args: Dict, playwright: Playwri
103106
104107 See Also:
105108 https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch
109+
106110 """
107111 playwright .selectors .set_test_id_attribute ("data-test" )
108112 return {** browser_type_launch_args , "args" : ["--start-maximized" ]}
@@ -113,6 +117,7 @@ def get_public_ip() -> str:
113117
114118 Returns:
115119 str: Public IP address.
120+
116121 """
117122 return requests .get (
118123 "http://checkip.amazonaws.com" ,
@@ -129,6 +134,7 @@ def attach_playwright_results(page: Page, request: FixtureRequest):
129134 Args:
130135 page (Page): Playwright page object.
131136 request: Pytest request object.
137+
132138 """
133139 yield
134140 if request .node .rep_call .failed :
@@ -158,6 +164,7 @@ def pytest_runtest_makereport(item: Item):
158164
159165 Yields:
160166 Outcome of the test execution.
167+
161168 """
162169 outcome = yield
163170 rep = outcome .get_result ()
0 commit comments