Skip to content

test: isolate session expiration e2e users - #41166

Merged
tassoevan merged 1 commit into
developfrom
test/session-expiration-disposable-users
Jul 4, 2026
Merged

test: isolate session expiration e2e users#41166
tassoevan merged 1 commit into
developfrom
test/session-expiration-disposable-users

Conversation

@jessicaschelly

@jessicaschelly jessicaschelly commented Jul 3, 2026

Copy link
Copy Markdown
Member

Proposed changes

Isolates session-expiration-redirect.spec.ts from shared fixture users by creating disposable users for the expired-session scenarios.

The tests now invalidate only users created for this spec, which avoids leaking stale Users.user1/Users.user2 auth state into later E2E tests.

Issue(s)

FLAKY-1910

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Bug Fixes
    • Improved session-expiration behavior in end-to-end coverage so users are redirected to the login screen when their session is no longer valid.
    • Verified that expired sessions are cleared from browser storage after interaction or sending a message, helping prevent stale login states.
    • Added broader multi-user test coverage for channel activity with separate logged-in sessions.

@dionisio-bot

dionisio-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

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

@changeset-bot

changeset-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ba281f6

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

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR refactors an e2e test spec for session expiration redirects to use two dynamically created users instead of a single fixture user with static storage state. A new MongoDB helper clears login tokens per user, and both tests now create individual page contexts with cleanup tracking.

Changes

Multi-user session expiration test refactor

Layer / File(s) Summary
Imports and DB token removal helper
apps/meteor/tests/e2e/session-expiration-redirect.spec.ts
Imports are updated to use shared e2e utilities (createAuxContext, typed user/channel helpers) instead of fixture-based setup; a new removeTokensFromdb(username) helper clears services.resume.loginTokens via MongoDB connection.
Two-user suite and per-test session handling
apps/meteor/tests/e2e/session-expiration-redirect.spec.ts
Suite setup creates two users and a shared channel in beforeAll/afterAll, tracks opened pages in a sessions array for cleanup in afterEach, and both tests use createAuxContext with per-user (expiringUser1/expiringUser2) token deletion instead of a fixed fixture user.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • RocketChat/Rocket.Chat#40849: Both PRs verify the same session-expiration-to-login redirect behavior by clearing services.resume.loginTokens and asserting localStorage cleanup in the same spec file.
  • RocketChat/Rocket.Chat#41018: Both PRs modify the same session-expiration-redirect.spec.ts around token removal and login redirect assertions.

Suggested labels: type: chore

Suggested reviewers: juliajforesti

🚥 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 clearly matches the main change: isolating session-expiration e2e users to avoid shared auth state.
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.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (2)
  • FLAKY-1910: Request failed with status code 401
  • FLAKY-2212: Request failed with status code 401

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.

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.33%. Comparing base (9a80dd7) to head (ba281f6).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #41166      +/-   ##
===========================================
+ Coverage    69.31%   69.33%   +0.01%     
===========================================
  Files         3545     3545              
  Lines       139290   139290              
  Branches     24813    24801      -12     
===========================================
+ Hits         96552    96577      +25     
+ Misses       38712    38699      -13     
+ Partials      4026     4014      -12     
Flag Coverage Δ
e2e 59.45% <ø> (-0.13%) ⬇️
e2e-api 50.25% <ø> (+0.48%) ⬆️
unit 70.18% <ø> (+0.05%) ⬆️

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 July 3, 2026 19:31
@jessicaschelly
jessicaschelly requested a review from a team as a code owner July 3, 2026 19:31

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/meteor/tests/e2e/session-expiration-redirect.spec.ts (1)

13-22: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Connection leak if updateOne throws.

If the updateOne call fails, connection.close() on Line 21 is skipped, leaking the MongoDB connection. Wrap in try/finally.

🛠️ Proposed fix
 const removeTokensFromdb = async (username: string): Promise<void> => {
 	const connection = await MongoClient.connect(URL_MONGODB);
 
-	await connection
-		.db()
-		.collection('users')
-		.updateOne({ username }, { $set: { 'services.resume.loginTokens': [] } });
-
-	await connection.close();
+	try {
+		await connection
+			.db()
+			.collection('users')
+			.updateOne({ username }, { $set: { 'services.resume.loginTokens': [] } });
+	} finally {
+		await connection.close();
+	}
 };
🤖 Prompt for 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.

In `@apps/meteor/tests/e2e/session-expiration-redirect.spec.ts` around lines 13 -
22, The removeTokensFromdb helper can leak the MongoDB connection if
MongoClient.connect succeeds but updateOne throws. Update this helper to use
try/finally around the db().collection('users').updateOne call so
connection.close() always runs, and keep the fix localized to removeTokensFromdb
in session-expiration-redirect.spec.ts.
🧹 Nitpick comments (1)
apps/meteor/tests/e2e/session-expiration-redirect.spec.ts (1)

49-55: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Duplicated per-test session setup.

Both tests repeat the same createAuxContext + new HomeChannel(page) + sessions.push(...) sequence. Could be extracted into a small local helper (e.g., openExpiringUserSession(browser, userState)), but low priority given the file is small.

Also applies to: 87-91

🤖 Prompt for 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.

In `@apps/meteor/tests/e2e/session-expiration-redirect.spec.ts` around lines 49 -
55, Both session-expiration redirect tests duplicate the same setup sequence, so
extract that shared `createAuxContext` + `new HomeChannel(page)` +
`sessions.push(...)` logic into a small local helper such as
`openExpiringUserSession(browser, userState)` and reuse it from the affected
test cases. Keep the helper close to `session-expiration-redirect.spec.ts` so
the existing tests still read clearly while avoiding repeated setup around
`createAuxContext` and `HomeChannel`.
🤖 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.

Outside diff comments:
In `@apps/meteor/tests/e2e/session-expiration-redirect.spec.ts`:
- Around line 13-22: The removeTokensFromdb helper can leak the MongoDB
connection if MongoClient.connect succeeds but updateOne throws. Update this
helper to use try/finally around the db().collection('users').updateOne call so
connection.close() always runs, and keep the fix localized to removeTokensFromdb
in session-expiration-redirect.spec.ts.

---

Nitpick comments:
In `@apps/meteor/tests/e2e/session-expiration-redirect.spec.ts`:
- Around line 49-55: Both session-expiration redirect tests duplicate the same
setup sequence, so extract that shared `createAuxContext` + `new
HomeChannel(page)` + `sessions.push(...)` logic into a small local helper such
as `openExpiringUserSession(browser, userState)` and reuse it from the affected
test cases. Keep the helper close to `session-expiration-redirect.spec.ts` so
the existing tests still read clearly while avoiding repeated setup around
`createAuxContext` and `HomeChannel`.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 029355b3-b0ac-47d4-bcf6-096555675a55

📥 Commits

Reviewing files that changed from the base of the PR and between 9a80dd7 and ba281f6.

📒 Files selected for processing (1)
  • apps/meteor/tests/e2e/session-expiration-redirect.spec.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Hacktron Security Check
⚠️ CI failures not shown inline (4)

GitHub Actions: CI / 📦 Track Image Sizes: test: isolate session expiration e2e users

Conclusion: failure

View job details

##[group]Run current_total=$(jq -r '.total' current-sizes.json)
 �[36;1mcurrent_total=$(jq -r '.total' current-sizes.json)�[0m
 �[36;1m�[0m
 �[36;1mif [[ ! -f baseline-sizes.json ]]; then�[0m
 �[36;1m  echo "No baseline available"�[0m
 �[36;1m  echo "size-diff=0" >> $GITHUB_OUTPUT�[0m
 �[36;1m  echo "size-diff-percent=0" >> $GITHUB_OUTPUT�[0m
 �[36;1m  echo "comment-triggered=false" >> $GITHUB_OUTPUT�[0m
 �[36;1m�[0m
 �[36;1m  cat > report.md << 'EOF'�[0m
 �[36;1m# 📦 Docker Image Size Report�[0m
 �[36;1m�[0m
 �[36;1m**Status:** First measurement - no baseline for comparison�[0m
 �[36;1m�[0m
 �[36;1m**Total Size:** $(numfmt --to=iec-i --suffix=B $current_total)�[0m
 �[36;1mEOF�[0m
 �[36;1m  exit 0�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mbaseline_total=$(jq -r '.total' baseline-sizes.json)�[0m
 �[36;1mdiff=$((current_total - baseline_total))�[0m
 �[36;1m�[0m
 �[36;1mif [[ $baseline_total -gt 0 ]]; then�[0m
 �[36;1m  percent=$(awk "BEGIN {printf \"%.2f\", ($diff / $baseline_total) * 100}")�[0m
 �[36;1melse�[0m
 �[36;1m  percent=0�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mecho "size-diff=$diff" >> $GITHUB_OUTPUT�[0m
 �[36;1mecho "size-diff-percent=$percent" >> $GITHUB_OUTPUT�[0m
 �[36;1m�[0m
 �[36;1m# Only comment when size is bigger than baseline; optionally require per-image thresholds�[0m
 �[36;1mTHRESHOLDS="$SIZE_THRESHOLDS"�[0m
 �[36;1mFAIL_THRESHOLDS="$FAIL_THRESHOLDS"�[0m
 �[36;1mcomment_triggered=false�[0m
 �[36;1mfail_triggered=false�[0m
 �[36;1mif [[ $diff -gt 0 ]]; then�[0m
 �[36;1m  if [[ -z "$THRESHOLDS" ]] || [[ "$THRESHOLDS" == "{}" ]]; then�[0m
 �[36;1m    comment_triggered=true�[0m
 �[36;1m  fi�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mcolor="gray"�[0m
 �[36;1mif (( $(awk "BEGIN {print ($percent > 0.01)}") )); then�[0m
 �[36;1m  color="red"�[0m
 �[36;1melif (( $(awk "BEGIN {print ($percent < -0.01)}") )); then�[0m
 �[36;1m  color="green"�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1m# Generate report�[0m
 �[36;1mif [[ $diff -gt 0 ]]; then�[0m
 �[36;1m  emoji=...

GitHub Actions: CI / 14_📦 Track Image Sizes.txt: test: isolate session expiration e2e users

Conclusion: failure

View job details

##[group]Run current_total=$(jq -r '.total' current-sizes.json)
 �[36;1mcurrent_total=$(jq -r '.total' current-sizes.json)�[0m
 �[36;1m�[0m
 �[36;1mif [[ ! -f baseline-sizes.json ]]; then�[0m
 �[36;1m  echo "No baseline available"�[0m
 �[36;1m  echo "size-diff=0" >> $GITHUB_OUTPUT�[0m
 �[36;1m  echo "size-diff-percent=0" >> $GITHUB_OUTPUT�[0m
 �[36;1m  echo "comment-triggered=false" >> $GITHUB_OUTPUT�[0m
 �[36;1m�[0m
 �[36;1m  cat > report.md << 'EOF'�[0m
 �[36;1m# 📦 Docker Image Size Report�[0m
 �[36;1m�[0m
 �[36;1m**Status:** First measurement - no baseline for comparison�[0m
 �[36;1m�[0m
 �[36;1m**Total Size:** $(numfmt --to=iec-i --suffix=B $current_total)�[0m
 �[36;1mEOF�[0m
 �[36;1m  exit 0�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mbaseline_total=$(jq -r '.total' baseline-sizes.json)�[0m
 �[36;1mdiff=$((current_total - baseline_total))�[0m
 �[36;1m�[0m
 �[36;1mif [[ $baseline_total -gt 0 ]]; then�[0m
 �[36;1m  percent=$(awk "BEGIN {printf \"%.2f\", ($diff / $baseline_total) * 100}")�[0m
 �[36;1melse�[0m
 �[36;1m  percent=0�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mecho "size-diff=$diff" >> $GITHUB_OUTPUT�[0m
 �[36;1mecho "size-diff-percent=$percent" >> $GITHUB_OUTPUT�[0m
 �[36;1m�[0m
 �[36;1m# Only comment when size is bigger than baseline; optionally require per-image thresholds�[0m
 �[36;1mTHRESHOLDS="$SIZE_THRESHOLDS"�[0m
 �[36;1mFAIL_THRESHOLDS="$FAIL_THRESHOLDS"�[0m
 �[36;1mcomment_triggered=false�[0m
 �[36;1mfail_triggered=false�[0m
 �[36;1mif [[ $diff -gt 0 ]]; then�[0m
 �[36;1m  if [[ -z "$THRESHOLDS" ]] || [[ "$THRESHOLDS" == "{}" ]]; then�[0m
 �[36;1m    comment_triggered=true�[0m
 �[36;1m  fi�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mcolor="gray"�[0m
 �[36;1mif (( $(awk "BEGIN {print ($percent > 0.01)}") )); then�[0m
 �[36;1m  color="red"�[0m
 �[36;1melif (( $(awk "BEGIN {print ($percent < -0.01)}") )); then�[0m
 �[36;1m  color="green"�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1m# Generate report�[0m
 �[36;1mif [[ $diff -gt 0 ]]; then�[0m
 �[36;1m  emoji=...

GitHub Actions: CI / 31_🔨 Test Unit _ Unit Tests.txt: test: isolate session expiration e2e users

Conclusion: failure

View job details

ectConnection=true
   TOOL_NODE_FLAGS: --max_old_space_size=4096
   ENTERPRISE_LICENSE: MK+bpK5NveUuNlWGaQXGoy+8b74Luet82M3ZGcBB8b5P9Y+m67NEtpW64dc1d5lEWi6d0nFjCjtCMneVD7bKxodz/Cml8URKEo5P7cQb/9wmeT0MzAhYNaRFZlIGkZ3ITF59pDV2u4HZuosEDJikVRwnaJ5ZoU/pOsHSPUPhTyGNIqLeKynODtUpfwDdIKEmHxpf2yVkKjgRiIJmbWjM6A4k+MNNYXWVXHzye7GggqWVg/ZcT7nKU1CCadpLhTJiIrgrrPzil1G5DQ4xnLs3Q2tu2dILSDiW5OYw/ywu2yCMicTjMq4MLL5SXDQJj6WoJzZ54HosbvsDzOXvsdC9gI1CjhPL2uRuvC8XLrzn3vL2UgXnifzD1VrLTtdZ+aSADveqtlzYlRWtqoUFBbNw8o+YVHdhbZGR0beMoAyRbHi5EMpxpad3L+NyztUIT/Uh/IjQ/C2SQZ6jB0GKPBOPxFLN56FNhTGrffLFR++TVoBu0Iquc7kajWkNit3bVbZvbx+oFcVW2PcjQ/+i2jpJjbgtUFUKrTKxGMAXTWoDzIQQ35zNzGAy268IM4Ymp5JmsVEnBOEUkbF9yx6fzkO6xZhpsHf0muklnW0kA+Tlore/TUrBWh1/RwWlQeZlxM5NyWoRM5onQmr/k/4BmObtL1Hpmbk8oMG29z89xtE9y/4=
   NODE_VERSION: 22.22.3
   DENO_VERSION: 2.3.1
   MONGOMS_DOWNLOAD_DIR: /home/runner/work/_temp/mongodb-memory-server
   MONGOMS_PREFER_GLOBAL_PATH: false
   TURBOGHA_PORT: 41230
   TURBO_API: http://localhost:41230
   TURBO_***REDACTED***
   TURBO_TEAM: turbogha
 ##[endgroup]
 ##[group]Run missing_deps=""
 �[36;1mmissing_deps=""�[0m
 �[36;1m�[0m
 �[36;1m# Check for always-required commands�[0m
 �[36;1mfor cmd in bash git curl; do�[0m
 �[36;1m  if ! command -v "$cmd" >/dev/null 2>&1; then�[0m
 �[36;1m    missing_deps="$missing_deps $cmd"�[0m
 �[36;1m  fi�[0m
 �[36;1mdone�[0m
 �[36;1m�[0m
 �[36;1m# Check for gpg only if validation is not being skipped�[0m
 �[36;1mif [ "$INPUT_SKIP_VALIDATION" != "true" ]; then�[0m
 �[36;1m  if ! command -v gpg >/dev/null 2>&1; then�[0m
 �[36;1m    missing_deps="$missing_deps gpg"�[0m
 �[36;1m  fi�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1m# Report missing required dependencies�[0m
 �[36;1mif [ -n "$missing_deps" ]; then�[0m
 �[36;1m  echo "Error: The following required dependencies are missing:$missing_deps"�[0m
 �[36;1m  echo "Please install these dependencies before using this action."�[0m
 �[36;1m  exit 1�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mecho "All required system d...

GitHub Actions: CI / 🔨 Test Unit _ Unit Tests: test: isolate session expiration e2e users

Conclusion: failure

View job details

AbacService/4574): �[36mUser has no entity key for Virtru PDP evaluation, treating as non-compliant�[39m
     �[35msection�[39m: "VirtruPDP"
     �[35muserId�[39m: "u1"
 [17:22:21.369] �[33mWARN�[39m (AbacService/4574): �[36mInconclusive PDP decision, eviction skipped�[39m
     �[35msection�[39m: "VirtruPDP"
     �[35mrid�[39m: "r1"
     �[35muserId�[39m: "u1"
 [17:22:21.370] �[33mWARN�[39m (AbacService/4574): �[36mInconclusive PDP decision, eviction skipped�[39m
     �[35msection�[39m: "VirtruPDP"
     �[35mrid�[39m: "r1"
     �[35muserId�[39m: "u1"
 [17:22:21.371] �[33mWARN�[39m (AbacService/4574): �[36mUser has no entity key for Virtru PDP evaluation, treating as non-compliant�[39m
     �[35msection�[39m: "VirtruPDP"
     �[35muserId�[39m: "u0"
 [17:22:21.371] �[33mWARN�[39m (AbacService/4574): �[36mInconclusive PDP decision, eviction skipped�[39m
     �[35msection�[39m: "VirtruPDP"
     �[35mrid�[39m: "r1"
     �[35muserId�[39m: "u3"
 [17:22:21.375] �[33mWARN�[39m (AbacService/4574): �[36mUser has no entity key for Virtru PDP evaluation, treating as non-compliant�[39m
     �[35msection�[39m: "VirtruPDP"
     �[35muserId�[39m: "u1"
 [17:22:21.381] �[33mWARN�[39m (AbacService/4574): �[36mUser has no entity key for Virtru PDP evaluation, treating as non-compliant for all ABAC rooms�[39m
     �[35msection�[39m: "VirtruPDP"
     �[35muserId�[39m: "u1"
 [17:22:21.387] �[33mWARN�[39m (AbacService/4574): �[36mUser has no entity key for Virtru PDP evaluation, treating as non-compliant�[39m
     �[35msection�[39m: "VirtruPDP"
     �[35muserId�[39m: "u1"
 [17:22:21.389] �[33mWARN�[39m (AbacService/4574): �[36mInconclusive PDP decision, eviction skipped�[39m
     �[35msection�[39m: "VirtruPDP"
     �[35mrid�[39m: "r1"
     �[35muserId�[39m: "u1"
 [17:22:21.390] �[33mWARN�[39m (AbacService/4574): �[36mInconclusive PDP decision, eviction skipped�[39m
     �[35msection�[39m: "VirtruPDP"
     �[35mrid�[39m: "r1"
     �[35muserId�[39m: "u1"
 [17:22:21.391] �[33mWARN�[39m (Aba...
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{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/session-expiration-redirect.spec.ts
**/*.spec.ts

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

**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use .spec.ts extension for test files (e.g., login.spec.ts)

Files:

  • apps/meteor/tests/e2e/session-expiration-redirect.spec.ts
apps/meteor/tests/e2e/**/*.spec.ts

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

apps/meteor/tests/e2e/**/*.spec.ts: All test files must be created in apps/meteor/tests/e2e/ directory
Avoid using page.locator() in Playwright tests - always prefer semantic locators such as page.getByRole(), page.getByLabel(), page.getByText(), or page.getByTitle()
Use test.beforeAll() and test.afterAll() for setup/teardown in Playwright tests
Use test.step() for complex test scenarios to improve organization in Playwright tests
Group related tests in the same file
Utilize Playwright fixtures (test, page, expect) for consistency in test files
Prefer web-first assertions (toBeVisible, toHaveText, etc.) in Playwright tests
Use expect matchers for assertions (toEqual, toContain, toBeTruthy, toHaveLength, etc.) instead of assert statements in Playwright tests
Use page.waitFor() with specific conditions instead of hardcoded timeouts in Playwright tests
Implement proper wait strategies for dynamic content in Playwright tests
Maintain test isolation between test cases in Playwright tests
Ensure clean state for each test execution in Playwright tests
Ensure tests run reliably in parallel without shared state conflicts

Files:

  • apps/meteor/tests/e2e/session-expiration-redirect.spec.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/session-expiration-redirect.spec.ts
🧠 Learnings (6)
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.

Applied to files:

  • apps/meteor/tests/e2e/session-expiration-redirect.spec.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/session-expiration-redirect.spec.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/session-expiration-redirect.spec.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/session-expiration-redirect.spec.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.

Applied to files:

  • apps/meteor/tests/e2e/session-expiration-redirect.spec.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/tests/e2e/session-expiration-redirect.spec.ts
🔇 Additional comments (4)
apps/meteor/tests/e2e/session-expiration-redirect.spec.ts (4)

1-11: LGTM!


44-55: LGTM!

Per-test page cleanup via sessions/afterEach and creating the aux context via createAuxContext(browser, expiringUser1State, ...) correctly replaces the old fixture-based single-user page setup.


65-65: LGTM!

Token deletion correctly targets the dynamically created user (expiringUser1/expiringUser2) instead of the previous shared fixture users, matching the PR's isolation goal.

Also applies to: 87-98


32-42: 🎯 Functional Correctness

Double-check the api fixture scope here. test.beforeAll()/test.afterAll() can only use worker-scoped fixtures, and this suite already uses the same { api } pattern elsewhere, so the fixture definition needs to be treated as the source of truth before assuming this will fail.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

@jessicaschelly
jessicaschelly requested a review from gabriellsh July 3, 2026 19:41
@tassoevan tassoevan added the stat: QA assured Means it has been tested and approved by a company insider label Jul 3, 2026
@jessicaschelly jessicaschelly added this to the 8.7.0 milestone Jul 3, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jul 3, 2026
@dionisio-bot
dionisio-bot Bot added this pull request to the merge queue Jul 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 4, 2026
@jessicaschelly jessicaschelly removed the stat: QA assured Means it has been tested and approved by a company insider label Jul 4, 2026
@dionisio-bot dionisio-bot Bot removed the stat: ready to merge PR tested and approved waiting for merge label Jul 4, 2026
@jessicaschelly jessicaschelly added the stat: QA assured Means it has been tested and approved by a company insider label Jul 4, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jul 4, 2026
@dionisio-bot
dionisio-bot Bot added this pull request to the merge queue Jul 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 4, 2026
@tassoevan
tassoevan added this pull request to the merge queue Jul 4, 2026
Merged via the queue into develop with commit d51868c Jul 4, 2026
48 checks passed
@tassoevan
tassoevan deleted the test/session-expiration-disposable-users branch July 4, 2026 07:09
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 type: chore

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants