Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug performance tests issues #48208

Closed
wants to merge 13 commits into from
8 changes: 8 additions & 0 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ jobs:
WP_MAJOR="${WP_VERSION_ARRAY[0]}.${WP_VERSION_ARRAY[1]}"
./bin/plugin/cli.js perf $GITHUB_SHA debd225d007f4e441ceec80fbd6fa96653f94737 --tests-branch $GITHUB_SHA --wp-version "$WP_MAJOR"

- name: Archive debug artifacts (screenshots, traces)
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: always()
with:
name: perf-failures-artifacts
path: ./__test-results/artifacts
if-no-files-found: ignore

- uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
if: github.event_name == 'push'
id: commit-timestamp
Expand Down
52 changes: 34 additions & 18 deletions bin/plugin/commands/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,23 +200,39 @@ function curateResults( testSuite, results ) {
* @return {Promise<WPPerformanceResults>} Performance results for the branch.
*/
async function runTestSuite( testSuite, performanceTestDirectory, runKey ) {
await runShellScript(
`npm run test:performance -- packages/e2e-tests/specs/performance/${ testSuite }.test.js`,
performanceTestDirectory
);
const resultsFile = path.join(
performanceTestDirectory,
`packages/e2e-tests/specs/performance/${ testSuite }.test.results.json`
);
fs.mkdirSync( './__test-results', { recursive: true } );
fs.copyFileSync( resultsFile, `./__test-results/${ runKey }.results.json` );
const rawResults = await readJSONFile(
path.join(
try {
await runShellScript(
`npm run test:performance -- packages/e2e-tests/specs/performance/${ testSuite }.test.js`,
performanceTestDirectory
);
const resultsFile = path.join(
performanceTestDirectory,
`packages/e2e-tests/specs/performance/${ testSuite }.test.results.json`
)
);
return curateResults( testSuite, rawResults );
);
fs.mkdirSync( './__test-results', { recursive: true } );
fs.copyFileSync(
resultsFile,
`./__test-results/${ runKey }.results.json`
);
const rawResults = await readJSONFile(
path.join(
performanceTestDirectory,
`packages/e2e-tests/specs/performance/${ testSuite }.test.results.json`
)
);
return curateResults( testSuite, rawResults );
} catch ( error ) {
fs.mkdirSync( './__test-results/artifacts', { recursive: true } );
const artifactsFolder = path.join(
performanceTestDirectory,
'artifacts'
);
await runShellScript(
'cp -Rv ' + artifactsFolder + ' ' + './__test-results/artifacts'
);

throw error;
}
}

/**
Expand Down Expand Up @@ -388,10 +404,10 @@ async function runPerformanceTests( branches, options ) {
log( '\n>> Running the tests' );

const testSuites = [
'post-editor',
// 'post-editor',
'site-editor',
'front-end-classic-theme',
'front-end-block-theme',
// 'front-end-classic-theme',
// 'front-end-block-theme',
];

/** @type {Record<string,Record<string, WPPerformanceResults>>} */
Expand Down
5 changes: 5 additions & 0 deletions packages/e2e-test-utils/src/site-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,9 @@ export async function enterEditMode() {
return;
}
await canvas().click( 'body' );

await page.waitForSelector(
'[role="region"][aria-label="Navigation sidebar"]',
{ hidden: true }
);
}
Loading