maestro
maestro copied to clipboard
[Question] Contexts, Dynamics, And Test Reports
Hi there! I have a few questions:
- How can I read info from the current context? For example:
- Read text from label A, pass the text to text field B
- I need some data from the network
- How can I scroll or swipe specify component? such as swipe on an image view? Or double-tap it?
- How can I customize the timeout for waiting for a component to be visible?
- My app took a long time to launch, the maestro just assert failed. I need the maestro to wait for a few seconds more time
- How can I find a component by class or type? Not all buttons have text
- Where can I find the test report?
Thank you!
- An element is already visible on the screen, why is the
tapOncommand still waiting for it? - If there is a rich text component that contains a button with text, how can I tap on it?
- Why I can't tap a tab bar item by its label?
- There is a UITabBarItem with the title "Homepage", I can not tap it by
tapOn: "Homepage", eitherassetVisible - UIBarButtonItems are the same. On iOS, the
backcommand does not work, andtapOn: "Back"does not work too.
- There is a UITabBarItem with the title "Homepage", I can not tap it by
- If there are so many same texts on the screen, how can I specify the index of
tapOn?
How can I read info from the current context?
This is not possible yet, but we have plans to add such support. Also mentioned in #106
How can I scroll or swipe specify component? such as swipe on an image view? Or double-tap it?
Not available yet, but will be added. Also mentioned in #55
How can I customize the timeout for waiting for a component to be visible?
At the moment, this is intentionally not customizeable as timeout is already very high (~10 seconds). I would like to better understand your use case - why is loading taking so much time?
How can I find a component by class or type? Not all buttons have text
By design, Maestro is a black box testing framework and does not know about internals of the app. Think of it as a user with an impaired vision - Maestro sees the screen the same way such a user would through accessibility hints.
Where can I find the test report?
Maestro does not generate test reports on its own yet. Would like to hear your feedback, do you see a need for such functionality?
An element is already visible on the screen, why is the tapOn command still waiting for it?
There is a bit of a buffer between element taps to make sure the view hierarchy is stable and not going to suddenly change again.
If there is a rich text component that contains a button with text, how can I tap on it?
A question to ask - how would a visually impaired user discover and tap on such elements? If the view is not showing up in maestro hierarchy, it will also not be easily accessibly to such a suer. Hence there are 2 options:
- Make the text view clickable as a whole
- Use dedicated button component instead of a rich text
Why I can't tap a tab bar item by its label?
Could you share the output of maestro hierarchy command? Does any text related to tab bar show up there?
If there are so many same texts on the screen, how can I specify the index of tapOn?
We have updated our documentation with an example on how to do that: https://maestro.mobile.dev/reference/tap-on-view#selecting-one-view-among-many-similar
Thank you for your patient reply! Please let me explain something:
How can I customize the timeout for waiting for a component to be visible?
My case: My app needs to read the launch screen ad from the network, after networking, it shows a countdown button with an image. This may take some time and the maestro often failed my test case... In other words, the networking duration is not a problem of app~
How can I find a component by class or type? Not all buttons have text
Not all buttons have text, it may contain an icon, a shape, or rich text
Where can I find the test report?
The test report is necessary, but not a high priority. The testers need test reports to finish their work.
If there is a rich text component that contains a button with text, how can I tap on it?
Imagine this scene:
Showing results for XXX, search instead for XXX
The XXX may be a NSAttributedString or a UIButton, How can I locate the "XXX"?
Why I can't tap a tab bar item by its label?
My screen shot:

In the hierarchy, no tab bar buttons found:
{
"attributes" : { },
"children" : [ {
"attributes" : {
"text" : "My App Name",
"bounds" : "[0,0][390,844]"
},
"children" : [ ],
"clickable" : null
}, {
"attributes" : {
"text" : "Cart",
"bounds" : "[177,58][211,78]"
},
"children" : [ ],
"clickable" : null
}, {
"attributes" : {
"text" : "ic messgae orange",
"resource-id" : "Message",
"bounds" : "[342,57][374,81]"
},
"children" : [ ],
"clickable" : null
}, {
"attributes" : {
"text" : "空列表",
"bounds" : "[0,91][390,761]"
},
"children" : [ ],
"clickable" : null
}, {
"attributes" : {
"text" : "标签页栏",
"bounds" : "[0,761][390,844]"
},
"children" : [ ],
"clickable" : null
} ],
"clickable" : null
}
Screenshot:

In the hierarchy, no Back button, and right buttons found:
{
"attributes" : { },
"children" : [ {
"attributes" : {
"text" : "My App Name",
"bounds" : "[0,0][390,844]"
},
"children" : [ ],
"clickable" : null
}, {
"attributes" : {
"resource-id" : "Earn point method",
"bounds" : "[0,47][390,91]"
},
"children" : [ ],
"clickable" : null
}, {
"attributes" : {
"bounds" : "[12,107][82,137]"
},
"children" : [ ],
"clickable" : null
}, {
"attributes" : {
"bounds" : "[6,137][221,158]"
},
"children" : [ ],
"clickable" : null
} ],
"clickable" : null
}
Maestro does not generate test reports on its own yet. Would like to hear your feedback, do you see a need for such functionality?
Reports would be great for CI integration. #348 also asks for this and I described why I think it would be helpful in https://github.com/mobile-dev-inc/maestro/issues/348#issuecomment-1303380750.
Closing this out as part of the request has been resolved with the following option:
maestro test --format junit flows/
For other issues, please open up separate GitHub issues per requests if still relevant :)
This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue. Thank you for helping keep us our issue tracker clean!