Skip to content

Commit

Permalink
tmp: Compare Puppeteer vs. Playwright in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
WunderBart committed Jun 16, 2023
1 parent 5412032 commit 875a4f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

- name: Compare performance with trunk
if: github.event_name == 'pull_request'
run: ./bin/plugin/cli.js perf $GITHUB_SHA trunk --tests-branch $GITHUB_SHA
run: ./bin/plugin/cli.js perf trunk-playwright trunk-puppeteer --tests-branch refactor/playwright-performance-tests

- name: Compare performance with current WordPress Core and previous Gutenberg versions
if: github.event_name == 'release'
Expand Down
14 changes: 11 additions & 3 deletions bin/plugin/commands/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,20 @@ function curateResults( testSuite, results ) {
* @param {string} testSuite Name of the tests set.
* @param {string} performanceTestDirectory Path to the performance tests' clone.
* @param {string} runKey Unique identifier for the test run, e.g. `branch-name_post-editor_run-3`.
* @param {string} framework Framework to be used by the test.
*
* @return {Promise<WPPerformanceResults>} Performance results for the branch.
*/
async function runTestSuite( testSuite, performanceTestDirectory, runKey ) {
async function runTestSuite(
testSuite,
performanceTestDirectory,
runKey,
framework
) {
const resultsFilename = `${ runKey }.performance-results.json`;

await runShellScript(
`npm run test:performance -- ${ testSuite }`,
`npm run test:performance:${ framework } -- ${ testSuite }`,
performanceTestDirectory,
{
...process.env,
Expand Down Expand Up @@ -431,6 +437,7 @@ async function runPerformanceTests( branches, options ) {
rawResults[ i ] = {};
for ( const branch of branches ) {
const sanitizedBranch = sanitizeBranchName( branch );
const framework = branch.split( '-' )[ 1 ];
const runKey = `${ testSuite }_${ sanitizedBranch }_run-${ i }`;
// @ts-ignore
const environmentDirectory = branchDirectories[ branch ];
Expand All @@ -444,7 +451,8 @@ async function runPerformanceTests( branches, options ) {
rawResults[ i ][ branch ] = await runTestSuite(
testSuite,
performanceTestDirectory,
runKey
runKey,
framework
);
log( ' >> Stopping the environment' );
await runShellScript(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@
"test:e2e:playwright": "playwright test --config test/e2e/playwright.config.ts",
"test:e2e:storybook": "playwright test --config test/storybook-playwright/playwright.config.ts",
"test:e2e:watch": "npm run test:e2e -- --watch",
"test:performance": "playwright test --config test/performance/playwright.config.ts",
"test:performance:puppeteer": "wp-scripts test-e2e --config packages/e2e-tests/jest.performance.config.js",
"test:performance:playwright": "playwright test --config test/performance/playwright.config.ts",
"test:performance:debug": "wp-scripts --inspect-brk test-e2e --runInBand --no-cache --verbose --config packages/e2e-tests/jest.performance.config.js --puppeteer-devtools",
"test:php": "npm-run-all lint:php test:unit:php",
Expand Down

0 comments on commit 875a4f1

Please sign in to comment.