mardi 3 novembre 2015

UITesting of Alerts in xCode 7.1

I'm writing UITests in xCode 7.1 and have a problem in testing alerts (Allow notifications in my case). While creating a test xCode writes this code:

app.alerts["\U201cAppName\U201d Would Like to Send You Notifications"].collectionViews.buttons["OK"].tap()

Which immediately causes error:

Invalid escape sequence in literal

So I replaced xCode's code with:

app.alerts["\u{201c}AppName\u{201d} Would Like to Send You Notifications"].collectionViews.buttons["OK"].tap()

But when I run UITest it fails with message:

UI Testing Failure - No matches found for Alert

The same for code

app.alerts["“AppName” Would Like to Send You Notifications"].collectionViews.buttons["OK"].tap()

I also tried

app.alerts.collectionViews.buttons["OK"].tap()

as people advised here, but same story...

I believe many people faced with such an issue during UITesting in xCode 7.1

Please, share your experience or any suggestions for solving. Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire