2023-04-17 12:01:41 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2023-05-05 11:03:36 +00:00
|
|
|
import { defineConfig, PlaywrightTestConfig } from '@playwright/test';
|
|
|
|
import { BASE_URL, STORAGE_STATE_PATH } from '@woocommerce/e2e-utils';
|
|
|
|
|
|
|
|
import { fileURLToPath } from 'url';
|
2023-04-17 12:01:41 +00:00
|
|
|
|
2023-11-28 19:16:25 +00:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
|
|
require( 'dotenv' ).config();
|
2023-04-17 12:01:41 +00:00
|
|
|
interface ExtendedPlaywrightTestConfig extends PlaywrightTestConfig {
|
|
|
|
use: {
|
|
|
|
stateDir?: string;
|
|
|
|
} & PlaywrightTestConfig[ 'use' ];
|
|
|
|
}
|
|
|
|
|
2023-05-05 11:03:36 +00:00
|
|
|
const { CI, DEFAULT_TIMEOUT_OVERRIDE, E2E_MAX_FAILURES } = process.env;
|
2023-04-17 12:01:41 +00:00
|
|
|
|
|
|
|
const config: ExtendedPlaywrightTestConfig = {
|
2024-03-06 16:52:37 +00:00
|
|
|
timeout: parseInt( DEFAULT_TIMEOUT_OVERRIDE || '', 10 ) || 100_000, // Defaults to 100s.
|
2023-12-15 17:34:29 +00:00
|
|
|
outputDir: 'artifacts/test-results',
|
2023-05-05 11:03:36 +00:00
|
|
|
globalSetup: fileURLToPath(
|
|
|
|
new URL( 'global-setup.ts', 'file:' + __filename ).href
|
|
|
|
),
|
2023-04-17 12:01:41 +00:00
|
|
|
globalTeardown: require.resolve( './global-teardown' ),
|
|
|
|
testDir: 'tests',
|
2023-05-05 11:03:36 +00:00
|
|
|
retries: CI ? 2 : 0,
|
2023-06-01 11:51:59 +00:00
|
|
|
workers: 1,
|
2024-03-07 11:57:48 +00:00
|
|
|
// Don't report slow test "files", as we're running our tests in serial.
|
|
|
|
reportSlowTests: null,
|
2023-06-01 11:51:59 +00:00
|
|
|
reporter: process.env.CI
|
|
|
|
? [ [ 'github' ], [ 'list' ], [ 'html' ] ]
|
|
|
|
: 'list',
|
2023-04-17 12:01:41 +00:00
|
|
|
maxFailures: E2E_MAX_FAILURES ? Number( E2E_MAX_FAILURES ) : 0,
|
2023-08-28 16:32:45 +00:00
|
|
|
snapshotPathTemplate:
|
|
|
|
'{testDir}/{testFileDir}/__screenshots__/{arg}{testName}{ext}',
|
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',
|
2023-08-08 16:58:12 +00:00
|
|
|
stateDir: 'tests/e2e/test-results/storage/',
|
2023-04-17 12:01:41 +00:00
|
|
|
trace: 'retain-on-failure',
|
|
|
|
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: [
|
|
|
|
{
|
2023-05-05 11:03:36 +00:00
|
|
|
name: 'blockThemeConfiguration',
|
2023-08-28 10:04:28 +00:00
|
|
|
testDir: '.',
|
2023-05-05 11:03:36 +00:00
|
|
|
testMatch: /block-theme.setup.ts/,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'blockTheme',
|
|
|
|
testMatch: /.*.block_theme.spec.ts/,
|
|
|
|
dependencies: [ 'blockThemeConfiguration' ],
|
|
|
|
},
|
2023-04-17 12:01:41 +00:00
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
export default defineConfig( config );
|