If you're having trouble recording videos of your tests in VS Code with Playwright, there could be a few reasons why.
First, make sure your Playwright configuration is correctly set up. Videos are turned off by default, so you need to explicitly set the video
option to 'on'
, 'retain-on-failure'
, or 'on-first-retry'
.
import { test, expect } from '@playwright/test';
test('basic test', async ({ page }) => {
await page.goto('https://ray.run/');
// your test code here
});
Next, ensure that browser contexts are properly closed at the end of each test. Videos are saved upon browser context closure. If a browser context is not closed manually using browserContext.close()
, then videos may not be recorded or saved.
await browserContext.close();
The default video size is the viewport size scaled down to fit 800x800 pixels. If necessary, adjust your desired video size by setting specific width and height values in your Playwright config file.
If you're testing multiple pages simultaneously, close both individual pages and browser contexts before attempting access via page.video().path()
. Videos will only become available after either page or browser context closure.
Lastly, make sure all dependencies and versions of Playwright libraries are up-to-date. If you've checked all these settings and you're still having issues, it might be worth looking for any conflicting configurations or extensions within VS Code itself.
If you still have questions, please ask a question and I will try to answer it.
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].