Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs(python): add docs for new_context fixture (#30522)

Max Schmitt1b7e097b68cd
diff --git a/docs/src/test-runners-python.md b/docs/src/test-runners-python.md
index 0e3ffde0dd..0ad4043066 100644
--- a/docs/src/test-runners-python.md
+++ b/docs/src/test-runners-python.md
@@ -55,6 +55,7 @@ def test_my_app_is_working(fixture_name):
- `context`: New [browser context](./browser-contexts) for a test.
- `page`: New [browser page](./pages) for a test.
+- `new_context`: Allows creating different [browser contexts](./browser-contexts) for a test. Useful for multi-user scenarios. Accepts the same parameters as [`method: Browser.newContext`].
**Session scope**: These fixtures are created when requested in a test function and destroyed when all tests end.
@@ -211,30 +212,6 @@ def browser_context_args(browser_context_args, playwright):
Or via the CLI `--device="iPhone 11 Pro"`
-### Persistent context
-
-```py title="conftest.py"
-import pytest
-from playwright.sync_api import BrowserType
-from typing import Dict
-
[email protected](scope="session")
-def context(
- browser_type: BrowserType,
- browser_type_launch_args: Dict,
- browser_context_args: Dict
-):
- context = browser_type.launch_persistent_context("./foobar", **{
- **browser_type_launch_args,
- **browser_context_args,
- "locale": "de-DE",
- })
- yield context
- context.close()
-```
-
-When using that all pages inside your test are created from the persistent context.
-
### Using with `unittest.TestCase`
See the following example for using it with `unittest.TestCase`. This has a limitation,