Skip to content

test(e2e): centralize log expectations with shared constants#6815

Merged
chenjiahan merged 1 commit intomainfrom
e2e_constants_1222
Dec 22, 2025
Merged

test(e2e): centralize log expectations with shared constants#6815
chenjiahan merged 1 commit intomainfrom
e2e_constants_1222

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

Summary

  • Summary: replace hardcoded log/overlay strings in e2e cases with shared constants for HMR, build failures, and overlay selectors/titles.
  • Why: keeps tests consistent and easier to update when log text or overlay selectors change.

Checklist

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

Copilot AI review requested due to automatic review settings December 22, 2025 02:21
@netlify
Copy link
Copy Markdown

netlify bot commented Dec 22, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit ba79899
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/6948ab34b870b20008757c84
😎 Deploy Preview https://deploy-preview-6815--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 68 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
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

This PR refactors e2e tests to use shared constants for commonly checked log messages and overlay selectors, replacing hardcoded strings with centralized definitions. This improves test maintainability by providing a single source of truth for these values.

  • Introduces five new constants: HMR_CONNECTED_LOG, MODULE_BUILD_FAILED_LOG, OVERLAY_ID, and OVERLAY_TITLE_BUILD_FAILED
  • Replaces hardcoded strings across overlay, HMR, and browser-logs test suites

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
e2e/helper/constants.ts Adds five new exported constants for HMR connection logs, build failure messages, and overlay selectors/titles
e2e/cases/overlay/type-errors/index.test.ts Updates overlay selector and title assertions to use OVERLAY_ID and OVERLAY_TITLE_BUILD_FAILED constants
e2e/cases/overlay/runtime-errors/index.test.ts Replaces hardcoded HMR log string and overlay selector with HMR_CONNECTED_LOG and OVERLAY_ID constants
e2e/cases/overlay/disabled/index.test.ts Replaces hardcoded log expectations and overlay selector with HMR_CONNECTED_LOG, MODULE_BUILD_FAILED_LOG, and OVERLAY_ID constants
e2e/cases/overlay/basic/index.test.ts Updates all hardcoded log strings and overlay assertions to use the four new constants
e2e/cases/hmr/log-level/index.test.ts Replaces hardcoded HMR connection log strings with HMR_CONNECTED_LOG constant
e2e/cases/hmr/error-recovery/index.test.ts Updates build failure log expectation to use MODULE_BUILD_FAILED_LOG constant
e2e/cases/browser-logs/skip-build-error/index.test.ts Replaces hardcoded build failure log string with MODULE_BUILD_FAILED_LOG constant

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

@chenjiahan chenjiahan merged commit bd3fa6a into main Dec 22, 2025
18 checks passed
@chenjiahan chenjiahan deleted the e2e_constants_1222 branch December 22, 2025 02:48
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