Skip to content

test: reduce e2e test runtime#236

Merged
chenjiahan merged 4 commits into
mainfrom
chenjiahan/test-performance-optimization
Jun 22, 2026
Merged

test: reduce e2e test runtime#236
chenjiahan merged 4 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

Review Change Stack

📝 Walkthrough

Walkthrough

Both tests/e2e/client-reconnect.test.js and tests/e2e/overlay.test.js are refactored to eliminate fixed-time delay/setTimeout waits. The reconnect test adds message text constants, async console-polling helpers (waitForMessages, waitForReconnectMessages, waitForDisconnectMessage, waitForConsoleMessages), and useFastPageReconnectTimers, which injects a window.setTimeout override to shorten long delays. Each reconnect scenario now calls this timer accelerator and uses the polling helpers instead of manual setInterval/setTimeout loops. The overlay test adds a suite-scoped shared Puppeteer browser instance with shared lifecycle hooks, overlay iframe/content selectors, waitForOverlay, and expectNoOverlay helpers; all individual test cases replace delay(1000) calls with these deterministic waiters.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main objective of the PR: reducing e2e test runtime through optimization strategies.
Description check ✅ Passed The description clearly explains the optimization strategies, validates the changes with specific test commands and performance improvements, and relates directly to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 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
Comment thread tests/e2e/client-reconnect.test.js Outdated

@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 Outdated

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/e2e/overlay.test.js`:
- Line 71: The OVERLAY_ABSENCE_TIMEOUT constant is set to 500ms, but the tests
previously waited 1000ms to check for overlay absence. This shorter timeout
reduces the negative-observation window and can cause false passes when overlays
appear between 500ms and 1000ms. Increase the OVERLAY_ABSENCE_TIMEOUT value from
500 to 1000 to restore the original observation window and properly catch
late-appearing overlays.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a98d84de-25e9-4e78-a4ea-4e5f40fb1bb5

📥 Commits

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

📒 Files selected for processing (2)
  • tests/e2e/client-reconnect.test.js
  • tests/e2e/overlay.test.js

Comment thread tests/e2e/overlay.test.js

@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: c8382246be

ℹ️ 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/client-reconnect.test.js
@chenjiahan chenjiahan merged commit c1c465a into main Jun 22, 2026
3 checks passed
@chenjiahan chenjiahan deleted the chenjiahan/test-performance-optimization branch June 22, 2026 04:46
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