Skip to content

Commit

Permalink
chore(typo): fix browse to browser (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed Sep 29, 2020
1 parent 5b622e5 commit 16b4575
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ A separate Playwright context instance for each new test.

A separate Playwright page instance for each new test.

### `browse_type_launch_args` - session scope
### `browser_type_launch_args` - session scope

A fixture that you can define to overwrite the launch arguments for [`launch()`](https://playwright.dev/#path=docs%2Fapi.md&q=browsertypelaunchoptions). It should return a Dict.

### `browse_context_args` - session scope
### `browser_context_args` - session scope

A fixture that you can define to overwrite the context arguments for [`newContext()`](https://playwright.dev/#path=docs%2Fapi.md&q=browsernewcontextoptions). It should return a Dict.

Expand Down
12 changes: 6 additions & 6 deletions pytest_playwright/pytest_playwright.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,22 @@ def event_loop() -> Generator[AbstractEventLoop, None, None]:


@pytest.fixture(scope="session")
def browse_type_launch_args() -> Dict:
def browser_type_launch_args() -> Dict:
return {}


@pytest.fixture(scope="session")
def browse_context_args() -> Dict:
def browser_context_args() -> Dict:
return {}


@pytest.fixture(scope="session")
def launch_browser(
pytestconfig: Any, browse_type_launch_args: Dict, browser_name: str
pytestconfig: Any, browser_type_launch_args: Dict, browser_name: str
) -> Callable[..., Browser]:
def launch(**kwargs: Dict[Any, Any]) -> Browser:
headful_option = pytestconfig.getoption("--headful")
launch_options = {**browse_type_launch_args, **kwargs}
launch_options = {**browser_type_launch_args, **kwargs}
if headful_option:
launch_options["headless"] = False
pw_context = sync_playwright()
Expand All @@ -118,9 +118,9 @@ def browser(launch_browser: Callable[[], Browser]) -> Generator[Browser, None, N

@pytest.fixture
def context(
browser: Browser, browse_context_args: Dict
browser: Browser, browser_context_args: Dict
) -> Generator[BrowserContext, None, None]:
context = browser.newContext(**browse_context_args)
context = browser.newContext(**browser_context_args)
yield context
context.close()

Expand Down
6 changes: 3 additions & 3 deletions tests/test_playwright.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ def test_multiple_browsers(page):
result.assert_outcomes(passed=3)


def test_browse_context_args(testdir: Any) -> None:
def test_browser_context_args(testdir: Any) -> None:
testdir.makeconftest(
"""
import pytest
@pytest.fixture(scope="session")
def browse_context_args(request):
def browser_context_args(request):
return {"userAgent": "foobar"}
"""
)
testdir.makepyfile(
"""
def test_browse_context_args(page):
def test_browser_context_args(page):
assert page.evaluate("window.navigator.userAgent") == "foobar"
"""
)
Expand Down

0 comments on commit 16b4575

Please sign in to comment.