2024-04-02 10:13:06 +00:00
|
|
|
import { defineConfig, devices } from '@playwright/test';
|
2026-04-01 16:23:46 +00:00
|
|
|
import dotenv from 'dotenv';
|
2024-04-02 10:13:06 +00:00
|
|
|
|
2026-04-01 16:23:46 +00:00
|
|
|
dotenv.config({
|
|
|
|
|
path: ['./.env.local', './.env'],
|
|
|
|
|
quiet: true,
|
|
|
|
|
debug: !process.env.CI,
|
|
|
|
|
});
|
2024-04-02 10:13:06 +00:00
|
|
|
|
2026-04-01 16:23:46 +00:00
|
|
|
const PORT = process.env.PORT;
|
|
|
|
|
const baseURL = process.env.BASE_URL;
|
2024-04-02 10:13:06 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* See https://playwright.dev/docs/test-configuration.
|
|
|
|
|
*/
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
// Timeout per test
|
|
|
|
|
timeout: 30 * 1000,
|
|
|
|
|
testDir: './__tests__',
|
|
|
|
|
outputDir: './test-results',
|
|
|
|
|
|
|
|
|
|
/* Run tests in files in parallel */
|
|
|
|
|
fullyParallel: true,
|
|
|
|
|
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
|
|
|
forbidOnly: !!process.env.CI,
|
|
|
|
|
/* Retry on CI only */
|
|
|
|
|
retries: process.env.CI ? 2 : 0,
|
2024-12-17 09:32:12 +00:00
|
|
|
maxFailures: process.env.CI ? 3 : 0,
|
2024-04-02 10:13:06 +00:00
|
|
|
/* Opt out of parallel tests on CI. */
|
|
|
|
|
workers: process.env.CI ? 3 : undefined,
|
|
|
|
|
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
2026-04-01 16:23:46 +00:00
|
|
|
reporter: [
|
|
|
|
|
['html', { outputFolder: './report' }],
|
|
|
|
|
['list', { printSteps: true }],
|
|
|
|
|
],
|
2024-04-02 10:13:06 +00:00
|
|
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
|
|
|
use: {
|
2024-06-06 20:13:18 +00:00
|
|
|
baseURL,
|
2024-04-02 10:13:06 +00:00
|
|
|
|
|
|
|
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
|
|
|
trace: 'on-first-retry',
|
|
|
|
|
},
|
2026-04-01 16:23:46 +00:00
|
|
|
...(process.env.CI
|
|
|
|
|
? {}
|
|
|
|
|
: {
|
|
|
|
|
webServer: {
|
|
|
|
|
command: `cd ../.. && yarn app:dev --port ${PORT}`,
|
|
|
|
|
url: baseURL,
|
|
|
|
|
timeout: 120 * 1000,
|
|
|
|
|
reuseExistingServer: true,
|
|
|
|
|
},
|
|
|
|
|
}),
|
2025-02-19 11:50:51 +00:00
|
|
|
globalSetup: require.resolve('./__tests__/app-impress/auth.setup'),
|
2024-04-02 10:13:06 +00:00
|
|
|
/* Configure projects for major browsers */
|
|
|
|
|
projects: [
|
|
|
|
|
{
|
|
|
|
|
name: 'chromium',
|
2024-06-06 20:13:18 +00:00
|
|
|
use: {
|
|
|
|
|
...devices['Desktop Chrome'],
|
|
|
|
|
locale: 'en-US',
|
2024-07-10 11:03:42 +00:00
|
|
|
timezoneId: 'Europe/Paris',
|
2024-06-06 20:13:18 +00:00
|
|
|
storageState: 'playwright/.auth/user-chromium.json',
|
2024-09-06 16:03:30 +00:00
|
|
|
contextOptions: {
|
|
|
|
|
permissions: ['clipboard-read', 'clipboard-write'],
|
|
|
|
|
},
|
2024-06-06 20:13:18 +00:00
|
|
|
},
|
2024-04-02 10:13:06 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'webkit',
|
2024-06-06 20:13:18 +00:00
|
|
|
use: {
|
|
|
|
|
...devices['Desktop Safari'],
|
|
|
|
|
locale: 'en-US',
|
2024-07-10 11:03:42 +00:00
|
|
|
timezoneId: 'Europe/Paris',
|
2024-06-06 20:13:18 +00:00
|
|
|
storageState: 'playwright/.auth/user-webkit.json',
|
|
|
|
|
},
|
2024-04-02 10:13:06 +00:00
|
|
|
},
|
2024-08-19 13:38:21 +00:00
|
|
|
{
|
|
|
|
|
name: 'firefox',
|
|
|
|
|
use: {
|
|
|
|
|
...devices['Desktop Firefox'],
|
|
|
|
|
locale: 'en-US',
|
|
|
|
|
timezoneId: 'Europe/Paris',
|
|
|
|
|
storageState: 'playwright/.auth/user-firefox.json',
|
2024-09-06 16:03:30 +00:00
|
|
|
launchOptions: {
|
|
|
|
|
firefoxUserPrefs: {
|
|
|
|
|
'dom.events.asyncClipboard.readText': true,
|
|
|
|
|
'dom.events.testing.asyncClipboard': true,
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-08-19 13:38:21 +00:00
|
|
|
},
|
|
|
|
|
},
|
2024-04-02 10:13:06 +00:00
|
|
|
],
|
|
|
|
|
});
|