Hello Everyone,I've been trying to work with the new XCTest UI Automation. I'm having some trouble dealing with Alerts.When launching the app for the first time, there's an alert that pops up and asks if you want to allow Push Notifications. There is a"Don't Allow" and "OK" button attached to the Alert.The problem comes when attempting to actually interact with this alert.When using the new "UI Record" option to select the "OK" button the following is recorded.func testExample() {
let app = XCUIApplication()
XCUIApplication().alerts["“AppName” Would Like to Send You Notifications"].collectionViews.buttons["OK"]Alternatively the following is another option when selecting on the available lists of elements off of the .XCUIApplication().alerts["“APPName” Would Like to Send You Notifications"] element:XCUIApplication().descendantsMatchingType(.Unknown).alerts["“AppName” Would Like to Send You Notifications"]Why is the .descendentsMatchingType(.Unknown).alerts[ ] in there?The problem is when Playing back the Recorder, it never clicks the "OK" button and cannot find the element and an Error is thrown.The following Error taken from the logs is:UI Test Activity:Assertion Failure: UI Testing Failure - The operation couldn’t be completed. No matches found for Alert, input was {( Application 0x7fa71d9067c0: {{0.0, 0.0}, {375.0, 667.0}}, title: 'AppName', label: 'AppName')}When setting a break point the app never finds any Alerts. I've tried doing the following in the debugger console.po app.alerts.countThe returned output is always 0.What I think is going on is:1) The App Opens2) The Alert Comes up, but is not found3) The test can't find the Alert Element to interact with it.4) The Test Fails.Can anyone offer up any Advice for the following?1) Finding and listing all known Elements on a Simulator's screen at one point?2) Determine why the descendentsMatchingType(.Unknown) is there?3) Being able to tell if an Alert is apart of an "XCUIApplication" or if I may have two XCUIApplication states going on?4) Determine if I need to "wait" for something to be present before the "Alert" is actually recognized on screen?