Skip to content

test: add full Playwright E2E coverage for CpsAutocompleteComponent#761

Open
fateeand wants to merge 4 commits into
masterfrom
758-cover-autocomplete-component-with-playwright-tests
Open

test: add full Playwright E2E coverage for CpsAutocompleteComponent#761
fateeand wants to merge 4 commits into
masterfrom
758-cover-autocomplete-component-with-playwright-tests

Conversation

@fateeand

@fateeand fateeand commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Rewrote the cps-autocomplete Playwright suite from 2 tests to full E2E coverage (23 tests): single/multi-select, async fetch, form validation, keyboard navigation, virtual scroll, chips, alias filtering, appearance variants, and more.
  • Fixed a real bug in cps-autocomplete: clicking the clear icon reopened the dropdown even when openOnClear is false, because the clear icon's mousedown handler didn't stop propagation and the click bubbled up to the box's own open-on-click handler.
  • Added data-testid attributes throughout the component's template (input, clear icon, chevron, listbox, options, chips, hint/error, etc.) so both this suite and consuming apps have stable selectors going forward. The one pre-existing testid is preserved unchanged for backward compatibility.
  • Added 6 new live examples to the component's docs/demo page (alias filtering, custom empty-option index, openOnClear=false, hideDetails, selectAll=false) to cover props that had no existing example, and added data-testids to the previously-untagged examples.

TODO: Merge with feat: add test ids to autocomplete component and fix openOnClear prop in the commit footer to generate a release


Release notes:

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

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

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Coverage report for library

St.
Category Percentage Covered / Total
🟡 Statements 76.99% 6031/7833
🟡 Branches 66.92% 2782/4157
🟡 Functions 77.77% 1123/1444
🟡 Lines 78.05% 5634/7218

Test suite run success

2386 tests passing in 76 suites.

Report generated by 🧪jest coverage report action from ded2c88

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 expands cps-autocomplete end-to-end coverage with a significantly more comprehensive Playwright suite, while also improving selector stability by adding data-testid attributes throughout the component and composition examples. It also addresses an interaction bug where clearing could re-trigger the open behavior when openOnClear=false.

Changes:

  • Added many data-testid attributes to CpsAutocompleteComponent template elements (input, clear icon, chevron, listbox, options, hint/error, etc.) to support stable E2E selectors.
  • Extended the /autocomplete composition page with additional examples/props coverage (alias filtering, custom empty option index, openOnClear=false, hideDetails, selectAll=false) and added test IDs to examples for targeting.
  • Rewrote the Playwright cps-autocomplete suite to cover a broad set of behaviors (async fetch, chips, keyboard navigation, virtual scroll, validation, etc.).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
projects/cps-ui-kit/src/lib/components/cps-autocomplete/cps-autocomplete.component.html Adds data-testid hooks across the component template and stops mousedown propagation on clear to prevent unintended open.
projects/composition/src/app/pages/autocomplete-page/autocomplete-page.examples.ts Updates example code snippets and adds new examples for previously uncovered inputs/behaviors.
projects/composition/src/app/pages/autocomplete-page/autocomplete-page.component.ts Updates demo options data (adds alias) and supports new example state/form control.
projects/composition/src/app/pages/autocomplete-page/autocomplete-page.component.html Adds data-testid attributes to demo instances and wires new live examples into the page.
playwright/cps-ui-kit/components/cps-autocomplete.spec.ts Replaces the minimal suite with extensive E2E coverage for many autocomplete behaviors and variants.

Comment thread playwright/cps-ui-kit/components/cps-autocomplete.spec.ts
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Playwright test results

passed  282 passed

Details

stats  282 tests across 5 suites
duration  8 minutes, 41 seconds
commit  cef2692
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 Autocomplete component with Playwright tests

2 participants