maestro
maestro copied to clipboard
Command to copy text
Would love to have the option to copy the text from a view so it can be checked against some other view. This would also bring in discussion a new assert - assertTextEquals - or something similar.
That is doable and indeed makes sense - we will add this
#403 Adds copy text from element and paste into text field. @ateslovan Does this resolve your issue?
@ArthurSav Great news & addition! But I was thinking of something more 'complicated' when writing this request.
I'm thinking of a case where you have 2 screens:
- One where you can add favourites
- One where you can see favourites
The case I would test would sound something like: Add a favorite then make sure the favorite appears on favourites screen.
Using the getText method you could compare that the text of the favourite item from the first screen appears on the second screen - but I would also like an assertEquals method so that the test fails in case this isn't true.
so, in the end I think we would need:
- getText method
- a way to save the getText in a variable
- an assert to compare two text values
Does it make sense?
@ateslovan the next release of Maestro (1.16.0) will include some basic Javascript support that will make such usecase possible. The logic would then be something like this:
- copyTextFrom: "Field A"
- evalScript: ${output.fieldA = maestro.copiedText}
- copyTextFrom: "Field B"
- assertTrue: ${output.fieldA == maestro.copiedText}
Awesome! I think that will do the job
This is live now in Maestro 1.16.0
https://maestro.mobile.dev/advanced/javascript/access-element-text
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!