-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wait for button Visibility To matches #6
Comments
Hello @MortezaAghili can you specify what do you expect to achieve or what is not working? I am a little bit lost.
Furthermore Visibility is a tricky thing because it's just parameter. Your Button can have Visibility set to Visible but it might be inside container which Visibility is set to Gone. That's why instead of checking Button is Visible it would be better to check if all it's parents have also Visibility set to Visible:
Another tricky thing is - your Button Visibility parameter might be set to Visible but if you scroll down your screen and it's not visible to your eye anymore it still has Visibility parameter set to Visible. So maybe in this case you would rather check if the View is fully Rendered on your screen instead of just Visibility parameter? Method below calculates View's area and 90% of it must be currently visible to your eye on the screen:
It is a bad idea to hardcode R.id in your instruction. Because then it can be used only for one specific View with hardcoded R.id. You could rewrite it to:
And use it like that:
|
@FisherKK Thank you so much for lighting the right path. |
I'm wonder how can i call a method when timeout is happened and the test stopped ?
|
But if your view didn't appear for over 1000 seconds (how about keeping it smaller, there is no need to set it to such big value in my opinion) then doesn't that mean something is wrong and it should simply crash your test? If you really want to avoid crash:
|
@FisherKK Thanks for you response, this timeout important for our test because we need to send and get a few text messages from the operator. Sometimes this changing information take a few minutes. Where i need implement this method? |
It's up to you I guess.
If you always are logging the same thing then you can make it cleaner by combining try/catch with waitForVisible method.
|
Guys, I've added your tool to my test, I need my test waits and checks Visibility of 2 buttons then finishes the test.
In my test:
The Instruction:
Any idea?
Thanks
The text was updated successfully, but these errors were encountered: