Skip to content

test: add Playwright coverage and test ids for CpsSelectComponent - #832

Open
fateeand wants to merge 1 commit into
masterfrom
801-cover-select-component-with-playwright-tests
Open

test: add Playwright coverage and test ids for CpsSelectComponent#832
fateeand wants to merge 1 commit into
masterfrom
801-cover-select-component-with-playwright-tests

Conversation

@fateeand

@fateeand fateeand commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Added 19 tests covering browser behavior: real dropdown-overlay open/select/re-select, a real triggered "Field is required" error (focus -> blur without selecting), real chip rendering/removal and select-all toggling, real p-virtualscroller rendering with arrow-key highlighting, real per-option icon rendering, two-way ngModel binding with keepInitialOrder, real keyboard navigation (ArrowUp/Down highlight + wrap-around, Enter, Space, Escape), and openOnClear=false behavior.
  • Added 17 testids to cps-select.component.html.
  • Added two new examples ("Multiple select with hidden details" exercising hideDetails, and "Select without reopening on clear" exercising openOnClear=false).
  • Fixed a bug in cps-select.component.html: the clear icon's (mousedown) handler only called preventDefault(), not stopPropagation(), so a mouse click on it bubbled up to the select box's own onBoxClick() handler, which unconditionally reopens the dropdown - silently defeating openOnClear=false for mouse users.

TODO: Merge with feat: add test ids to select component and fix openOnClear prop


Release notes:

  • added full Playwright E2E coverage for cps-select component
  • fixed select component dropdown reopen on clear if openOnClear is false
  • added test ids to select component

Copilot AI lite review requested due to automatic review settings August 6, 2026 16:06
@fateeand fateeand linked an issue Aug 6, 2026 that may be closed by this pull request

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 the cps-select component’s end-to-end verification by adding Playwright coverage, introducing stable data-testid hooks in the component template, and extending the composition page with new examples. It also fixes a mouse interaction bug where clicking the clear icon could reopen the dropdown even when openOnClear=false.

Changes:

  • Added extensive Playwright E2E coverage for cps-select behaviors (open/select/reselect, required error, chips/select-all, virtual scroll highlighting, keyboard navigation, icons, and openOnClear=false).
  • Added data-testid attributes throughout cps-select.component.html and updated bindings to use [style.*] / [class.*] instead of ngStyle / ngClass.
  • Added two new composition examples (hideDetails and openOnClear=false) and the minimal page wiring to support them.

Reviewed changes

Copilot reviewed 5 out of 5 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-select/cps-select.component.html Adds test IDs, replaces ngStyle/ngClass with style/class bindings, and fixes clear-icon mousedown bubbling to prevent unwanted reopen when openOnClear=false.
projects/composition/src/app/pages/select-page/select-page.examples.ts Adds example definitions for hideDetails and openOnClear=false.
projects/composition/src/app/pages/select-page/select-page.component.ts Adds hideDetailsSelect form control and openOnClearValue used by the new examples/tests.
projects/composition/src/app/pages/select-page/select-page.component.html Adds test IDs to examples and renders the two new examples on the select composition page.
playwright/cps-ui-kit/components/cps-select.spec.ts New Playwright E2E spec covering cps-select behaviors using the new test IDs.

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

2 participants