Skip to content

test: add Playwright coverage and test ids for CpsButtonComponent - #770

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

test: add Playwright coverage and test ids for CpsButtonComponent#770
fateeand wants to merge 3 commits into
masterfrom
759-cover-button-component-with-playwright-tests

Conversation

@fateeand

@fateeand fateeand commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Added Playwright E2E coverage for CpsButtonComponent, covering behavior that requires a real browser and isn't exercised by the existing Jest unit suite: native form submit/reset, real hit-testing (pointer-events: none), native tab-order for disabled buttons, real loading-state timing, real layout for custom/full-width sizing, and real accessible-name computation for icon-only buttons.
  • Added data-testid attributes to cps-button's internal template (native <button>, icon, label, spinner, content wrapper) so consumer apps have stable selectors for their own tests.
  • Added a new example to the /button docs page to showcase custom content color functionality.

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


Release notes:

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

Copilot AI review requested due to automatic review settings July 27, 2026 11:16
@fateeand
fateeand requested a review from lukasmatta as a code owner July 27, 2026 11:16
@fateeand fateeand linked an issue Jul 27, 2026 that may be closed by this pull request
@fateeand fateeand changed the title feat: add Playwright coverage and test ids for CpsButtonComponent test: add Playwright coverage and test ids for CpsButtonComponent Jul 27, 2026
@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Coverage report for library

St.
Category Percentage Covered / Total
🟡 Statements 75.85% 6031/7951
🟡 Branches 65.26% 2782/4263
🟡 Functions 77.24% 1123/1454
🟡 Lines 76.81% 5634/7335

Test suite run success

2386 tests passing in 76 suites.

Report generated by 🧪jest coverage report action from 32b8477

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 adds end-to-end Playwright coverage for CpsButtonComponent behaviors that depend on real browser semantics (keyboard activation, native form submit/reset, pointer-events gating, layout sizing, and accessible-name resolution). It also introduces stable data-testid hooks in both the component’s internal template and the composition demo page to support reliable selectors.

Changes:

  • Added data-testid attributes inside cps-button (native <button>, spinner/content/icon/label) and on the composition button page examples.
  • Introduced a new Playwright spec covering disabled behavior, keyboard activation, loading gating/timing, sizing layout, and native form integration.

Reviewed changes

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

File Description
projects/cps-ui-kit/src/lib/components/cps-button/cps-button.component.html Adds internal data-testid hooks for the native button and key sub-elements.
projects/composition/src/app/pages/button-page/button-page.component.html Adds example-level data-testid hooks used as stable Playwright selectors.
playwright/cps-ui-kit/components/cps-button.spec.ts New Playwright E2E coverage for CpsButtonComponent browser-dependent behavior.
Comments suppressed due to low confidence (2)

projects/cps-ui-kit/src/lib/components/cps-button/cps-button.component.html:59

  • Avoid ngStyle for single-property styling; bind the style property directly instead.
          [ngStyle]="{ 'font-size': cvtFontSize || null }">

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

  • boundingBox() can return null if the element isn't visible; assert it exists before checking width to avoid "received undefined" failures.
      const box = await button.boundingBox();

      expect(box?.width).toBeGreaterThan(600);

Comment thread projects/cps-ui-kit/src/lib/components/cps-button/cps-button.component.html Outdated
Comment thread playwright/cps-ui-kit/components/cps-button.spec.ts Outdated
@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Playwright test results

passed  268 passed

Details

stats  268 tests across 6 suites
duration  10 minutes, 11 seconds
commit  32b8477
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 4 out of 4 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 component with Playwright tests

2 participants