test: add Playwright coverage and test ids for CpsMenuComponent - #821
Open
fateeand wants to merge 3 commits into
Open
test: add Playwright coverage and test ids for CpsMenuComponent#821fateeand wants to merge 3 commits into
fateeand wants to merge 3 commits into
Conversation
fateeand
requested review from
TerranceKhumalo-absa and
korel-san
as code owners
August 4, 2026 14:55
Contributor
Coverage report for library
Test suite run success2438 tests passing in 76 suites. Report generated by 🧪jest coverage report action from db4a080 |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Playwright E2E coverage for CpsMenuComponent and wires stable selectors/examples in the composition app to validate real browser behaviors (animation lifecycle, focus management, positioning/flip, routerLink rendering, and emitted outputs).
Changes:
- Added
data-testidattributes to keycps-menuDOM nodes and menu items to support reliable E2E selectors. - Updated the menu composition page + examples to demonstrate
beforeMenuHidden,containerClass, and an internal-link menu item, with matching test hooks. - Introduced a new Playwright spec covering real-world interactions/behavior for the menu (animation, focus, mouse/keyboard modality, flip positioning, outputs).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| projects/cps-ui-kit/src/lib/components/cps-menu/cps-menu.component.html | Adds data-testid attributes to menu container/parts and item anchors for Playwright targeting. |
| projects/composition/src/app/pages/menu-page/menu-page.examples.ts | Updates example snippets to include internal link, beforeMenuHidden, and a custom container-class example. |
| projects/composition/src/app/pages/menu-page/menu-page.component.ts | Adds state for new examples (lastHideReason, isCustomClassMenuOpen) and includes internal-link item. |
| projects/composition/src/app/pages/menu-page/menu-page.component.scss | Adds styles to visually distinguish a custom containerClass and the hide-reason display. |
| projects/composition/src/app/pages/menu-page/menu-page.component.html | Wires new example UIs and adds page-level data-testid hooks used by Playwright tests. |
| playwright/cps-ui-kit/components/cps-menu.spec.ts | New E2E coverage for menu behaviors (animation/unmounting, focus, flip positioning, outputs, routerLink). |
Contributor
Playwright test resultsDetails
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CpsMenuComponent, covering real browser behavior the Jest unit suite can't exercise: the Angular open/close animation and z-index stacking, focus-on-show timing, keyboard-vs-mouse focus-ring suppression on Escape-close (viaCpsFocusService), real viewport-relative flip positioning with arrow visibility,focusOnShow=falsetrigger-retention, internal-link (routerLink) items,containerClass, and thebeforeMenuHidden/containerMouseLeaveoutputs.beforeMenuHiddenoutput and an internal-link menu item.TODO: Merge with
feat: add test ids to menu componentto generate a releaseRelease notes: