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

fix e2e test flakiness due to workshop page fixture #9288

Merged
merged 16 commits into from
Oct 18, 2024

Conversation

fungairino
Copy link
Collaborator

@fungairino fungairino commented Oct 16, 2024

What does this PR do?

Discussion

  • I have a theory that this might be caused by mishandling concurrent network requests where one might be aborted. According to the trace, we abort a request to GET /api/bricks loading the workshop page at the same time as we load the mod activation page.
    • This didn't seem to be exactly the case, but I was able to resolve the flakiness by avoiding loading the workshop page fixture at the beginning of the test alongside the other extension console page.

Screenshot 2024-10-16 at 2 55 21 PM

Checklist

Leave all that are relevant and check off as completed

  • This PR requires a security review
  • This PR introduces a new library: double check it's MIT/Apache2/permissively licensed
  • This PR requires a node/npm version update: let the team know on #engineering
  • This PR requires a documentation change (link to old docs)
  • This PR requires a tutorial update (link to old tutorials)
  • This PR requires a feature flag
  • This PR requires a environment variable change
  • Added jest or playwright tests and/or storybook stories

For more information on our expectations for the PR process, see the
code review principles doc

@fungairino fungairino self-assigned this Oct 16, 2024
@fungairino fungairino marked this pull request as ready for review October 16, 2024 19:00
Copy link

codecov bot commented Oct 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.23%. Comparing base (8318d74) to head (41e4553).
Report is 382 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9288      +/-   ##
==========================================
+ Coverage   74.24%   75.23%   +0.98%     
==========================================
  Files        1332     1363      +31     
  Lines       40817    42085    +1268     
  Branches     7634     7834     +200     
==========================================
+ Hits        30306    31661    +1355     
+ Misses      10511    10424      -87     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Oct 16, 2024

Playwright test results

passed  139 passed
flaky  1 flaky
skipped  2 skipped

Details

report  Open report ↗︎
stats  142 tests across 46 suites
duration  10 minutes, 2 seconds
commit  41e4553
info  For more information on how to debug and view this report, see our readme

Flaky tests

chrome › tests/extensionConsole/activation.spec.ts › can activate a mod with built-in integration

Skipped tests

chrome › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options
msedge › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options

@fungairino
Copy link
Collaborator Author

My guess unfortunately was not right, but I'm trying making some slight tweaks to visibility checks in fixtures

@@ -70,7 +70,6 @@ export const test = pageContextFixture.extend<{
async _workshopPage({ context, extensionId }, use) {
const newPage = await context.newPage();
const workshopPage = new WorkshopPage(newPage, extensionId);
await workshopPage.goto();
Copy link
Collaborator Author

@fungairino fungairino Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we navigate and refresh the workshop each time we need to use it, we don't initially need to load it. Avoiding this goto avoids some weird behavior we are observing when we load the extension console twice in quick succession

Comment on lines +173 to +183
await expect(async () => {
await this.getByRole("heading", { name: "Activate " }).waitFor({
timeout: 10_000,
});
try {
await this.getByText(this.modId).waitFor({ timeout: 10_000 });
} catch (error) {
await this.page.reload();
throw error;
}
}).toPass({ timeout: 30_000 });
Copy link
Collaborator Author

@fungairino fungairino Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not actually sure we need this additional handling any more... I added this when I was seeing issues loading the activation page where the page actually just crashed, but not seeing that any more with the changes to the workshop page fixture

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reload cycle will happen ever 10s, so I'd be in favor of removing if you don't think it's needed especially w.r.t. this being on a POM

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try this in the follow-up right after this is merged

Comment on lines -91 to -95
test.fixme(
process.env.GITHUB_WORKFLOW === PRE_RELEASE_BROWSER_WORKFLOW_NAME &&
isMsEdge(chromiumChannel),
"Skipping test for MS Edge in pre-release workflow, see https://github.com/pixiebrix/pixiebrix-extension/issues/9125",
);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the edge flakiness has been resolved by this PR change.

Comment on lines -303 to -304
const modsPage = new ModsPage(this.page, this.extensionId);
await modsPage.goto();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this modsPage wasn't being used.

@fungairino fungairino changed the title ensure workshop page fixture is done loading before being used fix e2e test flakiness due to workshop page fixture Oct 18, 2024
@fungairino
Copy link
Collaborator Author

There's some additional msedge flakiness that I'll address in a follow-up

@@ -300,8 +299,9 @@ export class PageEditorPage extends BasePageObject {
* @see newPageEditorPage in fixtures/testBase.ts
*/
async cleanup() {
const modsPage = new ModsPage(this.page, this.extensionId);
await modsPage.goto();
if (this.savedModIds.length === 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opportunity/future work: Do we want to consider removing the cleanup portion of our tests in favor of the server cron job?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I think that would be a good endeavor to pursue! Would save us some time on test runs

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

@fungairino fungairino merged commit 4c6ca51 into main Oct 18, 2024
35 checks passed
@fungairino fungairino deleted the activation-flakiness branch October 18, 2024 18:42
@grahamlangford grahamlangford added this to the 2.1.6 milestone Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

4 participants