Skip to content

test: registration invalid URL test running before page is ready#40027

Open
jessicaschelly wants to merge 2 commits intodevelopfrom
test/fix-registration-test
Open

test: registration invalid URL test running before page is ready#40027
jessicaschelly wants to merge 2 commits intodevelopfrom
test/fix-registration-test

Conversation

@jessicaschelly
Copy link
Copy Markdown
Member

@jessicaschelly jessicaschelly commented Apr 1, 2026

Proposed changes (including videos or screenshots)

  • Wait for the registration page to finish loading before asserting the invalid secret URL state.

Issue(s)

FLAKY-1573

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Bug Fixes

    • Registration invalid-URL message is now shown as a warning callout (visibly rendered and announced as status) instead of a top-level heading.
  • Tests

    • End-to-end registration tests and page-object helpers updated to wait for and assert the new callout messages for invalid or disabled registration URLs.

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented Apr 1, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 1, 2026

⚠️ No Changeset found

Latest commit: e000a2b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

Walkthrough

Replaced heading-based invalid-URL UI with a warning Callout (role="status") and updated the Registration page object to expose waitForCalloutPage(), registrationInvalidUrlCallout, and a refined registrationDisabledCallout locator. E2E tests were updated to use the page object for invalid-URL assertions.

Changes

Cohort / File(s) Summary
Registration Page Object
apps/meteor/tests/e2e/page-objects/auth.ts
Added waitForCalloutPage(): Promise<void>; changed registrationDisabledCallout to use getByRole('status') filtered by exact visible text; added registrationInvalidUrlCallout getter.
E2E Tests (registration)
apps/meteor/tests/e2e/register.spec.ts
Replaced direct heading locators with poRegistration.waitForCalloutPage() and assertions against poRegistration.registrationInvalidUrlCallout; removed an unused { page } parameter in one test.
UI: Invalid Secret URL
packages/web-ui-registration/src/SecretRegisterInvalidForm.tsx
Replaced <h2> heading with a Fuselage <Callout role="status" type="warning"> rendering the same translation key, changing semantics from heading to status callout.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

area: authentication

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing a flaky test by ensuring the registration page loads before asserting the invalid URL state.
Linked Issues check ✅ Passed The PR addresses FLAKY-1573 by updating the registration page object with waitForCalloutPage() and registrationInvalidUrlCallout, then using these in tests to wait for page readiness before assertions.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the flaky test: updating page objects, tests, and the invalid URL form component to use a Callout instead of h2 heading.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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


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.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.54%. Comparing base (92a44ee) to head (e000a2b).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #40027      +/-   ##
===========================================
- Coverage    70.56%   70.54%   -0.03%     
===========================================
  Files         3270     3270              
  Lines       116766   116766              
  Branches     21058    21084      +26     
===========================================
- Hits         82397    82371      -26     
- Misses       32317    32337      +20     
- Partials      2052     2058       +6     
Flag Coverage Δ
e2e 60.46% <ø> (-0.03%) ⬇️
e2e-api 49.02% <ø> (-0.05%) ⬇️
unit 70.97% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jessicaschelly jessicaschelly marked this pull request as ready for review April 1, 2026 18:31
@jessicaschelly jessicaschelly requested a review from a team as a code owner April 1, 2026 18:31
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

@jessicaschelly jessicaschelly changed the title test: fix registration test by waiting for page load first test: registration invalid URL test running before page is ready Apr 1, 2026
@jessicaschelly jessicaschelly added this to the 8.4.0 milestone Apr 1, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/meteor/tests/e2e/page-objects/auth.ts (1)

83-86: Consider making the wait more specific to avoid ambiguity.

getByRole('status') could match multiple elements on the page (e.g., forgotPasswordEmailCallout also targets role=status). While this works in the current registration flow context, consider using a more specific locator to avoid potential flakiness if page structure changes.

♻️ Optional: Make the wait target a specific callout
 async waitForCalloutPage(): Promise<void> {
-  await this.page.getByRole('status').waitFor();
+  await this.page.getByRole('status').first().waitFor();
 }

Or, if the intent is specifically for the invalid URL page:

 async waitForCalloutPage(): Promise<void> {
-  await this.page.getByRole('status').waitFor();
+  await this.registrationInvalidUrlCallout.waitFor();
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/meteor/tests/e2e/page-objects/auth.ts` around lines 83 - 86, The
waitForCalloutPage() helper uses a generic locator this.page.getByRole('status')
which can match multiple status elements and cause flakiness; update the locator
to a more specific target (for example use a test id, aria-label, or a unique
text/selector that corresponds to the intended callout like the
forgotPasswordEmailCallout or the invalid-URL callout) inside waitForCalloutPage
so it waits only for that specific element (refer to the waitForCalloutPage
function and the forgotPasswordEmailCallout locator name to find where to change
the selector).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/meteor/tests/e2e/page-objects/auth.ts`:
- Around line 83-86: The waitForCalloutPage() helper uses a generic locator
this.page.getByRole('status') which can match multiple status elements and cause
flakiness; update the locator to a more specific target (for example use a test
id, aria-label, or a unique text/selector that corresponds to the intended
callout like the forgotPasswordEmailCallout or the invalid-URL callout) inside
waitForCalloutPage so it waits only for that specific element (refer to the
waitForCalloutPage function and the forgotPasswordEmailCallout locator name to
find where to change the selector).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 45ba6bbe-bd97-43e2-af42-545ba59059c9

📥 Commits

Reviewing files that changed from the base of the PR and between 77ca349 and e000a2b.

📒 Files selected for processing (2)
  • apps/meteor/tests/e2e/page-objects/auth.ts
  • packages/web-ui-registration/src/SecretRegisterInvalidForm.tsx
✅ Files skipped from review due to trivial changes (1)
  • packages/web-ui-registration/src/SecretRegisterInvalidForm.tsx
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/tests/e2e/page-objects/auth.ts
apps/meteor/tests/e2e/page-objects/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

Utilize existing page objects pattern from apps/meteor/tests/e2e/page-objects/

Files:

  • apps/meteor/tests/e2e/page-objects/auth.ts
apps/meteor/tests/e2e/**/*.{ts,spec.ts}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.{ts,spec.ts}: Store commonly used locators in variables/constants for reuse
Follow Page Object Model pattern consistently in Playwright tests

Files:

  • apps/meteor/tests/e2e/page-objects/auth.ts
🧠 Learnings (14)
📓 Common learnings
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 36987
File: apps/meteor/tests/e2e/page-objects/fragments/room-toolbar.ts:10-20
Timestamp: 2025-09-23T19:22:59.217Z
Learning: In Playwright e2e tests, prefer stable selectors like data-qa-id attributes over localized text in getByRole() or getByText() calls to prevent test failures when UI language changes. Test translations separately by validating actual text content after ensuring UI interactions work with stable selectors.
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Avoid using `page.locator()` in Playwright tests - always prefer semantic locators such as `page.getByRole()`, `page.getByLabel()`, `page.getByText()`, or `page.getByTitle()`
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/page-objects/**/*.ts : Utilize existing page objects pattern from `apps/meteor/tests/e2e/page-objects/`

Applied to files:

  • apps/meteor/tests/e2e/page-objects/auth.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Avoid using `page.locator()` in Playwright tests - always prefer semantic locators such as `page.getByRole()`, `page.getByLabel()`, `page.getByText()`, or `page.getByTitle()`

Applied to files:

  • apps/meteor/tests/e2e/page-objects/auth.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `page.waitFor()` with specific conditions instead of hardcoded timeouts in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/page-objects/auth.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Follow Page Object Model pattern consistently in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/page-objects/auth.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Implement proper wait strategies for dynamic content in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/page-objects/auth.ts
📚 Learning: 2026-02-24T19:36:55.089Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/home-content.ts:60-82
Timestamp: 2026-02-24T19:36:55.089Z
Learning: In RocketChat/Rocket.Chat e2e tests (apps/meteor/tests/e2e/page-objects/fragments/home-content.ts), thread message preview listitems do not have aria-roledescription="message", so lastThreadMessagePreview locator cannot be scoped to messageListItems (which filters for aria-roledescription="message"). It should remain scoped to page.getByRole('listitem') or mainMessageList.getByRole('listitem').

Applied to files:

  • apps/meteor/tests/e2e/page-objects/auth.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files

Applied to files:

  • apps/meteor/tests/e2e/page-objects/auth.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Store commonly used locators in variables/constants for reuse

Applied to files:

  • apps/meteor/tests/e2e/page-objects/auth.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Prefer web-first assertions (`toBeVisible`, `toHaveText`, etc.) in Playwright tests

Applied to files:

  • apps/meteor/tests/e2e/page-objects/auth.ts
📚 Learning: 2025-12-16T17:29:40.430Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37834
File: apps/meteor/tests/e2e/page-objects/fragments/admin-flextab-emoji.ts:12-22
Timestamp: 2025-12-16T17:29:40.430Z
Learning: In all page-object files under apps/meteor/tests/e2e/page-objects/, import expect from ../../utils/test (Playwright's async expect) instead of from Jest. Jest's expect is synchronous and incompatible with web-first assertions like toBeVisible, which can cause TypeScript errors.

Applied to files:

  • apps/meteor/tests/e2e/page-objects/auth.ts
📚 Learning: 2026-02-24T19:39:42.247Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/message.ts:7-7
Timestamp: 2026-02-24T19:39:42.247Z
Learning: In RocketChat e2e tests, avoid using data-qa attributes to locate elements. Prefer semantic locators such as getByRole, getByLabel, getByText, getByTitle and ARIA-based selectors. Apply this rule to all TypeScript files under apps/meteor/tests/e2e to improve test reliability, accessibility, and maintainability.

Applied to files:

  • apps/meteor/tests/e2e/page-objects/auth.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/tests/e2e/page-objects/auth.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/tests/e2e/page-objects/auth.ts
🔇 Additional comments (1)
apps/meteor/tests/e2e/page-objects/auth.ts (1)

151-157: Good use of semantic locators with the Page Object Model pattern.

The switch from locator('role=status >> text=/.../') to getByRole('status').filter({ hasText: '...' }) aligns with the coding guidelines preference for semantic locators. The filter() approach provides clear disambiguation between different callout types.

One consideration: these locators use English text strings, which could break if tests run in non-English locales since the components use translation functions ({t('...')}). This matches the existing pattern in this file but is worth noting if multi-locale testing is planned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant