I would like to create several tests for native iOS application. To be more precise, I want to test deep links. But I am not sure how to trigger deep link with XCUITest and I don't really see how launch()
and launcArguments
(https://developer.apple.com/documentation/xctest/xcuiapplication) can help me. Did anybody have a chance to open deep link with XCUITest?
In iOS 14 using Spotlight seems to work well:
private func open(_ urlString: String) {
XCUIDevice.shared.press(.home)
XCUIApplication(bundleIdentifier: "com.apple.springboard").swipeDown()
let spotlight = XCUIApplication(bundleIdentifier: "com.apple.Spotlight")
spotlight.textFields["SpotlightSearchField"].typeText(urlString)
spotlight.buttons["Go"].tap()
}
Set safari as app like this
let safari = XCUIApplication(bundleIdentifier: "com.apple.mobilesafari")
Open your email in safari
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With