question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Videos are not generated when reusing a single page between tests

See original GitHub issue

Context:

  • 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:

2022-06-13_09-09-29

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:12
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
KeionneDeroussellecommented, Aug 30, 2022

I’m having the same issue as @mweidner037. I use storageState and create pages from browser.newContext({ storageState: ... }). I’m trying to take retain videos on failure, but I’m not seeing any video recordings when my tests fail.

4reactions
mweidner037commented, Aug 8, 2022

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 call browser.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 emulate video: 'retain-on-failure'.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found