[Bugfix #828] Scope work-view test locators to section headings#917
Merged
Conversation
`.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
added a commit
that referenced
this pull request
May 28, 2026
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
Fixes #828
The scheduled Dashboard E2E workflow on
mainwas 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-sectionmatches 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:"Backlog"(also vulnerable: any issue titled with "Backlog" would have broken these)"Recently Closed"(the symptom from test(dashboard-e2e): strict-mode locator collision on 'Recently Closed' when a backlog item title contains the phrase #828)Swept the rest of the e2e suite for
.work-section:has-text(...)— no other occurrences. Other:has-textuses (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
mainis green for two consecutive runs (per acceptance criteria — to be observed post-merge).work-section:has-text(...)patternCMAP Review
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.