Skip to content

[BUG] Fix invalid chained XPath ancestor locator in streak widget test #3303

Closed

Description

@rudrakshtank

Bug Description

The test fails because Playwright's locator.locator() method strictly restricts the secondary search to the subtree (descendants) of the first locator. When the test attempts to locate the parent section using streakHeading.locator('xpath=ancestor::div...'), Playwright searches inside the heading element for an ancestor div, which yields zero results. Because the parent container is never found, the subsequent check for longestStreakCard times out and fails.

Additionally, the mockMetricResponse import was missing the .js extension, which can cause module resolution errors (ERR_MODULE_NOT_FOUND) in Next.js/Playwright setups utilizing ES Modules.

Steps to Reproduce

Run the Playwright test "streak widget shows the mocked longest streak value".

The test successfully loads the dashboard and locates the "Commit Streaks" heading.

The test attempts to find the wrapping container by chaining streakHeading.locator('xpath=ancestor::div...').

Because chained locators cannot traverse up the DOM tree, Playwright finds 0 matching container elements.

The test times out and fails waiting for the longest streak card to become visible inside the non-existent container.

Affected Area

Other

Screenshots

No response

Browser & OS

No response

Environment

None

Additional Context

No response

Activity

  1. rudrakshtank commented on Jul 31, 2026

    @rudrakshtank
    ContributorAuthor

    /assign

  2. github-actions commented on Jul 31, 2026

    @github-actions

    Assigned to @rudrakshtank! You have 7 days to open a PR. No PR after 7 days = auto-unassigned so others can pick it up. Good luck!

  3. github-actions commented on Jul 31, 2026

    @github-actions

    ✅ Closed as completed!

    If DevTrack has been useful, a ⭐ star on the repo helps the project grow and reach more developers.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingneeds-triageNeeds maintainer triage

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions