playwright: [BUG] Some config options are working only partially when using browser.newContext()
Context:
- Playwright Version: 1.14.1
- Operating System: Linux
- Node.js version: v14.16.0
- Browser: chromium
Code Snippet
- Clone this repo: https://github.com/xrash/pwt-config-issue-example
- Run
yarn - Run
npx playwright test - The directory
test-resultswill be created with partial output - Open
playwright.config.tsand remove theuseoption altogether - Run
npx playwright testagain - The directory
test-resultswon’t even be created this time
Describe the bug
The fixture options under use at the config file are working only partially when creating a new context manually (browser.newContext()).
For instance, trace and screenshot work, but video doesn’t record any video at all. Also, trace doesn’t fully work, as trace is recorded per test even when the context is created in beforeAll or in a worker-scoped fixture (desired behavior is to have the trace for the entire context session in one file). Also, the trace file seems buggy or incomplete.
If the fixture options under use in the config file aren’t supposed to work when using browser.newContext(), then I’d expect it not to work at all, instead of having them to work only partially; and if it’s supposed to work, then I’d expect it to work fully.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 8
- Comments: 16 (10 by maintainers)
To reiterate, we do not suggest reusing the context, but rather reusing the browser (that happens automatically). However, if you’d really like to reuse page/context, take a look at this doc.
@spaniardmaximus Playwright Test starts a single browser per worker, shared by many tests, out of the box. However, creating a new
BrowserContextper test is cheap and gives test isolation. I suggest to try the default way first before you hit any performance issues. You can read more about contexts and isolation here.We are facing the same issue . Has anyone found a work around to only record video on failure on newContext. Able to record video by passing recordVideo Object on newContext await browser.newContext({storageState: storageState,recordVideo: {dir: ‘videos/’}}) .But I believe it has no association with config