Skip to content

Playwright Video Recording Not Working Fix

DodaTech Updated 2026-06-24 2 min read

In this tutorial, you'll learn about Playwright Video Recording Not Working Fix. We cover key concepts, practical examples, and best practices.

Your Playwright test videos aren't being recorded — no video files are generated, or the video is empty.

The Problem

// WRONG — video not configured
import { test } from '@playwright/test';

test('login flow', async ({ page }) => {
  // Video not recording — no configuration set
});

No video files are created because video recording is off by default.

Step-by-Step Fix

1. Enable video in config

// RIGHT — playwright.config.ts
import { defineConfig } from '@playwright/test';

export default defineConfig({
  use: {
    video: 'on', // Record for all tests
  },
});

2. Choose recording mode

// RIGHT — different video modes
export default defineConfig({
  use: {
    // 'off' — no recording (default)
    // 'on' — record for all tests
    // 'retain-on-failure' — record, keep only on failure
    // 'on-first-retry' — record on first retry
    video: 'retain-on-failure',
  },
});

3. Enable video per test

// RIGHT — per-test video override
import { test } from '@playwright/test';

test.use({ video: 'on' });

test('record this test', async ({ page }) => {
  await page.goto('https://example.com');
  // This test will have a video recording
});

4. Configure video options

// RIGHT — video size and directory
export default defineConfig({
  use: {
    video: {
      mode: 'on',
      size: { width: 1280, height: 720 }, // Video resolution
    },
  },
  // Output directory for test artifacts
  outputDir: './test-results',
});

Expected output:

✓ login flow (1.5s) [video attached]

Video saved: test-results/login-flow/video.webm

Prevention Tips

  • Enable video in <a href="/testing-qa/playwright/">playwright</a>.config.ts with use.video
  • Use retain-on-failure to save disk space
  • Set video: 'on' per-test for specific scenarios
  • Configure outputDir for organized artifact storage
  • Clean up video files regularly to save disk space

Common Mistakes with video record

  1. Overlapping type class instances that cause GHC to reject the program with ambiguous dispatch errors
  2. Non-exhaustive pattern matches that compile with warnings then crash at runtime
  3. Misunderstanding that String is [Char] with poor performance for large text operations

These mistakes appear frequently in real-world PLAYWRIGHT code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### How do I view Playwright test videos?

Videos are saved as .webm files in the output directory. Open them in any browser or media player that supports WebM. In the HTML report, videos are embedded for easy viewing.

Do videos slow down test execution?

Slightly. Video recording adds overhead for encoding. The impact is minimal on modern hardware. Use retain-on-failure to avoid recording tests that pass.

Can I record videos in CI?

Yes. Videos work in headless mode. Save them as CI artifacts and download them to debug failures. Configure outputDir to a path that's easy to archive.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro