Xコードとインストゥルメントを使用してIOSアプリをテストするコードを書いています。ボタンのオン/オフを切り替えたときのボタンの状態を確認したい。メソッド .isEnabled() を使用してオン/オフかどうかを確認しようとしましたが、状態を判断できません。つまり、インストルメントは、ボタンをタップするかどうかに関係なく、常に「if (mainWindow.popover().buttons()[17].isEnabled())」という行を渡します。
ここに私のコードの一部があります:
//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");
}
...