test: add full Playwright E2E coverage for CpsAutocompleteComponent#761
Open
fateeand wants to merge 4 commits into
Open
test: add full Playwright E2E coverage for CpsAutocompleteComponent#761fateeand wants to merge 4 commits into
fateeand wants to merge 4 commits into
Conversation
fateeand
requested review from
TerranceKhumalo-absa,
korel-san and
lukasmatta
as code owners
July 22, 2026 17:53
Contributor
Coverage report for library
Test suite run success2386 tests passing in 76 suites. Report generated by 🧪jest coverage report action from ded2c88 |
Contributor
There was a problem hiding this comment.
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-testidattributes toCpsAutocompleteComponenttemplate elements (input, clear icon, chevron, listbox, options, hint/error, etc.) to support stable E2E selectors. - Extended the
/autocompletecomposition 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-autocompletesuite 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. |
Contributor
Playwright test resultsDetails
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cps-autocompletePlaywright 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.cps-autocomplete: clicking the clear icon reopened the dropdown even whenopenOnClearisfalse, 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.data-testidattributes 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.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 propin the commit footer to generate a releaseRelease notes:
cps-autocompleteopenOnClearis false