xctest

Xcode 7 UI Testing: how to dismiss a series of system alerts in code

自闭症网瘾萝莉.ら 提交于 2019-11-26 09:28:05
问题 I am writing UI test cases using the new Xcode 7 UI Testing feature. At some point of my app, I ask the user for permission of camera access and push notification. So two iOS popups will show up: \"MyApp Would Like to Access the Camera\" popup and \"MyApp Would Like to Send You Notifications\" popup. I\'d like my test to dismiss both popups. UI recording generated the following code for me: [app.alerts[@\"cameraAccessTitle\"].collectionViews.buttons[@\"OK\"] tap]; However, [app.alerts[@\