Skip to content

Strict mode violation when recording element with data-testid #873

@allansson

Description

@allansson

Describe the bug

When recording a page that has multiple elements with the same data-testid, interacting with one of them will generate a script that causes the following error:

ERRO[0009] Uncaught (in promise) clicking on "internal:attr=[data-testid='data-testid Nav menu item']": strict mode violation, multiple elements returned for selector query  executor=shared-iterations scenario=default

The reason is that we're not checking whether the test id is unique while recording.

Steps to reproduce the problem

  1. Sign in to a Grafana stack
  2. Expand an item in the sidebar menu
  3. Export and run the script

Expected behavior

The script should pass

Actual behavior

Script fails with a strict mode violation:

ERRO[0009] Uncaught (in promise) clicking on "internal:attr=[data-testid='data-testid Nav menu item']": strict mode violation, multiple elements returned for selector query  executor=shared-iterations scenario=default

Grafana k6 Studio version

v1.8.0

OS

Any

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions