I am testing a mobile application and want to verify that the user sees the right elements (In this example, the headline of the first content view after successful login.)
I have recorded and afterwards modified a testcase, where I login and verify the element on the next page.
For the correct username and password, this works fine. Every step is successful etc.
The same testcase however, does not fail, when using invalid user data.
Here is the example:
Also, while recording or spying, there are elements klickable etc. that are not currently visible:
(I suspect these Problems are connected?)
Some more details:
The problem (Element is verified visible, when it is not currently visible) occurs on many elements on many views, but not all of them.
I am using Android Studio to emulate a Nexus phone with Android 9.
In another testcase, also the VerifyElementText function on the same element is successful.
The application is a hybrid mobile application. Can this be the cause of the problem?
How can I verify, that the correct view/element etc is visible for the end-user?
Thank you very much
For the element that’s always visible, please share it’s locator and properties.
In programming, elements are visible means they have visible properties and inside the current view port.
Some developers can “hide” elements by using some css techniques/tricks (for hybrid app) but it doesn’t actually make the elements invisible.
Thanks for your reply.
I added some information in the post on the element that is verified in the testcase. Is anything still missing?
Hi, I can see in your screenshot the test is setting Login and Password to ‘invalid’ and then tapping the Login button. What is the ‘Heading_content_page’ object on line 27 referring to? Is it a popup stating an unsuccessful login? By the sounds of it it seems like the ‘Heading_content_page’ might be the page header which is going to be visible regardless of the Login/Password being correct or incorrect.
Yes, it ist the page header. But on the application it is only visible, after login. Not on the login page itself (except in Katalon studio, where this element seems to be always visible, which is my problem)
So if the line verifyElementVisible for the Heading_content_page is moved up to before tapping the login button, does the line fail in Katalon as it cannot see the Heading_content_page before login or does it pass? If it passes, it would mean it is visible OR present on the login page and maybe you should verify another element that is not on the login page as well as after logging in, perhaps verifyElementNotVisible Login or Password field.
Also what if you add a delay after tapping the Login button so it can load the new page and then check verifyElementVisible?
The verifyElementVisible also passes for the Heading_content_page if it is moved before tapping the login button.
Adding a delay does not change the outcome. The Heading_content_page is proven visible with successful as well as unsuccessful Login.
And yes, that is my workaround so far, to test for elements on the login page instead of the following content_page.
So, as I understood this, my header_content_page element is visible for the Katalon program on the login page, although the user does not see it. This is due to the used CSS technique (probably the login page overlapping the content_page). And there is no other way, but to find elements, that are not corrupted by some CSS technique. And then only test those?
(I already thought about using images/screenshots for verification, but there are other topics on that already.)
Hi @ThanhTo, can you take a look on this client’s issue?