wordpress/tests/performance/playwright.config.js
Pascal Birchler 53b75a10fc Build/Test Tools: Overhaul performance tests to improve stability and cover more scenarios.
Simplifies the tests setup by leveraging a test matrix, improving maintenance and making it much easier to test more scenarios. With this change, tests are now also run with an external object cache (Memcached). Additional information such as memory usage and the number of database queries is now collected as well.

Improves test setup and cleanup by disabling external HTTP requests and cron for the tests, as well as deleting expired transients and flushing the cache in-between. This should aid the test stability.

When testing the previous commit / target branch, this now leverages the already built artifact from the build process workflow. Raw test results are now also uploaded as artifacts to aid debugging.

Props swissspidy, adamsilverstein, joemcgill, mukesh27, desrosj, youknowriad, flixos90.
Fixes #59900

git-svn-id: https://develop.svn.wordpress.org/trunk@58076 602fd350-edb4-49c9-b593-d223f7449a82
2024-05-02 13:57:49 +00:00

42 lines
1.0 KiB
JavaScript

/**
* External dependencies
*/
import path from 'node:path';
import { defineConfig } from '@playwright/test';
/**
* WordPress dependencies
*/
import baseConfig from '@wordpress/scripts/config/playwright.config';
process.env.WP_ARTIFACTS_PATH ??= path.join( process.cwd(), 'artifacts' );
process.env.STORAGE_STATE_PATH ??= path.join(
process.env.WP_ARTIFACTS_PATH,
'storage-states/admin.json'
);
process.env.TEST_RUNS ??= '20';
const config = defineConfig( {
...baseConfig,
globalSetup: require.resolve( './config/global-setup.js' ),
reporter: [ [ 'list' ], [ './config/performance-reporter.js' ] ],
forbidOnly: !! process.env.CI,
workers: 1,
retries: 0,
repeatEach: 2,
timeout: parseInt( process.env.TIMEOUT || '', 10 ) || 600_000, // Defaults to 10 minutes.
// Don't report slow test "files", as we will be running our tests in serial.
reportSlowTests: null,
preserveOutput: 'never',
webServer: {
...baseConfig.webServer,
command: 'npm run env:start',
},
use: {
...baseConfig.use,
video: 'off',
},
} );
export default config;