-
Notifications
You must be signed in to change notification settings - Fork 13k
test: add tags to the room #36869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add tags to the room #36869
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #36869 +/- ##
===========================================
- Coverage 67.36% 66.29% -1.08%
===========================================
Files 3330 3383 +53
Lines 113482 115648 +2166
Branches 20604 21332 +728
===========================================
+ Hits 76449 76670 +221
- Misses 34424 36363 +1939
- Partials 2609 2615 +6
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
WalkthroughRenders room tags as a semantic, accessible list tied to Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Agent
participant UI as Omnichannel UI
participant BE as Server
participant Rules as Dept/Tag Rules
Agent->>UI: Open Room Info (uses `roomId`)
UI->>BE: Request room + allowed tags
BE->>Rules: Apply department/shared/public filters
Rules-->>BE: Return allowed tags
BE-->>UI: Allowed tags list
Note right of UI #DDEBF7: Render tags as semantic list\n<ul aria-labelledby="..."> with `li` items
UI-->>Agent: Show allowed tags list
Agent->>UI: Select tag options
UI->>BE: Save selected tags
BE->>Rules: Validate selections
Rules-->>BE: Confirm
BE-->>UI: Persisted tags
UI-->>Agent: Show updated tags in room info
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (6)
apps/meteor/client/views/omnichannel/directory/chats/ChatInfo/ChatInfo.tsx (1)
125-136: Make the tag list bulletless, keep tags inline, and guard ARIA id when roomId is missing.Prevents default bullets and minor a11y edge case when
roomIdis undefined; also drops unnecessary inline style on Tag.Apply this diff:
- <InfoPanelLabel id={`${roomId}-tags`}>{t('Tags')}</InfoPanelLabel> + <InfoPanelLabel id={roomId ? `${roomId}-tags` : 'room-tags'}>{t('Tags')}</InfoPanelLabel> <InfoPanelText> - <ul aria-labelledby={`${roomId}-tags`}> + <Box + is='ul' + aria-labelledby={roomId ? `${roomId}-tags` : 'room-tags'} + p={0} + m={0} + style={{ listStyle: 'none' }} + > {tags.map((tag) => ( <Box is='li' key={tag} mie={4} display='inline'> - <Tag style={{ display: 'inline' }} disabled> + <Tag disabled> {tag} </Tag> </Box> ))} - </ul> + </Box>apps/meteor/tests/e2e/page-objects/omnichannel-room-info.ts (2)
56-58: Scope and strengthen the Tags input locator.Rely on the field label within the Edit Room dialog instead of placeholder text; this is more stable and avoids cross-page collisions.
Apply this diff:
- get inputTags(): Locator { - return this.page.getByRole('textbox', { name: 'Select an option' }); - } + get inputTags(): Locator { + return this.dialogEditRoom.getByLabel('Tags'); + }
68-70: Avoid substring matches when asserting tag chips in the list.Use exact text matching to prevent false positives (e.g., Tag vs TagA).
Apply this diff:
- getTagInfoByLabel(label: string): Locator { - return this.dialogRoomInfo.getByRole('list', { name: 'Tags' }).getByText(label); - } + getTagInfoByLabel(label: string): Locator { + return this.dialogRoomInfo.getByRole('list', { name: 'Tags' }).getByText(label, { exact: true }); + }apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts (3)
27-45: Optional: remove inline comments from tests per repo guidelines.Keeps e2e code concise and consistent with the project’s no-comments preference for test implementations.
69-75: Optional: wait for the Edit Room dialog before interacting.Add a web-first assertion to stabilize interactions under load.
You can insert this just after clicking Edit:
await expect(poOmnichannel.roomInfo.dialogEditRoom).toBeVisible();
76-90: Visibility-negative assertions can be flaky; consider presence checks.When asserting non-visibility of TagB, also assert the listbox/options are rendered to avoid false passes due to missing overlay.
Example:
await expect(poOmnichannel.roomInfo.optionTags('TagA')).toBeVisible(); await expect(poOmnichannel.roomInfo.optionTags('TagB')).not.toBeVisible();
📜 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.
📒 Files selected for processing (3)
apps/meteor/client/views/omnichannel/directory/chats/ChatInfo/ChatInfo.tsx(2 hunks)apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts(1 hunks)apps/meteor/tests/e2e/page-objects/omnichannel-room-info.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
apps/meteor/tests/e2e/page-objects/**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Utilize and place Page Object implementations under apps/meteor/tests/e2e/page-objects/
Files:
apps/meteor/tests/e2e/page-objects/omnichannel-room-info.ts
apps/meteor/tests/e2e/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
apps/meteor/tests/e2e/**/*.{ts,tsx,js,jsx}: Write concise, technical TypeScript/JavaScript with accurate typing
Follow DRY by extracting reusable logic into helper functions or page objects
Avoid code comments in the implementation
Files:
apps/meteor/tests/e2e/page-objects/omnichannel-room-info.tsapps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
apps/meteor/tests/e2e/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
apps/meteor/tests/e2e/**/*.{ts,tsx}: Avoid using page.locator(); prefer semantic locators like page.getByRole, page.getByLabel, page.getByText, and page.getByTitle
Store commonly used locators in variables/constants for reuse
Use page.waitFor() with specific conditions and avoid hardcoded timeouts
Implement proper wait strategies for dynamic content
Follow the Page Object Model pattern consistently
Files:
apps/meteor/tests/e2e/page-objects/omnichannel-room-info.tsapps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
apps/meteor/tests/e2e/**/*.spec.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
apps/meteor/tests/e2e/**/*.spec.ts: All Playwright test files must be located under apps/meteor/tests/e2e/ and use the .spec.ts extension (e.g., login.spec.ts)
Use descriptive test names that clearly communicate expected behavior
Use test.beforeAll() and test.afterAll() for setup and teardown
Use test.step() to organize complex test scenarios
Group related tests in the same file
Utilize Playwright fixtures (test, page, expect) consistently
Prefer web-first assertions (e.g., toBeVisible, toHaveText)
Use expect matchers (toEqual, toContain, toBeTruthy, toHaveLength, etc.) instead of assert statements
Maintain test isolation between test cases
Ensure a clean state for each test execution
Ensure tests run reliably in parallel without shared state conflicts
Files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
🧠 Learnings (6)
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,tsx} : Avoid using page.locator(); prefer semantic locators like page.getByRole, page.getByLabel, page.getByText, and page.getByTitle
Applied to files:
apps/meteor/tests/e2e/page-objects/omnichannel-room-info.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/page-objects/**/*.ts : Utilize and place Page Object implementations under apps/meteor/tests/e2e/page-objects/
Applied to files:
apps/meteor/tests/e2e/page-objects/omnichannel-room-info.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,tsx} : Store commonly used locators in variables/constants for reuse
Applied to files:
apps/meteor/tests/e2e/page-objects/omnichannel-room-info.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,tsx} : Follow the Page Object Model pattern consistently
Applied to files:
apps/meteor/tests/e2e/page-objects/omnichannel-room-info.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use descriptive test names that clearly communicate expected behavior
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
🧬 Code graph analysis (1)
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts (3)
apps/meteor/tests/mocks/data.ts (1)
createFakeVisitor(309-314)apps/meteor/tests/e2e/page-objects/home-omnichannel.ts (1)
HomeOmnichannel(14-67)apps/meteor/tests/data/livechat/rooms.ts (1)
createAgent(198-212)
🔇 Additional comments (3)
apps/meteor/client/views/omnichannel/directory/chats/ChatInfo/ChatInfo.tsx (1)
56-56: Good: clearer aliasing of room id.Destructuring
_idintoroomIdimproves readability and makes the ARIA linkage clearer downstream.apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts (2)
31-35: Verify agent creation/idempotency and downstream identifiers.You’re upgrading
user1to agent and later referencingagentId: 'user1'. Ensure:
createAgent(api, 'user1')is idempotent across parallel suites.addAgentToDepartmentexpects the identifier you pass (username vs userId). Prefer passing the exact identifier returned bycreateAgent.
98-103: LGTM: verifies persisted tags via semantic list.Asserting via the labeled list matches the new accessible structure in ChatInfo.
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
Outdated
Show resolved
Hide resolved
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
Outdated
Show resolved
Hide resolved
|
Note Unit test generation is an Early Access feature. Expect some limitations and changes as we gather feedback and continue to improve it. Generating unit tests... This may take up to 20 minutes. |
|
Caution CodeRabbit plans did not produce any file changes. |
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
Outdated
Show resolved
Hide resolved
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
Outdated
Show resolved
Hide resolved
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
🧹 Nitpick comments (8)
apps/meteor/tests/e2e/page-objects/omnichannel-room-info.ts (3)
56-58: Scope the tags input to the edit dialog and use a stable accessible name.Relying on "Select an option" is brittle and not dialog-scoped. Prefer the labeled control inside Edit Room.
Apply this diff:
- get inputTags(): Locator { - return this.page.getByRole('textbox', { name: 'Select an option' }); - } + get inputTags(): Locator { + return this.dialogEditRoom.getByLabel('Tags'); + }
60-62: Scope option lookup to the open listbox to avoid cross-dialog matches.Unscoped page-level option queries can collide with other menus.
Apply this diff:
- optionTags(name: string): Locator { - return this.page.getByRole('option', { name, exact: true }); - } + optionTags(name: string): Locator { + return this.page.getByRole('listbox').getByRole('option', { name, exact: true }); + }
64-66: Ensure the dropdown is open before selecting an option.The menu may close after a selection; opening it before clicking improves reliability.
Apply this diff:
- async selectTag(name: string): Promise<void> { - await this.optionTags(name).click(); - } + async selectTag(name: string): Promise<void> { + await this.inputTags.click(); + await this.optionTags(name).click(); + }apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts (5)
35-39: Don’t await inside Promise.all; pass promises directly.Current code serializes the calls and defeats concurrency.
Apply this diff:
- test.beforeAll('Add agents to departments', async ({ api }) => { - await Promise.all([ - await addAgentToDepartment(api, { department: departmentA.data, agentId: 'user1' }), - await addAgentToDepartment(api, { department: departmentB.data, agentId: 'user1' }), - ]); - }); + test.beforeAll('Add agents to departments', async ({ api }) => { + await Promise.all([ + addAgentToDepartment(api, { department: departmentA.data, agentId: 'user1' }), + addAgentToDepartment(api, { department: departmentB.data, agentId: 'user1' }), + ]); + });
88-92: Wait for the Edit Room dialog before interacting with the tags input.Avoid racing the dialog opening.
Apply this diff:
await test.step('check available tags', async () => { await poOmnichannel.roomInfo.btnEditRoomInfo.click(); + await expect(poOmnichannel.roomInfo.dialogEditRoom).toBeVisible(); await poOmnichannel.roomInfo.inputTags.click(); });
109-113: Reopen the dropdown before selecting the second tag.Many multiselects close after a selection; reopening avoids flakes.
Apply this diff:
await test.step('add tags and save', async () => { await poOmnichannel.roomInfo.selectTag('TagA'); + await poOmnichannel.roomInfo.inputTags.click(); await poOmnichannel.roomInfo.selectTag('GlobalTag'); await poOmnichannel.roomInfo.btnSaveEditRoom.click(); });
122-127: Also wait for the Edit Room dialog in the second scenario.Mirror the wait used above for consistency and stability.
Apply this diff:
await test.step('Open room info', async () => { await poOmnichannel.sidenav.getSidebarItemByName(visitorB.name).click(); await poOmnichannel.roomInfo.btnEditRoomInfo.click(); + await expect(poOmnichannel.roomInfo.dialogEditRoom).toBeVisible(); await poOmnichannel.roomInfo.inputTags.click(); });
27-29: Optional: add a unique slug to names to avoid cross-test collisions.Static names (Department A/B, TagA/B, GlobalTag, SharedTag) risk collisions when suites run in parallel.
Example (no diff, pattern only):
- const slug = Date.now().toString(36).slice(-4);
- Department A → Department A - ${slug}
- TagA → TagA-${slug}, etc.
Also applies to: 44-51, 56-59
📜 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.
📒 Files selected for processing (2)
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts(1 hunks)apps/meteor/tests/e2e/page-objects/omnichannel-room-info.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
apps/meteor/tests/e2e/**/*.spec.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
apps/meteor/tests/e2e/**/*.spec.ts: All Playwright test files must be located under apps/meteor/tests/e2e/ and use the .spec.ts extension (e.g., login.spec.ts)
Use descriptive test names that clearly communicate expected behavior
Use test.beforeAll() and test.afterAll() for setup and teardown
Use test.step() to organize complex test scenarios
Group related tests in the same file
Utilize Playwright fixtures (test, page, expect) consistently
Prefer web-first assertions (e.g., toBeVisible, toHaveText)
Use expect matchers (toEqual, toContain, toBeTruthy, toHaveLength, etc.) instead of assert statements
Maintain test isolation between test cases
Ensure a clean state for each test execution
Ensure tests run reliably in parallel without shared state conflicts
Files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
apps/meteor/tests/e2e/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
apps/meteor/tests/e2e/**/*.{ts,tsx,js,jsx}: Write concise, technical TypeScript/JavaScript with accurate typing
Follow DRY by extracting reusable logic into helper functions or page objects
Avoid code comments in the implementation
Files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.tsapps/meteor/tests/e2e/page-objects/omnichannel-room-info.ts
apps/meteor/tests/e2e/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
apps/meteor/tests/e2e/**/*.{ts,tsx}: Avoid using page.locator(); prefer semantic locators like page.getByRole, page.getByLabel, page.getByText, and page.getByTitle
Store commonly used locators in variables/constants for reuse
Use page.waitFor() with specific conditions and avoid hardcoded timeouts
Implement proper wait strategies for dynamic content
Follow the Page Object Model pattern consistently
Files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.tsapps/meteor/tests/e2e/page-objects/omnichannel-room-info.ts
apps/meteor/tests/e2e/page-objects/**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Utilize and place Page Object implementations under apps/meteor/tests/e2e/page-objects/
Files:
apps/meteor/tests/e2e/page-objects/omnichannel-room-info.ts
🧠 Learnings (13)
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use descriptive test names that clearly communicate expected behavior
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure a clean state for each test execution
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (test, page, expect) consistently
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,tsx} : Follow the Page Object Model pattern consistently
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,tsx} : Avoid using page.locator(); prefer semantic locators like page.getByRole, page.getByLabel, page.getByText, and page.getByTitle
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.tsapps/meteor/tests/e2e/page-objects/omnichannel-room-info.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use test.beforeAll() and test.afterAll() for setup and teardown
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use test.step() to organize complex test scenarios
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: When generating tests, provide complete runnable TypeScript test files with proper imports, clear describe/test blocks, and adherence to these guidelines
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/page-objects/**/*.ts : Utilize and place Page Object implementations under apps/meteor/tests/e2e/page-objects/
Applied to files:
apps/meteor/tests/e2e/page-objects/omnichannel-room-info.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,tsx} : Store commonly used locators in variables/constants for reuse
Applied to files:
apps/meteor/tests/e2e/page-objects/omnichannel-room-info.ts
🧬 Code graph analysis (1)
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts (3)
apps/meteor/tests/mocks/data.ts (1)
createFakeVisitor(309-314)apps/meteor/tests/e2e/page-objects/home-omnichannel.ts (1)
HomeOmnichannel(14-67)packages/core-typings/src/utils.ts (1)
Awaited(9-9)
⏰ 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). (4)
- GitHub Check: 📦 Build Packages
- GitHub Check: Builds matrix rust bindings against alpine
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🔇 Additional comments (3)
apps/meteor/tests/e2e/page-objects/omnichannel-room-info.ts (1)
68-70: LGTM: semantic locator for tag pill in room info.Using role=list with an accessible name is aligned with our guidelines.
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts (2)
84-87: Verify ‘Tags’ section visibility — assertion likely inverted with new UI.If ChatInfo now always renders a semantic Tags list in Room Information, this should assert visible (even when empty).
Apply this diff if the list is expected to be present:
- await test.step('should not be able to see tags field', async () => { - await expect(poOmnichannel.roomInfo.getInfoByLabel('Tags')).not.toBeVisible(); - }); + await test.step('Tags section is present before editing', async () => { + await expect(poOmnichannel.roomInfo.getInfoByLabel('Tags')).toBeVisible(); + });If the UI intentionally hides the section when empty, keep the negative check; please confirm against ChatInfo.tsx.
67-69: Remove manual closing of Playwright’s page fixture.The runner manages lifecycle; closing it can break other tests in the same worker.
Apply this diff:
- test.afterEach(async () => { - await poOmnichannel.page.close(); - }); + // Do not manually close the page fixture; the runner manages it.
There was a problem hiding this 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
📜 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.
📒 Files selected for processing (1)
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
apps/meteor/tests/e2e/**/*.spec.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
apps/meteor/tests/e2e/**/*.spec.ts: All Playwright test files must be located under apps/meteor/tests/e2e/ and use the .spec.ts extension (e.g., login.spec.ts)
Use descriptive test names that clearly communicate expected behavior
Use test.beforeAll() and test.afterAll() for setup and teardown
Use test.step() to organize complex test scenarios
Group related tests in the same file
Utilize Playwright fixtures (test, page, expect) consistently
Prefer web-first assertions (e.g., toBeVisible, toHaveText)
Use expect matchers (toEqual, toContain, toBeTruthy, toHaveLength, etc.) instead of assert statements
Maintain test isolation between test cases
Ensure a clean state for each test execution
Ensure tests run reliably in parallel without shared state conflicts
Files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
apps/meteor/tests/e2e/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
apps/meteor/tests/e2e/**/*.{ts,tsx,js,jsx}: Write concise, technical TypeScript/JavaScript with accurate typing
Follow DRY by extracting reusable logic into helper functions or page objects
Avoid code comments in the implementation
Files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
apps/meteor/tests/e2e/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
apps/meteor/tests/e2e/**/*.{ts,tsx}: Avoid using page.locator(); prefer semantic locators like page.getByRole, page.getByLabel, page.getByText, and page.getByTitle
Store commonly used locators in variables/constants for reuse
Use page.waitFor() with specific conditions and avoid hardcoded timeouts
Implement proper wait strategies for dynamic content
Follow the Page Object Model pattern consistently
Files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
🧠 Learnings (11)
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use descriptive test names that clearly communicate expected behavior
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure a clean state for each test execution
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (test, page, expect) consistently
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,tsx} : Follow the Page Object Model pattern consistently
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,tsx} : Avoid using page.locator(); prefer semantic locators like page.getByRole, page.getByLabel, page.getByText, and page.getByTitle
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use test.beforeAll() and test.afterAll() for setup and teardown
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use test.step() to organize complex test scenarios
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
PR: RocketChat/Rocket.Chat#0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: When generating tests, provide complete runnable TypeScript test files with proper imports, clear describe/test blocks, and adherence to these guidelines
Applied to files:
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts
🧬 Code graph analysis (1)
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts (3)
apps/meteor/tests/mocks/data.ts (1)
createFakeVisitor(309-314)apps/meteor/tests/e2e/page-objects/home-omnichannel.ts (1)
HomeOmnichannel(14-67)packages/core-typings/src/utils.ts (1)
Awaited(9-9)
⏰ 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
🔇 Additional comments (1)
apps/meteor/tests/e2e/omnichannel/omnichannel-assign-room-tags.spec.ts (1)
127-133: Assert Department‑B tag can actually be assignedThe second scenario only checks that
TagBis visible; it never selects or saves it, so a regression in the assignment flow would go unnoticed even though the test “passes.” Add a step that selectsTagB, clicks save, and asserts the tag appears in room info (mirroring the first test’s verification). For instance:await test.step('Agent associated with DepartmentB should not be able to see tags for DepartmentA', async () => { await expect(poOmnichannel.roomInfo.optionTags('TagA')).not.toBeVisible(); }); + + await test.step('Agent can assign DepartmentB tag to the room', async () => { + await poOmnichannel.roomInfo.selectTag('TagB'); + await poOmnichannel.roomInfo.btnSaveEditRoom.click(); + await expect(poOmnichannel.roomInfo.getTagInfoByLabel('TagB')).toBeVisible(); + });(Use the dynamic tag name variable once added.) Based on learnings.
Co-authored-by: Aleksander Nicacio da Silva <[email protected]>
Co-authored-by: Aleksander Nicacio da Silva <[email protected]>
Co-authored-by: Aleksander Nicacio da Silva <[email protected]>
Co-authored-by: Aleksander Nicacio da Silva <[email protected]>
Co-authored-by: Aleksander Nicacio da Silva <[email protected]>
Co-authored-by: Aleksander Nicacio da Silva <[email protected]>
JIRA TASK: https://rocketchat.atlassian.net/browse/QA-103
The automated test includes the application of tags for a specific room. It covers following scenarios:
Agent associated with multiple department and visitor associated with departmentB
Proposed changes (including videos or screenshots)
Issue(s)
Steps to test or reproduce
Further comments
Summary by CodeRabbit
Bug Fixes
Tests