Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

test: improve e2ee encryption tests to use page objects

Open jessicaschelly opened this issue 3 months ago • 5 comments

Proposed changes (including videos or screenshots)

1. Page Object Pattern Implementation

  • Replaced direct Playwright selectors with reusable page object methods
  • Created new page object fragments:
    • PinnedMessagesTab - for pinned messages interactions
    • StarredMessagesTab - for starred messages interactions
    • RoomToolbar - for room toolbar actions
  • Enhanced existing fragments:
    • E2EEMessageActions - for E2EE-specific message actions
    • CreateE2EEChannel - for encrypted channel creation with cleanup tracking
    • Message - added encryptedIcon getter

Issue(s)

https://rocketchat.atlassian.net/browse/ESH-34

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Tests
    • Improved E2EE end-to-end tests to use modal and component helpers for enabling/disabling encryption.
    • Added abstractions for pinned/starred message views and E2EE message actions to improve test stability.
    • Standardized mention, thread, toolbar, and message interactions, replacing fragile locator-based checks.
    • Removed unnecessary pre-test cleanup and consolidated shared test setup for consistency.

✏️ Tip: You can customize this high-level summary in your review settings.

jessicaschelly avatar Nov 07 '25 16:11 jessicaschelly

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 targeting the wrong base branch. It should target 7.14.0, but it targets 7.13.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

dionisio-bot[bot] avatar Nov 07 '25 16:11 dionisio-bot[bot]

⚠️ No Changeset found

Latest commit: 55250089a95fdc2968d1c1ae57bf0d3fca894e45

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

changeset-bot[bot] avatar Nov 07 '25 16:11 changeset-bot[bot]

Walkthrough

Refactors E2EE end-to-end tests to replace direct DOM interactions with new page-object fragments and modal helpers (EncryptedRoomPage, Enable/DisableRoomEncryptionModal, PinnedMessagesTab, StarredMessagesTab, E2EEMessageActions), and updates tests to initialize and use these abstractions consistently.

Changes

