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 path from 'path';
|
|
|
|
|
|
|
|
import { fileURLToPath } from 'url';
|
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 = {
|
|
|
|
timeout: DEFAULT_TIMEOUT_OVERRIDE
|
|
|
|
? Number( DEFAULT_TIMEOUT_OVERRIDE )
|
|
|
|
: 90 * 1000,
|
|
|
|
expect: { timeout: 20 * 1000 },
|
2023-05-05 11:03:36 +00:00
|
|
|
outputDir: path.join( process.cwd(), 'artifacts/test-results' ),
|
|
|
|
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,
|
|
|
|
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,
|
|
|
|
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,
|
2023-04-17 12:01:41 +00:00
|
|
|
},
|
|
|
|
projects: [
|
|
|
|
{
|
2023-05-05 11:03:36 +00:00
|
|
|
name: 'blockThemeConfiguration',
|
|
|
|
testMatch: /block-theme.setup.ts/,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'blockTheme',
|
|
|
|
testMatch: /.*.block_theme.spec.ts/,
|
|
|
|
dependencies: [ 'blockThemeConfiguration' ],
|
|
|
|
},
|
2023-06-01 11:51:59 +00:00
|
|
|
{
|
|
|
|
name: 'blockThemeWithGlobalSideEffects',
|
|
|
|
testMatch: /.*.block_theme.side_effects.spec.ts/,
|
|
|
|
dependencies: [ 'blockTheme' ],
|
|
|
|
fullyParallel: false,
|
|
|
|
},
|
2023-05-05 11:03:36 +00:00
|
|
|
{
|
|
|
|
name: 'classicThemeConfiguration',
|
|
|
|
testMatch: /block-theme.setup.ts/,
|
2023-06-01 11:51:59 +00:00
|
|
|
dependencies: [ 'blockThemeWithGlobalSideEffects' ],
|
2023-05-05 11:03:36 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'classicTheme',
|
|
|
|
testMatch: /.*.classic_theme.spec.ts/,
|
|
|
|
dependencies: [ 'classicThemeConfiguration' ],
|
2023-04-17 12:01:41 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
export default defineConfig( config );
|