3

I've been trying to find information when it comes to asserting element locations but this is the only one that I found:

Check the position of the XCUIElement on screen while testing iOS Application using XCTest

What I need to do is to verify that the element is still at the bottom of the screen. I can't seem to find any information about this.

Carlos Miguel Colanta
  • 2,685
  • 3
  • 31
  • 49
  • Can you tell us why the link you provided doesn't answer your question. the frame property gives you the position of the element. You just need to compare this to the frame of the application to make sure the element is at the bottom of the screen. – Titouan de Bailleul Aug 29 '17 at 13:11
  • Because it will be relative to the device screen and will make my test case brittle. – Carlos Miguel Colanta Aug 29 '17 at 15:40
  • 2
    Not necessarily. You just need to check that element.frame.origin.y + element.frame.size.height = application.frame.origin.y + application.frame.size.height to make sure that the bottom border of the element is aligned with the bottom border of the application. This solution would work for any screen. Or am I missing something? – Titouan de Bailleul Aug 29 '17 at 16:16
  • Hmm ok I'll try that one. What if the element's location is fixed on the phone's screen? like should be attached to the bottom of the IPhone's screen and not relative to the actual application. What I'm trying to test is that the navigation bar should always be at the bottom of the screen while scrolling the app. – Carlos Miguel Colanta Aug 29 '17 at 16:30
  • The solution I suggested should still apply in this case. – Titouan de Bailleul Aug 29 '17 at 16:31
  • Ok thank you. I'll go ahead and try it. – Carlos Miguel Colanta Aug 29 '17 at 16:36

0 Answers0