Skip to content

[BUG] Fix route shadowing wildcard breaking goals sync and remove redundant click #3313

Description

@rudrakshtank

Bug Description

There are two distinct issues in this test file:

Route Shadowing: The wildcard route "**/api/goals**" is registered after "**/api/goals/sync**". Because Playwright evaluates routes in reverse order of registration (last registered takes precedence), the broader wildcard pattern incorrectly intercepts POST requests meant for /api/goals/sync. It returns a generic 201 Created with { ok: true } instead of the expected payload containing last_synced_at, causing the dashboard's sync logic to fail or crash.

Redundant/Flaky Action: In the contribution graph test, there is a duplicated click action: a blind .first().click() on a button, followed immediately by a correctly scoped .locator(...).click() on the same button name. This is a leftover strict-mode workaround that can cause race conditions or unintended UI state changes (e.g., clicking the wrong button in a different widget before clicking the correct one).

Steps to Reproduce

Run the Playwright test suite for the dashboard.

The beforeEach hook mounts the API mocks. /api/goals/sync is registered, but then shadowed by the overly greedy /api/goals wildcard.

The frontend application automatically dispatches a POST request to /api/goals/sync.

The wildcard catches it, stripping the last_synced_at field from the response and breaking the frontend's expected data contract.

In the contribution graph test, the runner blindly clicks the first instance of "Show 90-day range" (which could belong to an entirely different graph if responsive layouts render multiple), risking test flakiness, before clicking the correctly scoped one.

Affected Area

Other

Screenshots

No response

Browser & OS

No response

Environment

None

Additional Context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggssoc:assignedGSSoC: Issue assigned to a contributorneeds-triageNeeds maintainer triage

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions