2021-09-13 22:05:38 +02:00
|
|
|
// @ts-check
|
|
|
|
const { devices } = require('@playwright/test');
|
2021-10-13 17:33:44 -04:00
|
|
|
const path = require('path');
|
2021-09-13 22:05:38 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @see https://playwright.dev/docs/test-configuration
|
2021-10-13 17:33:44 -04:00
|
|
|
* @type {import('@playwright/test').PlaywrightTestConfig}
|
2021-09-15 22:07:50 +02:00
|
|
|
*/
|
2021-09-13 22:05:38 +02:00
|
|
|
const config = {
|
2021-09-15 22:07:50 +02:00
|
|
|
// Timeout per test
|
2021-09-13 22:05:38 +02:00
|
|
|
timeout: 30 * 1000,
|
2021-09-15 22:07:50 +02:00
|
|
|
// Test directory
|
2021-09-13 22:05:38 +02:00
|
|
|
testDir: path.join(__dirname, '{{testDir}}'),
|
2021-10-07 21:21:56 +02:00
|
|
|
// If a test fails on CI, retry it additional 2 times
|
|
|
|
retries: process.env.CI ? 2 : 0,
|
2021-09-15 22:07:50 +02:00
|
|
|
// Artifacts folder where screenshots, videos, and traces are stored.
|
|
|
|
outputDir: 'test-results/',
|
2021-09-13 22:05:38 +02:00
|
|
|
|
|
|
|
// Run your local dev server before starting the tests:
|
|
|
|
// https://playwright.dev/docs/test-advanced#launching-a-development-web-server-during-the-tests
|
|
|
|
// webServer: {
|
|
|
|
// command: 'npm run start',
|
|
|
|
// port: 3000,
|
|
|
|
// },
|
|
|
|
|
2021-09-15 22:07:50 +02:00
|
|
|
use: {
|
|
|
|
// Retry a test if its failing with enabled tracing. This allows you to analyse the DOM, console logs, network traffic etc.
|
|
|
|
// More information: https://playwright.dev/docs/trace-viewer
|
2021-10-07 21:21:56 +02:00
|
|
|
trace: 'on-first-retry',
|
2021-09-15 22:07:50 +02:00
|
|
|
|
|
|
|
// All available context options: https://playwright.dev/docs/api/class-browser#browser-new-context
|
|
|
|
contextOptions: {
|
|
|
|
ignoreHTTPSErrors: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2021-09-13 22:05:38 +02:00
|
|
|
projects: [
|
|
|
|
{
|
2021-09-14 13:14:43 +02:00
|
|
|
name: 'Desktop Chrome',
|
2021-09-13 22:05:38 +02:00
|
|
|
use: {
|
2021-09-14 13:14:43 +02:00
|
|
|
...devices['Desktop Chrome'],
|
2021-09-15 22:07:50 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Desktop Firefox',
|
|
|
|
use: {
|
|
|
|
...devices['Desktop Firefox'],
|
2021-09-13 22:05:38 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Desktop Safari',
|
|
|
|
use: {
|
2021-09-15 22:07:50 +02:00
|
|
|
...devices['Desktop Safari'],
|
|
|
|
},
|
2021-09-13 22:05:38 +02:00
|
|
|
},
|
|
|
|
// Test against mobile viewports.
|
|
|
|
{
|
|
|
|
name: 'Mobile Chrome',
|
2021-09-15 22:07:50 +02:00
|
|
|
use: {
|
|
|
|
...devices['Pixel 5'],
|
|
|
|
},
|
2021-09-13 22:05:38 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Mobile Safari',
|
|
|
|
use: devices['iPhone 12'],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
2021-09-14 13:14:43 +02:00
|
|
|
module.exports = config;
|