Skip to content

test: reduce e2e test runtime#236

Open
chenjiahan wants to merge 3 commits into
mainfrom
chenjiahan/test-performance-optimization
Open

test: reduce e2e test runtime#236
chenjiahan wants to merge 3 commits into
mainfrom
chenjiahan/test-performance-optimization

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

Summary

This PR reduces slow e2e test runtime by shortening reconnect wait paths and reusing one Chromium process across overlay cases while keeping each test isolated in its own browser context. In local validation, pnpm test dropped from 179.62s to 110.95s (~38.2% faster).

Validation

  • pnpm test
  • pnpm exec rstest tests/e2e/client-reconnect.test.js
  • pnpm exec rstest tests/e2e/overlay.test.js

@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@chenjiahan, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 27 minutes and 10 seconds. Learn how PR review limits work.

To continue reviewing without waiting, enable usage-based billing in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f67e0d4c-6016-48e2-824f-852e14194a6b

📥 Commits

Reviewing files that changed from the base of the PR and between 741f0c8 and e148e48.

📒 Files selected for processing (2)
  • tests/e2e/client-reconnect.test.js
  • tests/e2e/overlay.test.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chenjiahan/test-performance-optimization

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b8a20643a6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/e2e/overlay.test.js Outdated
}

const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const OVERLAY_SETTLE_DELAY = 250;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Synchronize overlay checks instead of sleeping 250ms

This 250 ms constant is used by tests that immediately dereference overlayHandle and by tests that assert the overlay is absent after page.goto. The overlay is inserted by browser-side websocket/runtime-error handlers after navigation, so on slower CI a legitimate overlay can take longer than 250 ms to render; positive cases then fail with a null handle, while negative cases can pass before a late overlay appears. Please wait for the selector when an overlay is expected and use a bounded absence check for negative cases instead of shrinking the fixed sleep.

Useful? React with 👍 / 👎.

Comment thread tests/e2e/client-reconnect.test.js Outdated
1000 * 2 ** 3,
),
);
await delay(250);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Wait for the disconnect log before snapshotting

In the reconnect: false case there are no reconnect messages to wait on, so this 250 ms sleep is the only synchronization after server.stop(). The Disconnected! console entry is emitted from the browser's websocket close handler, which can be delivered after this short delay on slower CI, causing the snapshot to miss the expected line and flake. Please poll until consoleMessages contains the disconnect log before matching the snapshot.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e148e48485

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/e2e/overlay.test.js
Comment on lines +119 to +120
const waitForOverlay = (page) =>
page.waitForSelector(OVERLAY_SELECTOR, { timeout: OVERLAY_TIMEOUT });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Wait for the overlay iframe contents

This helper resolves as soon as the outer iframe is inserted, but createContainer() appends that iframe before its onload handler populates the frame body and queued error messages (client-src/overlay.ts:478-521). The positive overlay tests immediately read contentFrame().evaluate(() => document.body.outerHTML) after this wait, so on a slower Chromium run they can snapshot an empty about:blank body or fail before the overlay contents exist. Please wait for a sentinel inside the frame, such as #rspack-dev-server-client-overlay-div, instead of only the iframe element.

Useful? React with 👍 / 👎.

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.

1 participant