Trying to test an IOS app using X-code and instrument, I am currently working on code to check the state of a toggle button. Despite using the .isEnabled() method to determine if the button is on or off, it seems to fail at detecting the state accurately. The instruments consistently pass the line "if (mainWindow.popover().buttons()[17].isEnabled())" regardless of whether the button has been tapped or not.
Below is a snippet of the code being used:
//Button starts OFF by default
//Tapping it to turn it ON
mainWindow.popover().buttons()[17].tap();
//Adding a short delay to ensure state change
target.delay(1);
//Checking if button is ON
if (mainWindow.popover().buttons()[17].isEnabled()) {
UIALogger.logMessage("button ON");
}
...