Skip to content

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

Merged
fateeand merged 4 commits into
masterfrom
811-cover-tooltip-directive-with-playwright-tests
Aug 13, 2026
Merged

test: add Playwright coverage and test ids for CpsTooltipDirective#841
fateeand merged 4 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.06% 6269/7929
🟡 Branches 68.43% 2891/4225
🟡 Functions 79.99% 1183/1479
🟢 Lines 80.13% 5861/7314

Test suite run success

2474 tests passing in 76 suites.

Report generated by 🧪jest coverage report action from 0b7625b

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  758 passed

Details

stats  758 tests across 32 suites
duration  19 minutes, 7 seconds
commit  0b7625b
info  For details, download the Playwright report

@fateeand
fateeand merged commit 824e092 into master Aug 13, 2026
12 checks passed
@fateeand
fateeand deleted the 811-cover-tooltip-directive-with-playwright-tests branch August 13, 2026 12:49
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

3 participants