Forum Xamarin Test Cloud (Read Only)


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

UITest app.Query returning hidden control

DaveCarsonDaveCarson GBUniversity ✭✭✭

I'm writing some tests for an iOS app to check that when a screen is opened for the first time a slide down menu is displayed - the second time it won't be.

Using the REPL to extract the element Ids etc I created both tests, one to navigate to the screen and check for the presence of a control on the slide down menu, the other to navigate to the screen, navigate away and then back again checking that the same control on the slide down menu is NOT present - and this is where the 'fun' starts.

Basically the sliding component slides up behind a banner at the top of the screen and while the control I'm checking for (a UIButton) is not visible on screen, the app.Query command does in fact return it. I suppose technically it is still on screen (within the bounds).

Is there any way I can determine whether the button is hidden or not or do I need to tweak the behaviour slightly, e.g. slide it completely off screen or disable the button when it is hidden.

Edit: I decided to compare the CentreY values of the sliding menu and the banner it hides behind to determine whether it was open or not. I did this by applying an AccessibilityIdentifier to the corresponding UIViews and then accessing them via the REPL to obtain the coordinates. However - when I close the menu it is not returned by the app.Query (the button it contains still is mind you). So how does the app.Query command determent whether something it actually 'visible'?

Any help appreciated.

Sign In or Register to comment.