mirror of
git://develop.git.wordpress.org/
synced 2025-02-22 15:42:29 +01:00
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
39 lines
906 B
JavaScript
39 lines
906 B
JavaScript
/**
|
|
* External dependencies
|
|
*/
|
|
import { request } from '@playwright/test';
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
import { RequestUtils } from '@wordpress/e2e-test-utils-playwright';
|
|
|
|
/**
|
|
*
|
|
* @param {import('@playwright/test').FullConfig} config
|
|
* @returns {Promise<void>}
|
|
*/
|
|
async function globalSetup( config ) {
|
|
const { storageState, baseURL } = config.projects[ 0 ].use;
|
|
const storageStatePath =
|
|
typeof storageState === 'string' ? storageState : undefined;
|
|
|
|
const requestContext = await request.newContext( {
|
|
baseURL,
|
|
} );
|
|
|
|
const requestUtils = new RequestUtils( requestContext, {
|
|
storageStatePath,
|
|
} );
|
|
|
|
// Authenticate and save the storageState to disk.
|
|
await requestUtils.setupRest();
|
|
|
|
// Reset the test environment before running the tests.
|
|
await Promise.all( [ requestUtils.activateTheme( 'twentytwentyone' ) ] );
|
|
|
|
await requestContext.dispose();
|
|
}
|
|
|
|
export default globalSetup;
|