microsoft / microsoft/playwright

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

Open
#14,813 76 comments 95 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-test-runner feature-video
Dominant language
TypeScript
Stars
96.3k
Forks
6.5k
Avg merge
1d 6h
Merged PRs (30d)
180

Description

**Note from maintainers**

As a workaround, we recommend [recording a trace](https://playwright.dev/docs/trace-viewer-intro) instead of a video. This will also give you much better debugging experience.

---

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

```javascript
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)

```javascript
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:
```javascript
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](https://user-images.githubusercontent.com/50574915/173257532-da639abd-ec14-4901-996d-ed8e5af25f7e.png)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the reproduction in broke.spec.ts with the settings from playwright.config.ts and verify which artifacts are produced. Compare the expected screenshot, steps, trace, and video with the actual HTML result; done means the reused-page failure produces the missing video as well.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.