Skip to content

[Bugfix #828] Scope work-view test locators to section headings#917

Merged
amrmelsayed merged 8 commits into
mainfrom
builder/bugfix-828
May 28, 2026
Merged

[Bugfix #828] Scope work-view test locators to section headings#917
amrmelsayed merged 8 commits into
mainfrom
builder/bugfix-828

Conversation

@amrmelsayed

@amrmelsayed amrmelsayed commented May 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #828

The scheduled Dashboard E2E workflow on main was failing with a Playwright strict-mode violation: locator('.work-section:has-text("Recently Closed")') resolved to two elements — the actual Recently Closed section and the Backlog section, because issue #813's title contains the literal substring "Recently Closed" and :has-text(...) matches anywhere in the subtree.

Root cause

:has-text("Foo") on .work-section matches the section heading and any backlog row whose issue title contains "Foo". The test was implicitly coupled to GitHub issue-title content — it passed only while no open backlog issue contained the section-name substring.

Fix

Scope the locator to the section's heading element via :has(h3.work-section-title:text-is("...")). :text-is() matches the heading's exact text, so the match is anchored to the heading and immune to issue-title content.

Hardened all four occurrences in packages/codev/src/agent-farm/__tests__/e2e/work-view-backlog.test.ts:

Swept the rest of the e2e suite for .work-section:has-text(...) — no other occurrences. Other :has-text uses (tab buttons, .instance a:has-text("Open")) target elements whose content is fixed link text, not nested issue rows, so they are not vulnerable to the same collision.

Test plan

  • Scheduled Dashboard E2E workflow on main is green for two consecutive runs (per acceptance criteria — to be observed post-merge)
  • Diff is test-only; no product code changes
  • No other dashboard e2e tests use the loose .work-section:has-text(...) pattern

CMAP Review

Model Verdict Confidence Notes
Gemini APPROVE HIGH Clean and highly focused test fix replacing fragile subtree text-matching with exact heading locators.
Codex APPROVE MEDIUM Narrowly scoped; targets the actual strict-mode collision; updated locators match the real dashboard structure.
Claude APPROVE HIGH Clean, focused test-only fix that correctly scopes Playwright locators to heading elements.

No KEY_ISSUES from any reviewer. Claude noted .tab-bar-item:has-text("Work") uses the same pattern but is safe (targets a button with fixed link text, not a container with dynamic descendants) — confirmed during the sweep.

`.work-section:has-text("X")` matches anywhere in the subtree, so a backlog
item whose title contains a section heading (e.g. #813's "Recently Closed")
causes a strict-mode collision against the actual section. Scope the locator
to `h3.work-section-title:text-is(...)` so the match is anchored to the
heading element and decoupled from issue-title content.

Hardens all four occurrences in work-view-backlog.test.ts (Backlog x2,
Recently Closed x2). No other dashboard e2e tests use the loose pattern.
@amrmelsayed amrmelsayed merged commit 52de2fa into main May 28, 2026
6 checks passed
amrmelsayed added a commit that referenced this pull request May 28, 2026
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.

test(dashboard-e2e): strict-mode locator collision on 'Recently Closed' when a backlog item title contains the phrase

1 participant