Skip to content

test: harden LocateNodeButton propagation and keyboard tests - #15413

Open
christian-byrne wants to merge 2 commits into
mainfrom
christian/locate-node-button-test-hardening
Open

test: harden LocateNodeButton propagation and keyboard tests#15413
christian-byrne wants to merge 2 commits into
mainfrom
christian/locate-node-button-test-hardening

Conversation

@christian-byrne

Copy link
Copy Markdown
Contributor

Summary

Two small follow-ups from the #13401 review:

  • Propagation test: now also asserts emitted().locate has length 1 in the same interaction. Without this, a broken handler that calls event.stopPropagation() but silently swallows the emit would still pass.
  • Keyboard test: replaced user.tab() (implicit JSDOM tab order) with explicit .focus() on the button, making the test self-contained and immune to tab-order assumptions in the test environment.

The old implicit-tab-order keyboard test is removed; the new explicit-focus version covers the same behavior more robustly.

Test plan

  • pnpm test src/components/rightSidePanel/errors/LocateNodeButton.test.ts passes (4 tests)

🤖 Generated with Claude Code

Propagation test now also asserts locate is emitted in the same
interaction, so it would catch a broken handler that stops propagation
without emitting. Keyboard test uses explicit .focus() instead of
user.tab() to avoid relying on JSDOM implicit tab order.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@christian-byrne
christian-byrne requested a review from a team August 18, 2026 21:31
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 18, 2026
@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 08/22/2026, 11:19:23 PM UTC

Links

🎭 Playwright: ✅ 1977 passed, 0 failed · 3 flaky

📊 Browser Reports
  • chromium: View Report (✅ 1956 / ❌ 0 / ⚠️ 3 / ⏭️ 5)
  • chromium-2x: View Report (✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • chromium-0.5x: View Report (✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • mobile-chrome: View Report (✅ 18 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • New-test walkthrough (chromium, recorded video): View Report

📦 Bundle: 9.11 MB gzip ⚪ 0 B

Details

Summary

  • Raw size: 38.6 MB baseline 38.6 MB — ⚪ 0 B
  • Gzip: 9.11 MB baseline 9.11 MB — ⚪ 0 B
  • Brotli: 6.37 MB baseline 6.37 MB — ⚪ 0 B
  • Bundles: 438 current • 438 baseline

Category Glance
Vendor & Third-Party ⚪ 0 B (18.1 MB) · Other ⚪ 0 B (14.1 MB) · Data & Services ⚪ 0 B (3.53 MB) · Graph Workspace ⚪ 0 B (1.37 MB) · Panels & Settings ⚪ 0 B (591 kB) · Utilities & Hooks ⚪ 0 B (549 kB) · + 5 more

App Entry Points — 3.71 kB (baseline 3.71 kB) • ⚪ 0 B

Main entry bundles and manifests

Status: 1 unchanged

Graph Workspace — 1.37 MB (baseline 1.37 MB) • ⚪ 0 B

Graph editor runtime, canvas, workflow orchestration

Status: 3 unchanged

Views & Navigation — 124 kB (baseline 124 kB) • ⚪ 0 B

Top-level views, pages, and routed surfaces

Status: 17 unchanged

Panels & Settings — 591 kB (baseline 591 kB) • ⚪ 0 B

Configuration panels, inspectors, and settings screens

Status: 27 unchanged

User & Accounts — 27.5 kB (baseline 27.5 kB) • ⚪ 0 B

Authentication, profile, and account management bundles

Status: 11 unchanged

Editors & Dialogs — 125 kB (baseline 125 kB) • ⚪ 0 B

Modals, dialogs, drawers, and in-app editors

Status: 8 unchanged

UI Components — 67.1 kB (baseline 67.1 kB) • ⚪ 0 B

Reusable component library chunks

Status: 14 unchanged

Data & Services — 3.53 MB (baseline 3.53 MB) • ⚪ 0 B

Stores, services, APIs, and repositories

Status: 17 unchanged

Utilities & Hooks — 549 kB (baseline 549 kB) • ⚪ 0 B

Helpers, composables, and utility bundles

Status: 37 unchanged

Vendor & Third-Party — 18.1 MB (baseline 18.1 MB) • ⚪ 0 B

External libraries and shared vendor chunks

Status: 18 unchanged

Other — 14.1 MB (baseline 14.1 MB) • ⚪ 0 B

Bundles that do not match a named category

Status: 285 unchanged

⚡ Performance

⏳ Performance tests in progress…

@github-actions github-actions Bot added the risk:R2 PR risk grade (advisory shadow check; grader-owned) label Aug 18, 2026
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 44121766-0eb8-423e-8054-873ce1d7d5c8

📥 Commits

Reviewing files that changed from the base of the PR and between b95f6ee and de2c38e.

📒 Files selected for processing (1)
  • src/components/rightSidePanel/errors/LocateNodeButton.test.ts

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.


📝 Walkthrough

Walkthrough

The test suite verifies that clicking LocateNodeButton stops ancestor propagation and emits locate. The keyboard test focuses the button before pressing Enter and verifies the same event.

Changes

LocateNodeButton interaction coverage

Layer / File(s) Summary
Interaction behavior tests
src/components/rightSidePanel/errors/LocateNodeButton.test.ts
The click test checks ancestor click propagation and locate emission. The keyboard test explicitly focuses the button before pressing Enter.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to de2c3

This localized test-only change strengthens event propagation and keyboard interaction coverage; no actionable merge-blocking risk remains after normal checks and review.


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
End-To-End Regression Coverage For Fixes ❓ Inconclusive The changed file is listed, but the review context does not provide the PR title or actual commit subjects required to verify the bug-fix signal. Provide the PR title and commit subjects so the check can determine whether the end-to-end test requirement applies.
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the test changes for propagation and keyboard behavior.
Description check ✅ Passed The description clearly explains the test changes and includes a test plan, but it omits some template sections that are not critical.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Website End-To-End Regression Coverage ✅ Passed The PR changes only src/components/rightSidePanel/errors/LocateNodeButton.test.ts, not apps/website/src/ or apps/website/public/.
Adr Compliance For Entity/Litegraph Changes ✅ Passed The changed-file list contains only src/components/rightSidePanel/errors/LocateNodeButton.test.ts, outside the paths covered by this check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch christian/locate-node-button-test-hardening

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 18, 2026
…15612)

*PR Created by the Glary-Bot Agent*

---

Fixes the failing `test` job on #15413. Targets that PR's branch, so
merging this here makes #15413 green.

## Problem

`emitted()` returned by `@testing-library/vue`'s `render()` reports
events for the component handed to `render()` — internally it is just
`emitted: name => wrapper.emitted(name)` on the mounted root.

The propagation test renders an ad-hoc wrapper, so the root is the
`<div>`, not `LocateNodeButton`. The wrapper never emits `locate`; only
the child does. So `emitted().locate` was `undefined` and
`expect(undefined).toHaveLength(1)` threw:

```
AssertionError: Target cannot be null or undefined.
 ❯ LocateNodeButton.test.ts:44:30
```

Dumping what the wrapper actually reports confirms it — only native
events that bubbled to the root element, and notably no `click`, which
independently shows `@click.stop` is working:

```
pointerover, pointerenter, mouseover, mouseenter, pointermove,
mousemove, pointerdown, mousedown, focusin, pointerup, mouseup
```

The assertion could never pass, regardless of component behavior. The
component itself is fine — no regression.

## Fix

Spy on the child's `@locate` handler instead of reading the wrapper's
`emitted()`. `@vue/test-utils` `findComponent()` is not an option here —
`docs/guidance/vitest.md` bans it in new tests — and `render()` exposes
no way to reach a child's emitted events.

## Verification

- `pnpm vitest run
src/components/rightSidePanel/errors/LocateNodeButton.test.ts` — 4/4
pass
- `pnpm vitest run src/components/rightSidePanel` — 208/208 pass
- `pnpm typecheck` (exit 0), `pnpm format:check`, ESLint on the changed
file — all clean

The assertion keeps its teeth. Replacing `@click.stop="emit('locate')"`
with `@click.stop="() => {}"` — precisely the swallowed-emit case the
original PR set out to catch — still fails:

```
AssertionError: expected "vi.fn()" to be called 1 times, but got 0 times
 ❯ LocateNodeButton.test.ts:45:22
```

Co-authored-by: Glary-Bot <glary-bot@users.noreply.github.com>
@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             main   #15413      +/-   ##
==========================================
+ Coverage   81.23%   81.86%   +0.63%     
==========================================
  Files        1871     1887      +16     
  Lines      106317   107173     +856     
  Branches    31225    32363    +1138     
==========================================
+ Hits        86363    87734    +1371     
+ Misses      19604    19100     -504     
+ Partials      350      339      -11     
Flag Coverage Δ
e2e 67.45% <ø> (+1.15%) ⬆️
unit 73.42% <ø> (+1.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 249 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:R2 PR risk grade (advisory shadow check; grader-owned) size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants