Skip to content

Comments

test(e2e): fix service worker flaky tests#7017

Merged
chenjiahan merged 6 commits intomainfrom
chore/e2e_report
Jan 23, 2026
Merged

test(e2e): fix service worker flaky tests#7017
chenjiahan merged 6 commits intomainfrom
chore/e2e_report

Conversation

@stormslowly
Copy link
Contributor

@stormslowly stormslowly commented Jan 23, 2026

Summary

Error: browserContext.waitForEvent: Test timeout of 30000ms exceeded.

  11 |   // Setup service worker in playwright
  12 |   const context = page.context();
> 13 |   const serviceWorkerPromise = context.waitForEvent('serviceworker');
     |                                        ^
  14 |   await page.reload();
  15 |   await serviceWorkerPromise;
  16 |   await page.evaluate(async () => {
    at waitForServiceWorker (/rsbuild/e2e/cases/workers/service-worker-environments/index.test.ts:13:40)
  1. Use a stable and platform-independent way to determine service worker started or not
  2. Add HTML reporter and artifact upload that for later review by playwright show-report <path to playwright-report>

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @stormslowly, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request improves the debugging and reporting capabilities for Playwright end-to-end tests. By enabling the HTML reporter, test results will be presented in a more visual and interactive format. Additionally, activating tracing will provide comprehensive logs of test execution, making it easier to identify and resolve issues.

Highlights

  • Playwright Reporter Configuration: The Playwright test runner configuration has been updated to include an HTML reporter in addition to the existing list reporter. This will generate interactive HTML reports for test runs.
  • Playwright Tracing: Tracing has been enabled for Playwright tests by setting trace: 'on' in the use configuration. This will capture detailed execution traces, aiding in debugging test failures.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/test.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enables the HTML reporter for Playwright tests and turns on tracing for all test runs. While enabling the HTML reporter is a good addition for better test reporting, enabling tracing for all tests with trace: 'on' can be inefficient. I've suggested a more optimal configuration for tracing that will only retain traces for failed tests, which should improve performance and reduce storage usage in your CI environment.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 23, 2026

Deploying rsbuild-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 786f12e
Status: ✅  Deploy successful!
Preview URL: https://172cb334.rsbuild-v2.pages.dev
Branch Preview URL: https://chore-e2e-report.rsbuild-v2.pages.dev

View logs

@stormslowly stormslowly changed the title chore: enable html reporter chore(test): fix service worker flaky tests Jan 23, 2026
@stormslowly stormslowly marked this pull request as ready for review January 23, 2026 05:58
Copilot AI review requested due to automatic review settings January 23, 2026 05:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes flaky Playwright service worker E2E tests by switching from Playwright’s serviceworker event waiting to an in-page readiness signal, and adds CI artifacts for easier debugging of failures.

Changes:

  • Update the service worker E2E test to wait for SW readiness via navigator.serviceWorker/window.swStatus.
  • Enable Playwright HTML reporting and trace collection.
  • Upload Playwright report/results as CI artifacts for later inspection.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
e2e/playwright.config.ts Adds HTML reporter and configures trace collection for debugging failures.
e2e/cases/workers/service-worker-environments/index.test.ts Reworks SW readiness waiting logic to reduce flakiness.
.github/workflows/test.yml Uploads Playwright HTML report and test results as CI artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cloudflare-workers-and-pages
Copy link

Deploying rsbuild with  Cloudflare Pages  Cloudflare Pages

Latest commit: e0f23f6
Status: ✅  Deploy successful!
Preview URL: https://5afde219.rsbuild-v2.pages.dev
Branch Preview URL: https://chore-e2e-report.rsbuild-v2.pages.dev

View logs

Copy link
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

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

LGTM

@chenjiahan chenjiahan changed the title chore(test): fix service worker flaky tests test(e2e): fix service worker flaky tests Jan 23, 2026
@chenjiahan
Copy link
Member

E2E tracing performance:

  • default: 23.2s / 21.3s / 22.1s
  • trace: 'on': 24.6s / 26.5s / 26.5s
  • trace: 'retain-on-failure': 23.3s / 22.6s / 22.6s

@chenjiahan chenjiahan merged commit f533ad3 into main Jan 23, 2026
7 checks passed
@chenjiahan chenjiahan deleted the chore/e2e_report branch January 23, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants