2

I'm writing some code to test IOS app using X-code and instrument. I want to check the state of a button when it toggle on/off. I try using method .isEnabled() to check if it's on/off but it fails to determine the state. In other words, instruments always passes the line "if (mainWindow.popover().buttons()[17].isEnabled())" regardless tapping the button or not.

here's part of my code:

//Button is OFF as default
//Tap to turn it ON
mainWindow.popover().buttons()[17].tap();
//Have a short delay to ensure it changes state
target.deday(1);
//Check to see if it's ON
if (mainWindow.popover().buttons()[17].isEnabled()) {
   UIALogger.logMessage("button ON");
}
...
Cœur
  • 37,241
  • 25
  • 195
  • 267
realheaven
  • 295
  • 1
  • 3
  • 8

1 Answers1

0

The root cause of this issue is that the button does not return any value when it toggles ON/OFF. It should return value 0 if it's Off and 1 if it's ON. I'm working out this issue with dev team.

BTW, I also mis-understood the function .IsEnabled() as it only checks if a button is able to tap or not. The function returns false if a button is greyed out (could not be tap). Otherwise, it should return true :)

realheaven
  • 295
  • 1
  • 3
  • 8