Cohort / File(s) Summary
E2EE test specs
apps/meteor/tests/e2e/e2e-encryption/e2ee-encrypted-channels.spec.ts, apps/meteor/tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts, apps/meteor/tests/e2e/e2e-encryption/e2ee-key-reset.spec.ts, apps/meteor/tests/e2e/e2e-encryption/e2ee-legacy-format.spec.ts, apps/meteor/tests/e2e/e2e-encryption/e2ee-otr.spec.ts, apps/meteor/tests/e2e/e2e-encryption/e2ee-passphrase-management.spec.ts, apps/meteor/tests/e2e/e2e-encryption/e2ee-server-settings.spec.ts
Replace direct DOM locators and manual modal handling with page-object APIs; initialize EncryptedRoomPage and modal/page-object helpers in beforeEach; use modal methods for enable/disable flows; switch encrypted-icon checks to encryptedRoomPage.lastMessage.encryptedIcon; refactor message/thread/pinned/starred flows to use fragments.
Page-object fragments — pinned / starred
apps/meteor/tests/e2e/page-objects/fragments/pinned-messages-tab.ts, apps/meteor/tests/e2e/page-objects/fragments/starred-messages-tab.ts
Add PinnedMessagesTab and StarredMessagesTab classes with constructor, openTab(), openLastMessageMenu() and lastMessage getter to interact with respective dialogs.
E2EE message actions fragment
apps/meteor/tests/e2e/page-objects/fragments/e2ee.ts
Add E2EEMessageActions class exposing locators for forward, reply-in-DM and copy-link options and encapsulating E2EE message action interactions.
Home & Message helpers
apps/meteor/tests/e2e/page-objects/fragments/home-content.ts, apps/meteor/tests/e2e/page-objects/fragments/message.ts
Add getUserMention(username) and getChannelMention(channelName) to HomeContent; add moreButton getter and openMenu() method to Message.
Fragments index & toolbar changes
apps/meteor/tests/e2e/page-objects/fragments/index.ts, apps/meteor/tests/e2e/page-objects/fragments/toolbar.ts
Re-export pinned/starred fragments in fragments index; change RoomToolbar constructor to retain page and resolve some menu item locators via page scope instead of root.
Tests wiring & imports
apps/meteor/tests/e2e/e2e-encryption/* (multiple specs)
Add imports and top-level declarations for new page-object classes (e.g., EncryptedRoomPage, EnableRoomEncryptionModal, DisableRoomEncryptionModal, PinnedMessagesTab, StarredMessagesTab) and wire them into test lifecycles.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Files/areas to pay extra attention to:
    • e2ee-passphrase-management.spec.ts (many shared page-object initializations and navigation/state flows)
    • pinned-messages-tab.ts and starred-messages-tab.ts (dialog selectors and scoping of last message)
    • toolbar.ts (changing locator resolution from root → page may affect selectors)
    • e2ee.ts (new E2EE message actions selectors and waits)

Possibly related PRs

  • RocketChat/Rocket.Chat#36969 — Refactors E2EE password/banner handling with modal/page-object helpers (closely related to modal API usage).
  • RocketChat/Rocket.Chat#36947 — Updates E2EE page-object layer (ResetE2EEPasswordModal / LoginPage integration), overlaps with page-object changes.
  • RocketChat/Rocket.Chat#37253 — Modal fragment refactor that intersects Enable/DisableRoomEncryptionModal usage and APIs.

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • dougfabris
  • tassoevan

Poem

🐰
I hopped through tests with whiskers bright,
I nudged the modals into gentle light,
Page-objects tidy every thread and stream,
I chew loose bugs and tidy up the team,
A tiny rabbit guards the E2EE dream. 🥕

Pre-merge checks and finishing touches

✅ 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 directly summarizes the main change: refactoring E2EE encryption tests to adopt page object patterns.
Linked Issues check ✅ Passed The PR implements all core requirements: refactors E2EE tests using page objects, maintains test coverage, and improves code reusability and maintainability as specified in ESH-34.
Out of Scope Changes check ✅ Passed All changes directly support the page object refactoring objective. No unrelated modifications or scope drift detected beyond test framework improvements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch test/e2ee-page-imp

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2c5711fa2c1dc50eee6e0f232bb1d0b862677777 and 55250089a95fdc2968d1c1ae57bf0d3fca894e45.

📒 Files selected for processing (1)
  • apps/meteor/tests/e2e/page-objects/fragments/home-content.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/meteor/tests/e2e/page-objects/fragments/home-content.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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

coderabbitai[bot] avatar Nov 07 '25 16:11 coderabbitai[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 68.86%. Comparing base (44ca3b1) to head (5525008). :warning: Report is 51 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37444      +/-   ##
===========================================
- Coverage    68.98%   68.86%   -0.12%     
===========================================
  Files         3359     3361       +2     
  Lines       114213   114390     +177     
  Branches     20535    20668     +133     
===========================================
- Hits         78788    78773      -15     
- Misses       33334    33523     +189     
- Partials      2091     2094       +3     
Flag Coverage Δ
e2e 57.27% <ø> (-0.18%) :arrow_down:
e2e-api 42.22% <ø> (-0.67%) :arrow_down:

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

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

codecov[bot] avatar Nov 07 '25 16:11 codecov[bot]

📦 Docker Image Size Report

📈 Changes

Service Current Baseline Change Percent
sum of all images 1.2GiB 1.2GiB +12MiB
rocketchat 359MiB 347MiB +12MiB
omnichannel-transcript-service 132MiB 132MiB -137B
queue-worker-service 132MiB 132MiB -186B
ddp-streamer-service 126MiB 126MiB -1000B
account-service 113MiB 113MiB -609B
stream-hub-service 111MiB 111MiB -227B
authorization-service 111MiB 111MiB +111B
presence-service 111MiB 111MiB +805B

📊 Historical Trend

---
config:
  theme: "dark"
  xyChart:
    width: 900
    height: 400
---
xychart
  title "Image Size Evolution by Service (Last 30 Days + This PR)"
  x-axis ["11/15 22:28", "11/16 01:28", "11/17 23:50", "11/18 22:53", "11/19 23:02", "11/21 16:49", "11/24 17:34", "11/27 22:32", "11/28 19:05", "12/01 23:01", "12/02 21:57", "12/03 16:24 (PR)"]
  y-axis "Size (GB)" 0 --> 0.5
  line "account-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
  line "authorization-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
  line "ddp-streamer-service" [0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12]
  line "omnichannel-transcript-service" [0.14, 0.14, 0.14, 0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13]
  line "presence-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
  line "queue-worker-service" [0.14, 0.14, 0.14, 0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13]
  line "rocketchat" [0.36, 0.36, 0.35, 0.35, 0.35, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.35]
  line "stream-hub-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]

Statistics (last 11 days):

  • 📊 Average: 1.5GiB
  • ⬇️ Minimum: 1.2GiB
  • ⬆️ Maximum: 1.6GiB
  • 🎯 Current PR: 1.2GiB
ℹ️ About this report

This report compares Docker image sizes from this build against the develop baseline.

  • Tag: pr-37444
  • Baseline: develop
  • Timestamp: 2025-12-03 16:24:39 UTC
  • Historical data points: 11

Updated: Wed, 03 Dec 2025 16:24:40 GMT

github-actions[bot] avatar Nov 19 '25 17:11 github-actions[bot]