Skip to content

test: add Playwright coverage and test ids for CpsTooltipDirective - #841

Open
fateeand wants to merge 3 commits into
masterfrom
811-cover-tooltip-directive-with-playwright-tests
Open

test: add Playwright coverage and test ids for CpsTooltipDirective#841
fateeand wants to merge 3 commits into
masterfrom
811-cover-tooltip-directive-with-playwright-tests

Conversation

@fateeand

Copy link
Copy Markdown
Collaborator

Summary

  • Added 11 tests: click-trigger isolation from hover, focus-only-trigger isolation from hover + real keyboard focus, custom open/close delay timing, tooltipDisabled renders nothing, tooltipMaxWidth enforcement, tooltipOffset distance, click-trigger aria-live announce, destroy-on-scroll and destroy-on-resize.
  • Added test ids to the directive's dynamically-created popup (cps-tooltip, cps-tooltip-content).
  • Added two new examples closing @Input gaps: "Open on focus only" (tooltipOpenOn="focus") and "Custom offset and max width" (tooltipOffset, tooltipMaxWidth).

TODO: Merge with feat: add test ids to tooltip directive


Release notes:

  • added Playwright E2E coverage for cps-tooltip directive
  • added test ids to cps-tooltip directive

Copilot AI lite review requested due to automatic review settings August 11, 2026 11:54
@fateeand fateeand linked an issue Aug 11, 2026 that may be closed by this pull request
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Coverage report for library

St.
Category Percentage Covered / Total
🟡 Statements 79% 6270/7937
🟡 Branches 68.43% 2890/4223
🟡 Functions 79.99% 1183/1479
🟢 Lines 80.08% 5862/7320

Test suite run success

2474 tests passing in 76 suites.

Report generated by 🧪jest coverage report action from 087072c

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 automated coverage and improves testability for CpsTooltipDirective by adding Playwright E2E tests and stable selectors (data-testid) on the dynamically created tooltip DOM, plus composition examples to exercise previously under-covered inputs.

Changes:

  • Added data-testid attributes to the tooltip popup container and content nodes created by CpsTooltipDirective.
  • Updated unit tests to reflect the new tooltip content markup.
  • Added new tooltip examples in the composition app and introduced a new Playwright E2E spec covering multiple real interaction modes and behaviors.

Reviewed changes

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

Show a summary per file
File Description
projects/cps-ui-kit/src/lib/directives/cps-tooltip/cps-tooltip.directive.ts Adds data-testid attributes to the tooltip popup and its content for stable E2E selection.
projects/cps-ui-kit/src/lib/directives/cps-tooltip/cps-tooltip.directive.spec.ts Updates assertions to account for the new tooltip content attributes.
projects/composition/src/app/pages/tooltip-page/tooltip-page.examples.ts Adds new composition examples demonstrating focus-only trigger and custom offset/max-width.
projects/composition/src/app/pages/tooltip-page/tooltip-page.component.html Adds data-testid hooks and renders the new examples on the tooltip docs page.
playwright/cps-ui-kit/directives/cps-tooltip.spec.ts Introduces new Playwright E2E coverage for tooltip behaviors (trigger modes, delays, sizing, offset, teardown, aria-live).
Suppressed comments (1)

projects/cps-ui-kit/src/lib/directives/cps-tooltip/cps-tooltip.directive.spec.ts:109

  • Avoid asserting exact innerHTML strings for tooltip content; this is brittle due to DOM serialization differences (e.g., attribute ordering). Assert on the content element, its data-testid, and the presence of the expected HTML instead.
    expect(tooltipElement).toBeTruthy();
    expect(tooltipElement?.innerHTML).toBe(
      '<div class="cps-tooltip-content" data-testid="cps-tooltip-content"><h1>Legit tooltip</h1></div>'
    );

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread playwright/cps-ui-kit/directives/cps-tooltip.spec.ts Outdated
Comment thread playwright/cps-ui-kit/directives/cps-tooltip.spec.ts Outdated
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Playwright test results

passed  701 passed
flaky  1 flaky

Details

stats  702 tests across 29 suites
duration  21 minutes, 60 seconds
commit  087072c
info  For details, download the Playwright report

Flaky tests

webkit › cps-ui-kit/components/cps-info-circle.spec.ts › cps-info-circle › Real Tab-trapping into persistent tooltip content › tabbing from the icon moves focus into the tooltip real focusable content

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 Tooltip directive with Playwright tests

2 participants