[BUG] Videos are not generated when reusing a single page between tests
See original GitHub issueContext:
- Playwright Version: 1.22.2
- Operating System: Windows 11
- Node.js version: v 17.7.1
- Browser: chromium
- Extra: [any specific details about your environment]
System:
- OS: Windows 10 10.0.22000
- Memory: 1.24 GB / 15.79 GB
Binaries:
- Node: 17.7.1 - C:\Program Files\nodejs\node.EXE
- Yarn: 1.22.17 - C:\Program Files\nodejs\yarn.CMD
- npm: 8.5.2 - C:\Program Files\nodejs\npm.CMD
Languages:
- Bash: 5.0.17 - C:\Windows\system32\bash.EXE
Code Snippet playwright.config.ts
const config: PlaywrightTestConfig = {
reporter: [['dot'],['html']],
use: {
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
video:'retain-on-failure',
},
};
export default config;
broke.spec.ts (sourced from https://playwright.dev/docs/test-retries#reuse-single-page-between-tests)
import { test, Page } from '@playwright/test';
test.describe.configure({ mode: 'serial' });
let page: Page;
test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
});
test.afterAll(async () => {
await page.close();
});
test('a failing test', async () => {
await page.click('text=Get Started fail', {timeout: 1000}); // << deliberate fail
});
Describe the bug
Videos are not generated when reusing a single page between tests
Set the following configuration:
use: {
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
video:'retain-on-failure',
},
Run a failing test
Expected Result:
The spec above should successfully generate a screenshot, test steps, trace file and a video within the HTML result.
Actual Result:
The video is not being generated:
Issue Analytics
- State:
- Created a year ago
- Reactions:12
- Comments:10 (1 by maintainers)
Top Results From Across the Web
How to reuse the same page context in different tests ...
My aim is to execute the tests in a specified order using a single worker. A series of different tests that launch in...
Read more >Top 18 Most Common AngularJS Developer Mistakes - Toptal
Single page apps demand the front-end developers to become better software engineers. ... Tests will not make your code free of AngularJS error...
Read more >Writing Your First E2E Test - Cypress Documentation
What you'll learn How to start testing a new project in Cypress. What passing and failing tests look like. Testing web navigation, DOM...
Read more >Advanced Specflow Shared & Scoped Bindings, Hooks and ...
Separation of concerns – test context is different from the actual test code. Reuse of context across bindings. Leads to better modular design....
Read more >Best Practices | Basic Guides | Guides | Docs - TestCafe
E2E Test Scope; Smart Assertions; Use of Page Objects ... to unit or integration tests, which focus on a specific part (or integration...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m having the same issue as @mweidner037. I use
storageState
and create pages frombrowser.newContext({ storageState: ... })
. I’m trying to take retain videos on failure, but I’m not seeing any video recordings when my tests fail.I’m also running into this issue - specifically, that video recording doesn’t work in pages created with
brower.newContext
, as described here.My use case: I’m using
storageState
for authentication, as described in the docs, except that I only want to use it for some tests. So when I need it, I callbrowser.newContext({ storageState: ... })
. But then pages created from that context don’t get video recordings.For now I plan to use the
recordVideo
option and manual file manipulation to emulatevideo: 'retain-on-failure'
.