I've been able to find the following KIF method for setting the value of a UISwitch
:
tester.setOn(false, forSwitchWithAccessibilityLabel: "Enable Feature")
However, I have been unable to figure out how to retrieve the value of a UISwitch, using KIF, in an assert/test approach.
Any ideas?
I figured it out:
To test for switch on:
tester.waitForViewWithAccessibilityLabel("Enable Feature", value: "1", traits: UIAccessibilityTraitNone)
To test for switch off:
tester.waitForViewWithAccessibilityLabel("Enable Feature", value: "0", traits: UIAccessibilityTraitNone)