Skip to content

fix: livechat tags.save rejected by response validation on edit (+ e2e deflakes and Playwright GitHub annotations) - #41504

Merged
ggazzo merged 7 commits into
developfrom
test/e2e-wait-save-dismissal
Jul 22, 2026
Merged

fix: livechat tags.save rejected by response validation on edit (+ e2e deflakes and Playwright GitHub annotations)#41504
ggazzo merged 7 commits into
developfrom
test/e2e-wait-save-dismissal

Conversation

@ggazzo

@ggazzo ggazzo commented Jul 21, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Fixes flaky patterns spotted in recent CI runs.

1. Omnichannel UI: save → reopen contextual bar race

Saving via the contextual bar closes it asynchronously once the save request resolves. Tests that clicked btnSave and immediately searched/reopened the panel could have the freshly reopened panel detached by the delayed close, making the next click retry until the test times out.

Example failure (CI run):

OC - Manage Agents [CE]- Edit and Remove › expect removing "user1" via sidebar
Test timeout of 60000ms exceeded.
locator.click: ... element was detached from the DOM, retrying
  • omnichannel-agents.spec.ts: use editAgent.save() (click + waitForDismissal) instead of raw btnSave.click() before reopening the agent info panel — same race already documented and worked around in the "Manage departments" test in this file.
  • omnichannel-tags.spec.ts: same, via editTag.save().
  • omnichannel-business-hours.spec.ts: no FlexTab here, so assert btnSave is gone after saving — same guard already used by the "Toggle BH active status" test in this file.

All remaining btnSave.click() call sites were audited: they are followed by assertions that implicitly wait for the save to take effect, so no race window.

2. Rooms API: username rename propagation (failure on this PR's run)

update group dms name tests waited a fixed sleep(300) for the rename to propagate to DM subscription names, which is not enough on slower runners (failed on FIPS). Replaced with a poll on subscriptions.getOne (up to ~5s).

3. E2EE file encryption: message sent before room key is ready (failure on this PR's run)

With E2E_Allow_Unencrypted_Messages on, sending right after opening a freshly created encrypted room can go out unencrypted if the room key is still being set up — the key icon assertion then fails. Added the same encryptionNotReadyIndicator guard the encryption-decryption spec already uses to the file-encryption spec's beforeEach.

4. Threads: first assertion after opening the thread panel (failure on another run)

Opening the thread contextual bar fetches the thread messages; on coverage-instrumented runners this can exceed the default 5s expect timeout while the panel still shows its loading state (confirmed via the run's trace screenshot). Extended the first content assertion to 15s in both tests of the hideFlexTab describe.

5. CI: Playwright github reporter

Enabled conditionally (GITHUB_ACTIONS === 'true'), so failed tests become check-run annotations — visible in the PR diff and queryable via gh api repos/.../check-runs/<job_id>/annotations — instead of requiring log archaeology.

6. Product bug: livechat/tags.save always failed response validation on edit (failure on this PR's run)

The dismissal wait added in item 1 exposed a real bug: BaseRaw.updateOne/insertOne mutate the update object via setUpdatedAt, so LivechatTag.createOrUpdateTag returned its local record with an injected _updatedAt. The tags.save response schema declares additionalProperties: false (its type intentionally omits _updatedAt), so every tag edit returned error-invalid-body 400 while the write itself succeeded — the UI kept the contextual bar open with an error toast, and the old test flow passed without ever saving anything (trace evidence: request payload correct, response 400 with the saved tag embedded in the error body).

Fixed by rebuilding the declared return shape in createOrUpdateTag instead of returning the mutated record. Changeset added.

Issue(s)

Steps to test or reproduce

Run the affected specs; the races are timing-dependent (reproduce under CI load):

yarn test:e2e tests/e2e/omnichannel/omnichannel-agents.spec.ts tests/e2e/omnichannel/omnichannel-tags.spec.ts tests/e2e/omnichannel/omnichannel-business-hours.spec.ts tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts

Further comments

Summary by CodeRabbit

  • Tests
    • Improved end-to-end reliability for omnichannel “Edit and Remove” flows by persisting edits through the save action and tightening post-save assertions.
    • Updated business-hours and tag-department scenarios to confirm the edit form dismisses and selection state updates before proceeding.
    • Strengthened end-to-end encryption coverage by waiting for room encryption readiness before validating messages and files.
    • Reduced flakiness in API room direct-message rename tests by polling for subscription updates instead of fixed delays.
    • Added a page-object helper to verify the currently selected department during tag editing.
  • Chores / Configuration
    • Enabled the GitHub test reporter automatically when running in GitHub Actions.

Task: ARCH-2291

Saving via the contextual bar closes it asynchronously once the request
resolves. Tests that clicked Save and immediately reopened the panel
could have it detached by the delayed close, causing timeouts
(e.g. 'OC - Manage Agents [CE]- Edit and Remove').

Use the FlexTab save() helper (click + waitForDismissal) where available
and assert form dismissal for the business hours page.
@dionisio-bot

dionisio-bot Bot commented Jul 21, 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 21, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c4fb434

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 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

End-to-end tests now synchronize omnichannel saves, encrypted-room readiness, and asynchronous subscription updates before continuing with assertions. Playwright also enables GitHub reporting in GitHub Actions.

Changes

E2E test synchronization

Layer / File(s) Summary
Omnichannel save dismissal
apps/meteor/tests/e2e/omnichannel/omnichannel-agents.spec.ts, apps/meteor/tests/e2e/omnichannel/omnichannel-tags.spec.ts, apps/meteor/tests/e2e/omnichannel/omnichannel-business-hours.spec.ts, apps/meteor/tests/e2e/page-objects/omnichannel/omnichannel-tags.ts
Agent and tag tests use page-object save methods and validate department selection, while business-hours tests verify save-form dismissal before continuing.
Encryption readiness synchronization
apps/meteor/tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts
The file-encryption test polls room state until encryption readiness reports READY.
Subscription propagation polling
apps/meteor/tests/end-to-end/api/rooms.ts
Room API tests poll subscription name and fname fields instead of relying on fixed delays.
Conditional CI reporting
apps/meteor/playwright.config.ts
The Playwright configuration adds the GitHub reporter when running in GitHub Actions.

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

Possibly related PRs

Suggested labels: type: chore

Suggested reviewers: kevlehman, gabriellsh

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main test-deflaking changes and the Playwright GitHub reporter addition.

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 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.67%. Comparing base (30623d9) to head (0f4fdfa).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #41504      +/-   ##
===========================================
- Coverage    68.69%   68.67%   -0.03%     
===========================================
  Files         4134     4134              
  Lines       160417   160417              
  Branches     29312    29213      -99     
===========================================
- Hits        110205   110169      -36     
- Misses       45104    45136      +32     
- Partials      5108     5112       +4     
Flag Coverage Δ
e2e 58.88% <ø> (-0.01%) ⬇️
e2e-api 45.61% <ø> (+0.26%) ⬆️
unit 70.63% <ø> (-0.07%) ⬇️

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.

@ggazzo ggazzo added this to the 8.8.0 milestone Jul 21, 2026
@ggazzo
ggazzo marked this pull request as ready for review July 21, 2026 22:23
@ggazzo
ggazzo requested a review from a team as a code owner July 21, 2026 22:23
@ggazzo ggazzo changed the title test: wait for contextual bar dismissal after save in omnichannel e2e test(flaky): wait for contextual bar dismissal after save in omnichannel e2e Jul 21, 2026

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

🧹 Nitpick comments (1)
apps/meteor/tests/e2e/omnichannel/omnichannel-agents.spec.ts (1)

84-85: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the duplicated inline implementation comments.

The save-helper changes are correct, but both comments violate the repository rule to avoid code comments in TypeScript/JavaScript implementation. Move the rationale into the relevant step names or page-object documentation.

  • apps/meteor/tests/e2e/omnichannel/omnichannel-agents.spec.ts#L84-L85: remove the comment while retaining editAgent.save().
  • apps/meteor/tests/e2e/omnichannel/omnichannel-tags.spec.ts#L100-L101: remove the comment while retaining editTag.save().
🤖 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/omnichannel/omnichannel-agents.spec.ts` around lines 84
- 85, Remove the inline implementation comment before editAgent.save() in
apps/meteor/tests/e2e/omnichannel/omnichannel-agents.spec.ts:84-85 while
retaining the save call. Also remove the corresponding comment before
editTag.save() in
apps/meteor/tests/e2e/omnichannel/omnichannel-tags.spec.ts:100-101 while
retaining that call; preserve the rationale through existing step names or
page-object documentation if needed.

Source: Coding guidelines

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

Nitpick comments:
In `@apps/meteor/tests/e2e/omnichannel/omnichannel-agents.spec.ts`:
- Around line 84-85: Remove the inline implementation comment before
editAgent.save() in
apps/meteor/tests/e2e/omnichannel/omnichannel-agents.spec.ts:84-85 while
retaining the save call. Also remove the corresponding comment before
editTag.save() in
apps/meteor/tests/e2e/omnichannel/omnichannel-tags.spec.ts:100-101 while
retaining that call; preserve the rationale through existing step names or
page-object documentation if needed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c029825e-ef54-4eb9-a700-9169e8a03d7e

📥 Commits

Reviewing files that changed from the base of the PR and between 30623d9 and c06918f.

📒 Files selected for processing (3)
  • apps/meteor/tests/e2e/omnichannel/omnichannel-agents.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-business-hours.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-tags.spec.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (19)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Hacktron Security Check
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (5/5)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (2/5)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (3/5)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (4/5)
  • GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (2/4)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (1/5)
  • GitHub Check: 🔨 Test API Livechat (FIPS) / MongoDB 8.0 (1/1)
  • GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (1/4)
  • GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (4/4)
  • GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (3/4)
  • GitHub Check: 🔨 Test API (EE) / MongoDB 8.0 coverage (1/1)
  • GitHub Check: 🔨 Test API (FIPS) / MongoDB 8.0 (1/1)
  • GitHub Check: 🔨 Test API Livechat (EE) / MongoDB 8.0 coverage (1/1)
  • GitHub Check: 🔨 Test API (CE) / MongoDB 8.0 (1/1)
  • GitHub Check: 🔨 Test API Apps (node-runtime - EE) / MongoDB 8.0 coverage (1/1)
  • GitHub Check: 🔨 Test API Livechat (CE) / MongoDB 8.0 (1/1)
  • GitHub Check: 🔨 Test Federation Matrix
🧰 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/omnichannel/omnichannel-agents.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-business-hours.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-tags.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/omnichannel/omnichannel-agents.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-business-hours.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-tags.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/omnichannel/omnichannel-agents.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-business-hours.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-tags.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/omnichannel/omnichannel-agents.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-business-hours.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-tags.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/omnichannel/omnichannel-agents.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-business-hours.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-tags.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/omnichannel/omnichannel-agents.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-business-hours.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-tags.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/omnichannel/omnichannel-agents.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-business-hours.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-tags.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/omnichannel/omnichannel-agents.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-business-hours.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-tags.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/omnichannel/omnichannel-agents.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-business-hours.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-tags.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/omnichannel/omnichannel-agents.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-business-hours.spec.ts
  • apps/meteor/tests/e2e/omnichannel/omnichannel-tags.spec.ts
🔇 Additional comments (2)
apps/meteor/tests/e2e/omnichannel/omnichannel-tags.spec.ts (1)

117-117: LGTM!

apps/meteor/tests/e2e/omnichannel/omnichannel-business-hours.spec.ts (1)

97-98: LGTM!

Also applies to: 113-113

@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 3 files

Re-trigger cubic

dougfabris
dougfabris previously approved these changes Jul 21, 2026
- rooms API: renaming a user updates DM subscription names
  asynchronously; poll subscriptions.getOne instead of a fixed
  300ms sleep, which is not enough on slower runners (FIPS).
- e2ee file encryption: wait for the room key to be ready before
  sending, otherwise the message goes out unencrypted and the key
  icon assertion fails (same guard already used by the
  encryption-decryption spec).
@ggazzo
ggazzo requested a review from a team as a code owner July 22, 2026 00:04

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/meteor/tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts (1)

54-54: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove implementation comments from the changed TypeScript tests.

As per coding guidelines, TypeScript/Playwright test implementations should avoid code comments.

  • apps/meteor/tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts#L54-L54: remove the synchronization comment.
  • apps/meteor/tests/end-to-end/api/rooms.ts#L2767-L2767: remove the polling rationale comment.
🤖 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/e2e-encryption/e2ee-file-encryption.spec.ts` at line
54, Remove the implementation comment near the room-key synchronization in
apps/meteor/tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts:54-54 and
remove the polling rationale comment in
apps/meteor/tests/end-to-end/api/rooms.ts:2767-2767; leave the surrounding test
logic unchanged.

Source: Coding guidelines

🤖 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 `@apps/meteor/tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts`:
- Line 55: Update the readiness wait around
EncryptedRoomPage.encryptionNotReadyIndicator so the test first waits for the
indicator to attach during key initialization, then waits for it to become not
visible before uploading. Do not rely solely on not.toBeVisible(), which can
pass before the indicator mounts.

---

Nitpick comments:
In `@apps/meteor/tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts`:
- Line 54: Remove the implementation comment near the room-key synchronization
in apps/meteor/tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts:54-54 and
remove the polling rationale comment in
apps/meteor/tests/end-to-end/api/rooms.ts:2767-2767; leave the surrounding test
logic unchanged.
🪄 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

Run ID: 3de0be3d-735a-4d60-83b0-730e04cde026

📥 Commits

Reviewing files that changed from the base of the PR and between c06918f and ffb91e1.

📒 Files selected for processing (2)
  • apps/meteor/tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts
  • apps/meteor/tests/end-to-end/api/rooms.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: Hacktron Security Check
  • GitHub Check: CodeQL-Build
⚠️ CI failures not shown inline (5)

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ✅ **Has milestone or project**
- ✅ **Valid PR title**
- ✅ **Correct target version**
🧰 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/e2e-encryption/e2ee-file-encryption.spec.ts
  • apps/meteor/tests/end-to-end/api/rooms.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/e2e-encryption/e2ee-file-encryption.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/e2e-encryption/e2ee-file-encryption.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/e2e-encryption/e2ee-file-encryption.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/e2e-encryption/e2ee-file-encryption.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/e2e-encryption/e2ee-file-encryption.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/e2e-encryption/e2ee-file-encryption.spec.ts
  • apps/meteor/tests/end-to-end/api/rooms.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/e2e-encryption/e2ee-file-encryption.spec.ts
  • apps/meteor/tests/end-to-end/api/rooms.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/e2e-encryption/e2ee-file-encryption.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/e2e-encryption/e2ee-file-encryption.spec.ts
  • apps/meteor/tests/end-to-end/api/rooms.ts
🔇 Additional comments (2)
apps/meteor/tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts (1)

3-3: LGTM!

apps/meteor/tests/end-to-end/api/rooms.ts (1)

2768-2778: LGTM!

Also applies to: 2791-2791, 2814-2814

Comment thread apps/meteor/tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts Outdated

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

All reported issues were addressed across 2 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/meteor/tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts Outdated
ggazzo added 5 commits July 21, 2026 21:23
The unencrypted-message hint only mounts after the E2EE room state
hook fires, so asserting it is not visible can pass before the room
key exists. Poll the client E2ERoom state for READY instead.

Also drop implementation comments from tests per coding guidelines.
TagEdit submits through useFormSubmitWithDirtyCheck: when the
department selection is not registered the form is not dirty, so
saving is a no-op and the contextual bar stays open. Assert the
selected-department chip before saving so a lost selection fails
at the right spot instead of timing out on dismissal.
Failed tests become check-run annotations (visible in the PR diff and
via the check-runs API) instead of requiring log archaeology.
Opening the thread contextual bar fetches the thread messages; on
coverage-instrumented runners this can exceed the default 5s expect
timeout while the panel still shows its loading state.
BaseRaw updateOne/insertOne mutate the update object via setUpdatedAt,
so createOrUpdateTag returned the record with an injected _updatedAt.
The tags.save response schema declares additionalProperties: false
(intentionally omitting _updatedAt), so every tag edit failed with
error-invalid-body 400 while the write itself succeeded — the UI kept
the contextual bar open with an error toast.

Rebuild the declared return shape instead of returning the mutated
record.
@ggazzo ggazzo changed the title test(flaky): wait for contextual bar dismissal after save in omnichannel e2e fix: livechat tags.save rejected by response validation on edit (+ e2e deflakes and Playwright GitHub annotations) Jul 22, 2026
@ggazzo

ggazzo commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

/jira ARCH

@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Jul 22, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jul 22, 2026
@ggazzo
ggazzo added this pull request to the merge queue Jul 22, 2026
Merged via the queue into develop with commit eb99fc4 Jul 22, 2026
54 checks passed
@ggazzo
ggazzo deleted the test/e2e-wait-save-dismissal branch July 22, 2026 16:33
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.

3 participants