Skip to content

Conversation

@dougfabris
Copy link
Member

@dougfabris dougfabris commented Sep 15, 2025

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

FLAKY-1542

Summary by CodeRabbit

  • Tests
    • Improved stability of logout/login and end-to-end encryption reset flows in automated tests.
    • Removed flaky UI assertions and streamlined wait conditions to reduce test flakiness.
    • Centralized logout interaction and added reliable post-action waits for consistent test outcomes.
  • Chores
    • Minor test cleanup and clearer comments around authentication and reset flows.
  • Note
    • No user-facing changes.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Sep 15, 2025

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Sep 15, 2025

⚠️ No Changeset found

Latest commit: 2502964

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
Contributor

coderabbitai bot commented Sep 15, 2025

Walkthrough

Centralized logout/login wait behavior across e2e tests and page objects: removed redundant Login-button assertions in specs, added LoginPage.waitForIt() after logout and after E2EE password reset, introduced an accountLogoutOption getter, and added private login fields to relevant page-object classes. No public API signature changes beyond the new getter.

Changes

Cohort / File(s) Summary
E2E Spec Cleanup
apps/meteor/tests/e2e/e2e-encryption.spec.ts
Removed explicit Login-button visibility checks and one explicit wait; added clarifying comments around logout/login/reset flows; test control flow unchanged (logout → loginByUserState → E2EE actions).
Page Object: E2EE Reset Modal
apps/meteor/tests/e2e/page-objects/fragments/e2ee.ts
Imported LoginPage; added private login member and instantiated it in the constructor; after confirming reset, calls login.waitForIt() to wait for the login screen.
Page Object: Home Sidenav
apps/meteor/tests/e2e/page-objects/fragments/home-sidenav.ts
Imported LoginPage; added private login member and instantiated it; added get accountLogoutOption(): Locator; logout() now clicks accountLogoutOption and calls login.waitForIt() to await logout completion.
Page Object: Login
apps/meteor/tests/e2e/page-objects/login.ts
Reformatted and expanded the JSDoc/comment above waitForIt() (no functional change).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Tester
  participant Spec as E2E Spec
  participant Sidenav as HomeSidenav
  participant Login as LoginPage

  Tester->>Spec: run test
  Spec->>Sidenav: logout()
  Sidenav->>Sidenav: click accountLogoutOption
  Sidenav->>Login: waitForIt()
  Note right of Login #DDEEFF: Wait until login screen is ready
  Login-->>Spec: ready
  Spec-->>Tester: continue
Loading
sequenceDiagram
  autonumber
  actor Tester
  participant Spec as E2E Spec
  participant E2EE as ResetE2EEPasswordModal
  participant Login as LoginPage

  Spec->>E2EE: confirmReset()
  E2EE->>E2EE: close reset dialog
  E2EE->>Login: waitForIt()
  Note right of Login #DDEEFF: Ensure post-reset login screen is ready
  Login-->>Spec: ready
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • tassoevan

Poem

I hopped through tests with careful paws,
I nudged the waits and fixed the laws.
A login pause, a gentle cheer—
Now logouts end when the screen is clear.
🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title concisely and accurately describes the primary change — adding a wait-for-logout step in the logout action — which matches the modifications in page objects and tests (instances of login.waitForIt() and related logout changes). It is specific, focused, and readable for a teammate scanning the history.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test/waitForLogout

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 745babd and fa57e89.

📒 Files selected for processing (1)
  • apps/meteor/tests/e2e/page-objects/login.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/meteor/tests/e2e/page-objects/login.ts
⏰ 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). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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

@dougfabris dougfabris added this to the 7.11.0 milestone Sep 15, 2025
Copy link
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.

Actionable comments posted: 1

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

26-28: Harden logout wait to reduce flakiness

Also assert the app content is gone (or the URL changed) to avoid false positives where the Login button briefly flashes.

 async waitForLogout() {
-  await expect(this.loginButton).toBeVisible();
+  await expect(this.loginButton).toBeVisible();
+  // Ensure main app content is not visible anymore
+  await expect(this.page.getByRole('main')).not.toBeVisible();
+  // Optionally, assert we are on a public route
+  // await expect(this.page).toHaveURL(/\/login|\/home/);
 }
apps/meteor/tests/e2e/page-objects/fragments/home-sidenav.ts (2)

107-109: Confirm ARIA role for Logout item or use a more permissive role

If Logout is not exposed as a checkbox item, this locator will fail. Consider falling back to plain menuitem.

-get accountLogoutOption(): Locator {
-  return this.userProfileMenu.getByRole('menuitemcheckbox', { name: 'Logout' });
-}
+get accountLogoutOption(): Locator {
+  // Works whether it's menuitem or menuitemcheckbox
+  return this.userProfileMenu.getByRole('menuitem', { name: 'Logout' }).or(
+    this.userProfileMenu.getByRole('menuitemcheckbox', { name: 'Logout' }),
+  );
+}

173-177: Wait for the menu to render before clicking Logout

Clicking the option immediately after toggling the menu can be flaky. Wait for the menu visibility first.

 async logout(): Promise<void> {
   await this.btnUserProfileMenu.click();
-  await this.accountLogoutOption.click();
+  await expect(this.userProfileMenu).toBeVisible();
+  await this.accountLogoutOption.click();
   await this.login.waitForLogout();
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c6ee55 and 56a1534.

📒 Files selected for processing (4)
  • apps/meteor/tests/e2e/e2e-encryption.spec.ts (2 hunks)
  • apps/meteor/tests/e2e/page-objects/fragments/e2ee.ts (3 hunks)
  • apps/meteor/tests/e2e/page-objects/fragments/home-sidenav.ts (3 hunks)
  • apps/meteor/tests/e2e/page-objects/login.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
apps/meteor/tests/e2e/page-objects/fragments/e2ee.ts (1)
apps/meteor/tests/e2e/page-objects/login.ts (1)
  • LoginPage (9-55)
apps/meteor/tests/e2e/page-objects/fragments/home-sidenav.ts (1)
apps/meteor/tests/e2e/page-objects/login.ts (1)
  • LoginPage (9-55)
⏰ 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). (2)
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (6)
apps/meteor/tests/e2e/page-objects/fragments/e2ee.ts (3)

6-6: Import looks good

Brings LoginPage into the fragment where it’s needed.


100-105: Good ownership of LoginPage within modal

Instantiating and encapsulating the login page object here makes the reset flow self‑contained.


114-115: Deterministic post‑reset flow

Waiting for logout after confirming reset avoids races in subsequent steps.

apps/meteor/tests/e2e/e2e-encryption.spec.ts (3)

101-106: Comment clarifies flow; no behavior change

LGTM.


107-114: Comment clarifies flow; no behavior change

LGTM.


202-207: Using the centralized logout flow is the right call

Aligns tests on a single wait strategy via page objects.

@codecov
Copy link

codecov bot commented Sep 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.56%. Comparing base (665d719) to head (2502964).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #36947      +/-   ##
===========================================
- Coverage    66.60%   66.56%   -0.04%     
===========================================
  Files         3346     3346              
  Lines       114661   114661              
  Branches     21099    21098       -1     
===========================================
- Hits         76365    76327      -38     
- Misses       35601    35644      +43     
+ Partials      2695     2690       -5     
Flag Coverage Δ
e2e 57.79% <ø> (-0.02%) ⬇️
unit 71.22% <ø> (-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.

@dougfabris dougfabris marked this pull request as ready for review September 16, 2025 12:30
@dougfabris dougfabris requested a review from a team as a code owner September 16, 2025 12:30
Copy link
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.

Actionable comments posted: 0

♻️ Duplicate comments (1)
apps/meteor/tests/e2e/page-objects/fragments/home-sidenav.ts (1)

3-3: Resolved: switched to value import so LoginPage exists at runtime

This addresses the prior crash risk when constructing LoginPage. Good fix.

🧹 Nitpick comments (3)
apps/meteor/tests/e2e/page-objects/fragments/home-sidenav.ts (3)

10-15: Initialize LoginPage eagerly; consider DI for reuse/testability

Current init works. Optionally accept a LoginPage via constructor to ease reuse/mocking in specs.

-	constructor(page: Page) {
-		this.page = page;
-		this.login = new LoginPage(page);
-	}
+	constructor(page: Page, login = new LoginPage(page)) {
+		this.page = page;
+		this.login = login;
+	}

108-111: Tighten locator to reduce flakiness

Add exact: true to avoid matching similarly named items.

-	get accountLogoutOption(): Locator {
-		return this.userProfileMenu.getByRole('menuitemcheckbox', { name: 'Logout' });
-	}
+	get accountLogoutOption(): Locator {
+		return this.userProfileMenu.getByRole('menuitemcheckbox', { name: 'Logout', exact: true });
+	}

Please confirm that the ARIA role for “Logout” is indeed menuitemcheckbox in current UI; if it’s menuitem, update accordingly.


176-178: Stabilize the logout flow; verify intent vs PR title

  • Add an explicit wait for the menu visibility before clicking the item to avoid race conditions (ties to FLAKY-1542).
  • Title mentions “waitForLogout” but code calls waitForIt() (deprecated). If a waitForLogout() exists elsewhere in this PR, prefer it here.
 	async logout(): Promise<void> {
 		await this.btnUserProfileMenu.click();
+		await expect(this.userProfileMenu).toBeVisible();
 		await this.accountLogoutOption.click();
-		await this.login.waitForIt();
+		// Prefer waitForLogout() if available; fallback is waitForIt()
+		await this.login.waitForIt();
 	}

If LoginPage.waitForLogout() was added, replace the last line with await this.login.waitForLogout();.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4414d26 and 745babd.

📒 Files selected for processing (2)
  • apps/meteor/tests/e2e/page-objects/fragments/e2ee.ts (3 hunks)
  • apps/meteor/tests/e2e/page-objects/fragments/home-sidenav.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/meteor/tests/e2e/page-objects/fragments/e2ee.ts
🧰 Additional context used
🧬 Code graph analysis (1)
apps/meteor/tests/e2e/page-objects/fragments/home-sidenav.ts (1)
apps/meteor/tests/e2e/page-objects/login.ts (1)
  • LoginPage (9-51)
⏰ 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). (2)
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

@tassoevan tassoevan added the stat: QA assured Means it has been tested and approved by a company insider label Sep 16, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Sep 16, 2025
@kodiakhq kodiakhq bot merged commit a087f72 into develop Sep 16, 2025
116 of 120 checks passed
@kodiakhq kodiakhq bot deleted the test/waitForLogout branch September 16, 2025 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants