Skip to content

test: add Playwright coverage and test ids for CpsButtonToggleComponent - #776

Open
fateeand wants to merge 3 commits into
masterfrom
760-cover-button-toggle-component-with-playwright-tests
Open

test: add Playwright coverage and test ids for CpsButtonToggleComponent#776
fateeand wants to merge 3 commits into
masterfrom
760-cover-button-toggle-component-with-playwright-tests

Conversation

@fateeand

@fateeand fateeand commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Added Playwright E2E coverage for CpsButtonToggleComponent, covering behavior that requires a real browser and isn't exercised by the existing Jest unit suite: real click-through selection in both radio and multi-select modes, real native radiogroup arrow-key navigation, real equalWidths layout measurement, real disabled hit-testing within a partially-enabled group, real accessible-name computation, and real two-way-binding/reactive-form readouts.
  • Added data-testid attributes to cps-button-toggle's internal template (group container, group label, info circle, and per-option label/button/radio input/icon/label) so consumer apps have stable selectors for their own tests.
  • Added three new examples to the /button-toggle docs page to showcase previously-undemonstrated functionality: radioNavigation=false, a component-level ariaLabel without a visible caption, and reactive-forms integration (formControlName).

TODO: Merge with feat: add test ids to button toggle component to generate a release


Release notes:

  • added Playwright E2E coverage for cps-button-toggle component
  • added test ids to cps-button-toggle component

Copilot AI review requested due to automatic review settings July 27, 2026 12:34
@fateeand fateeand linked an issue Jul 27, 2026 that may be closed by this pull request
@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Coverage report for library

St.
Category Percentage Covered / Total
🟡 Statements 76.15% 6031/7920
🟡 Branches 65.35% 2782/4257
🟡 Functions 77.66% 1123/1446
🟡 Lines 77.11% 5634/7306

Test suite run success

2386 tests passing in 76 suites.

Report generated by 🧪jest coverage report action from d8c169b

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

Adds stable data-testid hooks and Playwright E2E coverage for CpsButtonToggleComponent, and updates the composition docs page to demonstrate additional usage patterns (radioNavigation off, ariaLabel-only, reactive forms).

Changes:

  • Added data-testid attributes throughout cps-button-toggle’s internal template to support stable selectors.
  • Added new composition examples + page wiring for radioNavigation=false, aria-label without visible caption, and reactive forms integration.
  • Introduced a new Playwright spec covering real browser interactions, keyboard navigation, layout measurement, accessibility name behavior, and binding readouts.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
projects/cps-ui-kit/src/lib/components/cps-button-toggle/cps-button-toggle.component.html Adds internal data-testid attributes and passes option index into templates
projects/composition/src/app/pages/button-toggle-page/button-toggle-page.examples.ts Adds new example definitions for radioNavigation, ariaLabel-only, and reactive forms
projects/composition/src/app/pages/button-toggle-page/button-toggle-page.component.ts Adds FormBuilder injection + reactive form instance for the new example
projects/composition/src/app/pages/button-toggle-page/button-toggle-page.component.html Adds example sections and data-testid attributes used by Playwright
playwright/cps-ui-kit/components/cps-button-toggle.spec.ts New Playwright E2E suite for cps-button-toggle behavior in a real browser
Comments suppressed due to low confidence (1)

playwright/cps-ui-kit/components/cps-button-toggle.spec.ts:177

  • Same issue here: if the options aren't visible yet, boundingBox() can be null and the 0 fallback can invalidate the width-difference assertion. Scroll into view and assert a non-null bounding box before computing widths.
          const box = await option(
            page,
            'icons-unequal-widths-toggle',
            index
          ).boundingBox();

Comment thread playwright/cps-ui-kit/components/cps-button-toggle.spec.ts Outdated
Comment thread playwright/cps-ui-kit/components/cps-button-toggle.spec.ts
@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Playwright test results

passed  270 passed

Details

stats  270 tests across 6 suites
duration  9 minutes, 51 seconds
commit  d8c169b
info  For details, download the Playwright report

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

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

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 Button Toggle component with Playwright tests

2 participants