Skip to content

[BUG] Fix strict mode violation in notification search test #3307

Closed

Description

@rudrakshtank

Bug Description

The test "notification search filters and highlights correctly" attempts to locate and click the notification bell button using page.getByRole("button", { name: /Notifications/ }). However, in responsive dashboard layouts, there are often multiple elements matching this locator in the DOM (e.g., one in the desktop navigation and one in the mobile navigation menu). This causes a Playwright strict mode violation (Error: strict mode violation: locator resolved to multiple elements).

The first test correctly mitigates this by chaining .first() to the locator, but the second test misses this, leading to flakiness or outright failure during execution.

Steps to Reproduce

Run the Playwright test suite against the dashboard.

The first test ("notification bell opens and closes drawer") passes because it specifically targets .first() to select the matched bell button.

The second test ("notification search filters and highlights correctly") attempts to click the button without .first().

Playwright throws a strict mode violation error because it finds multiple "Notifications" buttons in the DOM and doesn't know which one to click.

Affected Area

Other

Screenshots

No response

Browser & OS

No response

Environment

None

Additional Context

No response

Activity

  1. 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

No one assigned

    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