maestro icon indicating copy to clipboard operation
maestro copied to clipboard

Cannot find testID with some characters

Open samuelgja opened this issue 1 year ago • 7 comments

Describe the bug If there is testId with some special / not alphanumeric char, it cannot tap on element.

I found out test id is not working with some special chars: []$ - if testID containes one of these - element cannot be pressed.

it find the testId with maestro studio, but command cannot be executed.

To Reproduce Add any element with testID: "testID$" or "testID[0]" and try to execute them via maestro studio

Expected behavior All characters should work in testID definition. Screenshots Screenshot 2023-07-03 at 14 53 47

env M1, mac maestro 1.29.0 React-native app

samuelgja avatar Jul 03 '23 12:07 samuelgja

You can use an escape character (backslash) to reference these, e.g.

- assertVisible:
    text: \£57.57

simon-gilmurray avatar Jul 04 '23 14:07 simon-gilmurray

\£57.57

This needs to be in the documentation

satbirkira avatar Nov 07 '23 16:11 satbirkira

It's regex

rikur avatar Dec 31 '23 00:12 rikur

@simon-gilmurray when I try to escape special char (currency symbol ), I get an error in the console:

found unknown escape character €(8364)

SI_user-can-manipulate-cart yaml — mobileappb2c 2024-03-22 at 12 24 10 PM jpg

zigcccc avatar Mar 22 '24 11:03 zigcccc

@simon-gilmurray when I try to escape special char (currency symbol ), I get an error in the console:

found unknown escape character €(8364)

SI_user-can-manipulate-cart yaml — mobileappb2c 2024-03-22 at 12 24 10 PM jpg

@zigcccc Try removing your quotation marks:

- assertVisible:
     text: Cena na enoto: 2,46 \€

If that doesn't work then the engine possibly can't handle the Euro symbol. If that is the case you'll have to use a wildcard to get past it:

- assertVisible:
     text: Cena na enoto: 2,46.*

simon-gilmurray avatar Mar 22 '24 11:03 simon-gilmurray

@simon-gilmurray when I try to escape special char (currency symbol ), I get an error in the console:

found unknown escape character €(8364)

SI_user-can-manipulate-cart yaml — mobileappb2c 2024-03-22 at 12 24 10 PM jpg

@zigcccc Try removing your quotation marks:

- assertVisible:
     text: Cena na enoto: 2,46 \€

If that doesn't work then the engine possibly can't handle the Euro symbol. If that is the case you'll have to use a wildcard to get past it:

- assertVisible:
     text: Cena na enoto: 2,46.*

@simon-gilmurray removing quotation marks introduces a whole different set of problems since my text query includes : which conflicts with YAML even more I guess: SI_user-can-manipulate-cart yaml — mobileappb2c 2024-03-22 at 12 35 53 PM jpg

The wild card approach is what I've been using and it does work, of course 👍 just stumbled upon this issue and thought it would be nice to have the option to include the currency symbol in the assertion as well (we support different currencies, so in some cases it actually makes sense to make assertion on that).

zigcccc avatar Mar 22 '24 11:03 zigcccc

hmm so I was actually able to get around the parsing problem by using multiline text approach >- and no quotation

assertVisible: >-
  Cena na enoto: 2,46 \€

but the problem is that the text query is still not matched when flow is run: iPhone 15 Pro 2024-03-22 at 12 46 17 PM jpg

zigcccc avatar Mar 22 '24 11:03 zigcccc