Rayrun
← Back to Discord Forum

Playwright test videos

Hello, I'm running my playwright test locally with the following configuration, and I've enabled the video option and set it to "on," but even after running the test, I just see.png files under test-results, no videos have been generated. Is there something I'm overlooking in the configuration? Please assist.

import { devices } from '@playwright/test';
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('dotenv').config();

const config: PlaywrightTestConfig = {
  testDir: './playwright-tests',
  globalSetup: require.resolve('./global-setup'),
  use: {
    storageState: 'combinedStorageState.json',
    channel: 'chrome',
    headless: true,
    screenshot: 'on',
    video: 'retain-on-failure',
    launchOptions: {
      // slowMo: 1000
    },
  },
  timeout: 300 * 1000,
  expect: {
    timeout: 30000,
  },
  fullyParallel: false,
  forbidOnly: !!process.env.CI,
  retries: 0,
  workers: 1,
  reporter: [['json', {  outputFile: 'test-results.json' }]],

  projects: [
    {
      name: 'chromium',
      use: {
        ...devices['Desktop Chrome'],
      },
    },
  ],
};

export default config;
image.png

This thread is trying to answer question "Why are no videos being generated for Playwright tests despite enabling the video option?"

2 replies
tphillips8117

You've set it to 'retain-on-failure', did any of your tests fail?

vipinphogat

In addition to what @tphillips8117 have said in case if you are creating a context manually then you ll have to close the context and then only the video will be saved and attached to the report. Refer to following link for more details: https://playwright.dev/docs/videos

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].