On running purchase UITests with XCUitest, sometimes after tapping on the purchase button in the IOS native pop-up
Sign-in Required
doesn't display for a long time (more than 2 min).
The tests are running on a real device(iPhone 6 ios 12).
I've tried to reproduce it manually with no success.
Every time I tried it manually it works fine and most of the time it works fine with the automatic test.
This is the code that waits for the alerts and handles with the alerts with "addUIInterruptionMonitor"
func PurchaseTest1(elementName: String) -> Bool {
if TestUtilities.wait(forMax: 120.0, condition: { return app.buttons[elementName].exists }, doPerIteration: { self.app.swipeDown() } ) == false {
return false
}
return true
}
It's waiting for an element to appear, after every iteration, it swipes down to call to "addUIInterruptionMonitor" to check if there is an iOS pop-up to handle.
Most of the time it works and the pop-up appear but sometimes pop-up doesn't appear at all (I can see in the screenshots that I have for every test).