test: add Playwright coverage and test ids for CpsLoaderComponent - #815
test: add Playwright coverage and test ids for CpsLoaderComponent#815fateeand wants to merge 3 commits into
Conversation
Coverage report for library
Test suite run success2438 tests passing in 76 suites. Report generated by 🧪jest coverage report action from 676bd6c |
There was a problem hiding this comment.
Pull request overview
Adds Playwright E2E coverage for CpsLoaderComponent and introduces stable data-testid hooks in both the component template and the composition demo page so tests can assert real browser layout/CSS/animation and live-region behavior.
Changes:
- Added
data-testidattributes tocps-loadertemplate elements and composition demo instances for reliable E2E targeting. - Updated the loader composition page examples to demonstrate non-default label/ARIA strings and the
labelColorfallback path. - Added a new Playwright spec validating fullscreen vs relative layout, live-region announcements, reduced-motion behavior, and CSS color fallback.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/cps-ui-kit/src/lib/components/cps-loader/cps-loader.component.ts | Removes now-unneeded CommonModule/component imports usage. |
| projects/cps-ui-kit/src/lib/components/cps-loader/cps-loader.component.html | Replaces ngStyle with style bindings and adds loader element data-testids. |
| projects/composition/src/app/pages/loader-page/loader-page.examples.ts | Updates/extends composition examples for themed color + custom labels. |
| projects/composition/src/app/pages/loader-page/loader-page.component.html | Adds test ids and updates examples rendered on the loader demo page. |
| playwright/cps-ui-kit/components/cps-loader.spec.ts | Introduces Playwright E2E coverage for loader layout, announcements, reduced motion, and color fallback. |
Comments suppressed due to low confidence (1)
playwright/cps-ui-kit/components/cps-loader.spec.ts:62
- Same selector-stability issue here:
[aria-live="polite"]may match unrelated polite regions. Use the live-announcer region’s.cps-polite-live-announcer-elementclass so the test is checking the shared announcer service output specifically.
const politeRegion = page.locator('[aria-live="polite"]');
Playwright test resultsDetails
Flaky testswebkit › cps-ui-kit/components/cps-autocomplete.spec.ts › cps-autocomplete › Async multi-select › select all toggles every currently fetched option |
Summary
CpsLoaderComponent, covering real-browser behavior the existing 29-test Jest suite can't reach (it mocks the live-announcer service entirely and can't evaluate real CSS/layout):fullScreenproduces real fixed-viewport layout vs. relative-container layoutCpsLiveAnnouncerService's shared live region, on both mount and destroy, including customlabel/doneAriaLabelvaluesshowLabel=falserenders no visible label elementprefers-reduced-motiondisables/slows the label and spinner animationslabelColor's CSS-validity fallback (a bare color token gets wrapped in a realvar(--cps-color-*)reference that resolves to a real color)label,ariaLabel, anddoneAriaLabelwere previously never shown with non-default values) and changed the "white label" example to a bare color token (labelColor="energy") so the CSS-validity fallback path is actually demonstrated.cps-loader-overlay,cps-loader-content,cps-loader-label,cps-loader-spinner).TODO: Merge with
feat: add test ids to loader componentto generate a releaseRelease notes: