Skip to content

test: fix flaky livechat message assertion after reload - #42055

Open
jessicaschelly wants to merge 1 commit into
developfrom
test/fix-livechat-duplicate-message-flake
Open

test: fix flaky livechat message assertion after reload#42055
jessicaschelly wants to merge 1 commit into
developfrom
test/fix-livechat-duplicate-message-flake

Conversation

@jessicaschelly

@jessicaschelly jessicaschelly commented Sep 4, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Stabilizes the OC - Livechat - Send message to livechat customer E2E test after reloading the livechat widget.

The serial suite sent this_a_test_message_from_user in two consecutive tests that reused the same visitor and conversation. When both messages were rendered, Playwright's strict locator matched two elements and failed. This change gives the post-reload message unique text so the assertion can only match the newly sent message.

Issue(s)

FLAKY-1414

Steps to test or reproduce

Run the affected suite five times with one worker:

yarn workspace @rocket.chat/meteor test:e2e tests/e2e/omnichannel/omnichannel-livechat.spec.ts --repeat-each=5 --workers=1

Further comments

This is a test-only change and does not affect product behavior.

Review in cubic

Summary by CodeRabbit

  • Tests
    • Improved end-to-end coverage for Livechat unread-counter behavior after a page reload.
    • Verification now uses a distinct test message to more reliably confirm that the correct message remains visible while the unread count is cleared.

@dionisio-bot

dionisio-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

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

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 471ddf2

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 Sep 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: a36ee89c-bdbb-41c1-b418-b6203cb75361

📥 Commits

Reviewing files that changed from the base of the PR and between 67f2bda and 471ddf2.

📒 Files selected for processing (1)
  • apps/meteor/tests/e2e/omnichannel/omnichannel-livechat.spec.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (8)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: 🔎 Code Check / TypeScript
  • GitHub Check: 🔨 Test Storybook / Test Storybook
  • GitHub Check: 🔨 Test Unit / Unit Tests
  • GitHub Check: 🔎 Code Check / Code Lint
  • GitHub Check: 📦 Meteor Build (coverage)
  • GitHub Check: Hacktron Security Check
  • GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (4)
Store commonly used locators in variables/constants for reuse Follow Page Object Model pattern consistently in Playwright tests

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

Files:

  • apps/meteor/tests/e2e/omnichannel/omnichannel-livechat.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...

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

Files:

  • apps/meteor/tests/e2e/omnichannel/omnichannel-livechat.spec.ts
Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests Avoid code comments in the implementation

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

Files:

  • apps/meteor/tests/e2e/omnichannel/omnichannel-livechat.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`)

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

Files:

  • apps/meteor/tests/e2e/omnichannel/omnichannel-livechat.spec.ts
🔇 Additional comments (1)
apps/meteor/tests/e2e/omnichannel/omnichannel-livechat.spec.ts (1)

93-98: LGTM!


Walkthrough

The livechat end-to-end test now uses a distinct message constant after reload and verifies that exact message after sending.

Changes

Livechat test update

Layer / File(s) Summary
Reload message assertion
apps/meteor/tests/e2e/omnichannel/omnichannel-livechat.spec.ts
The test defines a distinct message constant, sends it through the agent composer, and verifies its visibility.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 471dd

The livechat E2E test now verifies a unique message after reload, preventing duplicate-message assertion failures. No current merge-blocking risk remains.

Suggested labels: type: chore

🚥 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 and concisely describes the test-only fix for the flaky livechat message assertion after reload.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

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.

@jessicaschelly
jessicaschelly marked this pull request as ready for review September 4, 2026 22:47
@jessicaschelly
jessicaschelly requested a review from a team as a code owner September 4, 2026 22:47

@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

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.32%. Comparing base (67f2bda) to head (471ddf2).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #42055      +/-   ##
===========================================
+ Coverage    69.31%   69.32%   +0.01%     
===========================================
  Files         4289     4289              
  Lines       171486   171486              
  Branches     31088    31008      -80     
===========================================
+ Hits        118862   118889      +27     
+ Misses       47451    47429      -22     
+ Partials      5173     5168       -5     
Flag Coverage Δ
unit 70.97% <ø> (+0.01%) ⬆️

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.

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