2023-04-17 12:01:41 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2023-05-05 11:03:36 +00:00
|
|
|
import { fileURLToPath } from 'url';
|
2024-05-13 12:58:26 +00:00
|
|
|
import { BASE_URL, STORAGE_STATE_PATH } from '@woocommerce/e2e-utils';
|
|
|
|
import { PlaywrightTestConfig, defineConfig, devices } from '@playwright/test';
|
2023-04-17 12:01:41 +00:00
|
|
|
|
2024-05-13 12:58:26 +00:00
|
|
|
const { CI, DEFAULT_TIMEOUT_OVERRIDE } = process.env;
|
2023-04-17 12:01:41 +00:00
|
|
|
|
2024-05-13 12:58:26 +00:00
|
|
|
const config: PlaywrightTestConfig = {
|
2024-07-11 18:14:14 +00:00
|
|
|
maxFailures: CI ? 30 : 0,
|
2024-03-06 16:52:37 +00:00
|
|
|
timeout: parseInt( DEFAULT_TIMEOUT_OVERRIDE || '', 10 ) || 100_000, // Defaults to 100s.
|
2024-06-11 16:57:23 +00:00
|
|
|
outputDir: `${ __dirname }/artifacts/test-results`,
|
2023-05-05 11:03:36 +00:00
|
|
|
globalSetup: fileURLToPath(
|
|
|
|
new URL( 'global-setup.ts', 'file:' + __filename ).href
|
|
|
|
),
|
2024-05-13 12:58:26 +00:00
|
|
|
testDir: './tests',
|
2024-07-11 18:14:14 +00:00
|
|
|
retries: CI ? 1 : 0,
|
2023-06-01 11:51:59 +00:00
|
|
|
workers: 1,
|
2024-07-11 10:21:59 +00:00
|
|
|
reportSlowTests: { max: 5, threshold: 30 * 1000 }, // 30 seconds threshold
|
2024-05-13 12:58:26 +00:00
|
|
|
fullyParallel: false,
|
2024-05-14 08:23:17 +00:00
|
|
|
forbidOnly: !! CI,
|
2024-06-05 14:19:28 +00:00
|
|
|
reporter: process.env.CI
|
2024-07-08 12:02:31 +00:00
|
|
|
? [
|
|
|
|
[ 'list' ],
|
|
|
|
[ './flaky-tests-reporter.ts' ],
|
|
|
|
[
|
|
|
|
'allure-playwright',
|
|
|
|
{
|
|
|
|
outputFolder: `${ __dirname }/artifacts/test-results/allure-results`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
]
|
2024-06-05 14:19:28 +00:00
|
|
|
: 'list',
|
2023-04-17 12:01:41 +00:00
|
|
|
use: {
|
2023-05-05 11:03:36 +00:00
|
|
|
baseURL: BASE_URL,
|
2023-04-17 12:01:41 +00:00
|
|
|
screenshot: 'only-on-failure',
|
2024-07-11 18:14:14 +00:00
|
|
|
trace:
|
|
|
|
/^https?:\/\/localhost/.test( BASE_URL ) || ! CI
|
|
|
|
? 'retain-on-first-failure'
|
|
|
|
: 'off',
|
2023-04-17 12:01:41 +00:00
|
|
|
video: 'on-first-retry',
|
|
|
|
viewport: { width: 1280, height: 720 },
|
2023-05-05 11:03:36 +00:00
|
|
|
storageState: STORAGE_STATE_PATH,
|
2024-03-06 16:52:37 +00:00
|
|
|
actionTimeout: 10_000,
|
2024-03-27 09:54:44 +00:00
|
|
|
navigationTimeout: 10_000,
|
2023-04-17 12:01:41 +00:00
|
|
|
},
|
|
|
|
projects: [
|
|
|
|
{
|
2024-05-13 12:58:26 +00:00
|
|
|
name: 'chromium',
|
|
|
|
use: { ...devices[ 'Desktop Chrome' ] },
|
2023-05-05 11:03:36 +00:00
|
|
|
},
|
2023-04-17 12:01:41 +00:00
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
export default defineConfig( config );
|