You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the existing issues and didn't find mine.
Steps to reproduce
I'm testing a behaviour where items in a list should move to the top of the list after being viewed.
To do this, my component assigns a testID to each item in the list according to its index ('client0', 'client1', 'client2', etc.)
On navigating back to the list, I copyTextFromclient0 to check the item that's at the top of the list.
Visually in the emulator I can see the item at the top of the list has the correct value, however the value of maestro.copiedText differs - it's often the value from what should be client1.
In fact, now I've done a few more runs, sometimes it fails on the first asserTrue so it seems like somehow it's seeing the testId at a different index than it's visually displayed on the screen (e.g. the copied text is requested from client0 but the value received is from the second item I can see on the screen, which should be client1).
Here are the steps from the test:
# Make sure clients move to the top of the list when viewed
- tapOn: ${output.clients.May.name + ' ' + output.clients.May.surname}
- back
- copyTextFrom:
id: client0 # May should be at the top of the list after being viewed
- evalScript: ${console.log('Client0 name is ' + maestro.copiedText)} # <-- Sometimes displays the value from the second item, not the first
- assertTrue: ${maestro.copiedText === output.clients.May.name + ' ' + output.clients.May.surname} # <-- Test sometimes fails here
- tapOn: ${output.clients.June.name + ' ' + output.clients.June.surname}
- back
- copyTextFrom:
id: client0 # June should now be at the top of the list after being viewed
- evalScript: ${console.log('Client0 name is ' + maestro.copiedText)} # <-- Displays the value from the second item, not the first
- assertTrue: ${maestro.copiedText === output.clients.June.name + ' ' + output.clients.June.surname} # <-- Test usually fails here
Actual results
Here is the output I get. I've noticed the console log statements are repeated (or jumbled up if I print out multiple list indices) as displayed just before the failed step:
║ ✅ Tap on "May Smith"
║ ✅ Press back
║ ✅ Copy text from element with id: client0
║ ✅ Run ${console.log('Client0 name is ' + maestro.copiedText)}
║ Log messages:
║ Client0 name is May Smith
║ ✅ Assert that true is true
║ ✅ Tap on "June Day"
║ ✅ Press back
║ ✅ Copy text from element with id: client0
║ ✅ Run ${console.log('Client0 name is ' + maestro.copiedText)}
║ Log messages:
║ Client0 name is May Smith
║ Client0 name is May Smith
║ ❌ Assert that false is true
║
Assertion is false: false is true
Expected results
I need to be able to retrieve the text of the first item in the list so that I can verify the behaviour of items moving to the top.
It seems like the testID based on the index in the list isn't working well with copyTextFrom.
I'm wondering if this could be abug and/or whether there's a different way to check an item's position in a list.
About app
Closed Source (apologies, I haven't extracted a working sample)
Cross-platform
React Native 0.76.6 / Expo 52.0.28
Is there an existing issue for this?
Steps to reproduce
I'm testing a behaviour where items in a list should move to the top of the list after being viewed.
To do this, my component assigns a
testID
to each item in the list according to its index ('client0', 'client1', 'client2', etc.)On navigating
back
to the list, IcopyTextFrom
client0
to check the item that's at the top of the list.Visually in the emulator I can see the item at the top of the list has the correct value, however the value of
maestro.copiedText
differs - it's often the value from what should beclient1
.In fact, now I've done a few more runs, sometimes it fails on the first
asserTrue
so it seems like somehow it's seeing thetestId
at a different index than it's visually displayed on the screen (e.g. the copied text is requested fromclient0
but the value received is from the second item I can see on the screen, which should beclient1
).Here are the steps from the test:
Actual results
Here is the output I get. I've noticed the console log statements are repeated (or jumbled up if I print out multiple list indices) as displayed just before the failed step:
Expected results
I need to be able to retrieve the text of the first item in the list so that I can verify the behaviour of items moving to the top.
It seems like the
testID
based on the index in the list isn't working well withcopyTextFrom
.I'm wondering if this could be abug and/or whether there's a different way to check an item's position in a list.
About app
Closed Source (apologies, I haven't extracted a working sample)
Cross-platform
React Native 0.76.6 / Expo 52.0.28
About environment
openjdk 21.0.5 2024-10-15
Ubuntu 24.10
x86_64
Logs
Logs
commands-(recent_client.yml).json
Maestro version
1.39.9
How did you install Maestro?
install script (https://get.maestro.mobile.dev)
Anything else?
No response
The text was updated successfully, but these errors were encountered: