Skip to content

tapOn with Regex taps on the wrong item #2480

Open
@yolpsoftware

Description

@yolpsoftware

Is there an existing issue for this?

  • I have searched the existing issues and didn't find mine.

Steps to reproduce

The minimal repro can be either downloaded here (.app built for the simulator, just extract the tar and drag it into an iOS simulator), or it can be built with the following steps:

  • Clone the repo at https://github.com/yolpsoftware/maestro-bugtest (branch master)
  • Open a terminal inside it and run npm install
  • Then npx expo run:ios --device, this will create a build for the simulator
  • When it asks on which simulator device you want to run it, choose one, don't choose an actual device.
  • If it asks for a development account, provide one.

Then, start Maestro Studio. The bug is reproducible in Maestro Studio, but it is also happening when testing with Maestro.

Actual results

We want to click on the first item in the list:

Image

Maestro Studio tells me that I can do that with

tapOn: Capisce? - Do you understand? 🇮🇹 Italian Words not yet

This works great, and it confirms that the UI should be okay for Maestro.

However, when I replace the last word by a .* regular expression, the whole thing stops working:

tapOn: Capisce? - Do you understand? 🇮🇹 Italian Words not .*

So I thought, maybe Maestro now considers this to be a Regex - which makes the question marks behave differently. That would make sense. So I replaced them by

tapOn: Capisce\? - Do you understand\? 🇮🇹 Italian Words not .*

or

tapOn: Capisce. - Do you understand. 🇮🇹 Italian Words not .*

But now Maestro taps on one of the "dummy" elements, even though there is no matching text there.

Expected results

Maestro should tap on the element with matching text.

Also, from the docs it's not clear when Maestro is using a regex and when not.

About app

This is a React Native app using Expo. It uses the latest frameworks:

"expo": "~52.0.46",
"react-native": "0.76.9",

About environment

Apple M4 Pro (arm64), Macbook Pro, macOS Sequoia 15.4.1.

openjdk version "21.0.7" 2025-04-15 LTS
OpenJDK Runtime Environment Temurin-21.0.7+6 (build 21.0.7+6-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.7+6 (build 21.0.7+6-LTS, mixed mode, sharing)

Logs

Logs
this is done entirely in Maestro Studio, so no logs here

Maestro version

1.40.0

How did you install Maestro?

install script (https://get.maestro.mobile.dev)

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions