I have a suite of UITests and one test needs to use the camera. It is very flaky as if testing on device, the camera must be able to focus and get a picture the first time. It is also frustrating as I have to skip the test when running on Fastlane (or otherwise in an automated fashion using the simulator).
What is best practice for UITesting user behaviour dependent on the camera?
An example of my test code is below:
func testAddWithCamera() {
if Platform.isSimulator {
print("Test skipped as no camera on simulator")
} else {
let app = XCUIApplication()
app.buttons["Camera"].tap()
app.buttons["PhotoCapture"].tap()
app.buttons["Use Photo"].tap()
}
}
Aucun commentaire:
Enregistrer un commentaire