Reputation: 3609
const app = await electron.launch({
args: ['--integration-testing'],
executablePath: AppPaths[process.platform],
bypassCSP: true,
env: {
CICD,
...process.env,
},
timeout: 100000,
recordVideo: { dir: '/home/ubuntu', size: { width: 1420, height: 850 } },
} as Parameters<typeof electron['launch']>[0]);
The problem with recording video is it is saved for every test case unnecessarily and occupies a lot of space.
Also, the recorded video saves in a directory without much provision of saving the file in appropriate test titles to refer to. So this becomes so difficult as it saves in random file format and is hard to debug.
We have the option of screenshots
Even that looks not configurable. And did not find any option to save the screenshots only on failure.
Looking forward to just screenshots to capture that too only during failure. Is it possible?
Upvotes: 0
Views: 874
Reputation: 633
You need to create a config file called playwright.config.ts with this content:
// playwright.config.ts
import { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
screenshot: 'only-on-failure',
video: 'retain-on-failure',
};
export default config
You can check the dicumentation here: https://playwright.dev/docs/test-configuration#record-video
Upvotes: 1