Skip to content

test: add Playwright coverage and test ids for CpsExpansionPanelComponent - #790

Open
fateeand wants to merge 1 commit into
masterfrom
780-cover-expansion-panel-component-with-playwright-tests
Open

test: add Playwright coverage and test ids for CpsExpansionPanelComponent#790
fateeand wants to merge 1 commit into
masterfrom
780-cover-expansion-panel-component-with-playwright-tests

Conversation

@fateeand

@fateeand fateeand commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Added Playwright E2E coverage for CpsExpansionPanelComponent, covering behavior that requires a real browser and isn't exercised by the existing Jest unit suite (every interaction there is driven by calling toggleExpansion()/onHeaderKeydown() directly, never through real DOM events, and Angular's AnimationBuilder-driven height animation never actually runs to completion in the test environment): a real click on the header toggling expansion and the AnimationBuilder -> onDone pipeline genuinely completing (real computed height/visibility reaching their final collapsed/expanded values, not just the state flag flipping); real keyboard activation (Enter/Space) producing the same real outcome; the declarative @panelHeader trigger actually rendering a real border-bottom on expand and removing it on collapse; the disabled panel's header genuinely blocking real pointer interaction (pointer-events: none) and being removed from the tab order (tabindex="-1"); and real color resolution for a design-token borderColor (default and custom values) and a raw CSS keyword backgroundColor, the same getCSSColor/isValidCSSColor real-browser-sensitive mechanism as CpsDividerComponent's color input.
  • Added data-testid attributes to the library component's template (root, header, content, title, chevron, prefix icon) so consumer apps have stable selectors for their own tests.
  • Added a "Panel with custom border color" example (borderColor="calm") - the only input with zero live example away from its default before this.
  • Fixed a visual bug: the header kept fully rounded corners even while expanded, so with a non-zero borderRadius its bottom-left/bottom-right corners stayed rounded against the now-visible content edge below it. Fixed with two conditional inline-style bindings on the header (border-bottom-left/right-radius -> '0' while expanded, null/inherited otherwise), covered by two new Jest tests.

TODO: Merge with feat: add test ids to expansion panel component and fix header bottom border radius


Release notes:

  • added Playwright E2E coverage for cps-expansion-panel component
  • added test ids to cps-expansion-panel component
  • fixed cps-expansion-panel header bottom border radius

Copilot AI review requested due to automatic review settings July 29, 2026 13:01
@fateeand
fateeand requested a review from lukasmatta as a code owner July 29, 2026 13:01
@fateeand fateeand linked an issue Jul 29, 2026 that may be closed by this pull request
@github-actions

Copy link
Copy Markdown
Contributor

Coverage report for library

St.
Category Percentage Covered / Total
🟡 Statements 78.32% 6209/7928
🟡 Branches 67.88% 2864/4219
🟡 Functions 79.27% 1170/1476
🟡 Lines 79.39% 5805/7312

Test suite run success

2435 tests passing in 76 suites.

Report generated by 🧪jest coverage report action from 7f30239

Copilot AI 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.

Pull request overview

This PR strengthens CpsExpansionPanelComponent’s testability and behavior coverage by adding stable test selectors, expanding the component’s composition examples, and introducing Playwright E2E tests to validate real browser interactions and animation-driven end states.

Changes:

  • Added data-testid attributes to CpsExpansionPanelComponent template elements (root, header, content, title, chevron, prefix icon) to enable stable selectors for consumer and E2E tests.
  • Fixed the expanded-state visual issue where the header’s bottom corners remained rounded by conditionally zeroing the header’s bottom border radii while expanded, with new Jest unit tests.
  • Added a new “custom border color” composition example and introduced Playwright E2E coverage validating real click/keyboard toggling, disabled behavior, border-bottom animation behavior, and real CSS color token resolution.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
projects/cps-ui-kit/src/lib/components/cps-expansion-panel/cps-expansion-panel.component.ts Adjusted import typing (IconType as type-only) to match TS best practices; no behavior change.
projects/cps-ui-kit/src/lib/components/cps-expansion-panel/cps-expansion-panel.component.spec.ts Added Jest coverage for header bottom-corner radius behavior in expanded vs collapsed states.
projects/cps-ui-kit/src/lib/components/cps-expansion-panel/cps-expansion-panel.component.html Added data-testid hooks and applied conditional inline styles to square bottom header corners when expanded.
projects/composition/src/app/pages/expansion-panel-page/expansion-panel-page.examples.ts Added a new example snippet demonstrating borderColor="calm".
projects/composition/src/app/pages/expansion-panel-page/expansion-panel-page.component.html Wired the new example into the page and added host-level data-testid attributes used by Playwright.
playwright/cps-ui-kit/components/cps-expansion-panel.spec.ts Added new Playwright E2E tests covering real DOM interactions, animation completion effects, and real-browser CSS color resolution.

@github-actions

Copy link
Copy Markdown
Contributor

Playwright test results

passed  254 passed

Details

stats  254 tests across 6 suites
duration  9 minutes, 43 seconds
commit  7f30239
info  For details, download the Playwright report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cover Expansion Panel component with Playwright tests

2 participants