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-04-17 12:01:41 +00:00
|
|
|
workers: 4,
|
|
|
|
fullyParallel: true,
|
2023-05-05 11:03:36 +00:00
|
|
|
reporter: process.env.CI ? [ [ 'github' ], [ 'list' ] ] : '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',
|
|
|
|
stateDir: './tests/e2e-pw/test-results/storage/',
|
|
|
|
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' ],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'classicThemeConfiguration',
|
|
|
|
testMatch: /block-theme.setup.ts/,
|
|
|
|
dependencies: [ 'blockTheme' ],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'classicTheme',
|
|
|
|
testMatch: /.*.classic_theme.spec.ts/,
|
|
|
|
dependencies: [ 'classicThemeConfiguration' ],
|
2023-04-17 12:01:41 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
export default defineConfig( config );
|