-
Notifications
You must be signed in to change notification settings - Fork 766
Targetting a button via data-testid fails on web if the button also has aria-label set #3049
Copy link
Copy link
Labels
platform: webTesting web apps is affectedTesting web apps is affected
Description
Is there an existing issue for this?
- I have searched the existing issues and didn't find mine.
Steps to reproduce
This issue only occurs when testing against Web.
Given a button:
<button aria-label="Some label" data-testid="some-test-id">
<svg .../>
</button>
This test can't find the button:
- tapOn:
id: some-test-id
Actual results
Element cannot be found by maestro
Removing aria-label from the button results in maestro being able to find the element
Expected results
Maestro will click the button which has data-testid of some-test-id
About app
React native for web via expo
About environment
Both locally (MacOS) and deployed to a cloud hosting service
Logs
Logs
<!-- Replace this line with your logs. *DO NOT* remove the backticks! -->
Maestro version
2.3.0
How did you install Maestro?
install script (https://get.maestro.mobile.dev)
Anything else?
I suspect it's related to how maestro web determine's the resource-id, as it appears to favours ariaLabel over data-testid.
| attributes['resource-id'] = node.id || node.ariaLabel || node.name || title || node.htmlFor || node.attributes['data-testid']?.value |
I was also unable to use test: Aria label value as the target due to this issue: #2914
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
platform: webTesting web apps is affectedTesting web apps is affected