Apple's XCUITest framework for UI Testing on iOS and Mac OS.
Questions tagged [xcuitest]
638 questions
7
votes
1 answer
Clearing an SFAuthenticationSession alert in an XCUITest with addUIInterruptionMonitor()
Has anybody successfully used addUIInterruptionMonitor to clear the alert produced by start()ing an SFAuthenticationSession while running an XCUITest?
I can't get it to work on Xcode 9.1/iOS 11.1.1 (simulator or device). The standard advice (setting…

Robert Atkins
- 23,528
- 15
- 68
- 97
6
votes
2 answers
How to dismiss "Would like to save this password to use with apps and websites?" during execution of UI tests
I'm currently using
addUIInterruptionMonitor(withDescription: "System alerts") { alert in
let notNowButton = alert.buttons["Not Now"]
if notNowButton.exists {
notNowButton.tap()
return true
}
return false
…

chiarotto.alessandro
- 1,491
- 1
- 13
- 31
6
votes
1 answer
XCUITest - Failed to synthesize event: Failed to compute hit point for Button
I want to test a button's click behavior. When executing button.tap(), the test fails.
XCTContext.runActivity(named: "Validate reply click") { (activity) in
let button = App.buttons.matching(identifier: "Reply-ok").firstMatch
…

ArgenBarbie
- 571
- 1
- 4
- 10
6
votes
7 answers
How to delete/reset an app from iOS 13 with XCTest?
Recently I started testing an iOS app using XCTest but I found some difficulties, the main difficulty was deleting or resetting the app content in each test class.
I'm currently using XCode 11 and trying to delete/reset an app from iOS 13 for each…

Rafael C.
- 2,245
- 4
- 29
- 45
6
votes
3 answers
How to print all the staticTexts in XCUITest
I have used app.staticTexts["String"].tap() to tap on a button containing that string which is working completely fine.
But the problem here is that i want to print all the static texts which are present on that page, how can i do it in XCUITest…

Sameer Arora
- 4,439
- 3
- 10
- 20
6
votes
1 answer
How to Dynamically add XCTestCase
I'm writing a UI Test for a white label project where each app has a different set of menu items. The test taps on each menu item and takes a screenshot (using fastlane snapshot).
Currently this all happens inside one XCTestCase called…

Wez
- 10,555
- 5
- 49
- 63
6
votes
2 answers
Is it possible to automate touch ID or face ID using xcuitest in simulator?
Is there a way to automate face ID or Touch ID using xcuitest framework in simulator. Manually I can perform enrolling face/touch id and perform matching or non-matching scenarios. However I would like to know if it can be automated?

sjgmamer
- 73
- 1
- 6
6
votes
2 answers
Test target of XCUITest seems not to be working after updating to Xcode 10
I updated to xcode 10 from Xcode 9.4 and then when trying to run my UI tests nothing seems to be working. The test app loads for a while then test failed although the build is successfully done before the tests.
and the source code builds…

AyaAkl
- 77
- 6
6
votes
1 answer
Adding aps-environment entitlement to UITest Target in Xcode
I am testing an app that uses Push notifications. Within the main app target, the 'Push Notifications' (inside the Capabilities tab) is set to on.
I created a UITest target for UI Automation Testing. UITest targets do not contain a 'Capabilities'…

Charlie S
- 4,366
- 6
- 59
- 97
6
votes
3 answers
How do I assert that a text field is empty?
I have an empty text field on my UI, though it has a placeholder text (whose value is foo) set in the storyboard. In my UI test, I am trying to check that its text value starts out empty, but when I query it's value, it seems to be giving me the…

akivajgordon
- 8,761
- 1
- 19
- 27
6
votes
0 answers
Xcode 9 crashes when trying to record automation in Safari
As the title says, i'm trying to record test automation steps for XCUITest in Xcode 9 in Safari browser. Our app has some links it opens in external browser and we need to test some elements on the opening webpage.
But whenever I tried to record…

BadmintonCat
- 9,416
- 14
- 78
- 129
5
votes
2 answers
iOS 14 / UI Testing DatePicker
I'm struggling fixing my UI tests for iOS 14 that set date on DatePicker views. They were previously running without any problems on iOS 13 when they were shown as wheel pickers. My code used to set the different wheels but since there aren't any…

G. Marc
- 4,987
- 4
- 32
- 49
5
votes
1 answer
Automatic appended .xctrunner in my XCUITest bundle id while running on device
After updating to Xcode 11.3, my all test cases stopped working because of the unnecessary text .xctrunner appended with bundle id.
Example- If I am giving bundle id as abc.com then it's showing abc.com.xctrunner at run time.

Alok
- 24,880
- 6
- 40
- 67
5
votes
3 answers
How do I access a VStack while UI testing my SwiftUI app
I have a VStack with code relying on the .onTapGesture method. Something like this:
VStack {
if imageShow {
Image("image1")
}
else {
Image("image2")
}
}
.onTapGesture {
imageShow.toggle()
}
I'd like to test this…

Bonteq
- 777
- 7
- 24
5
votes
5 answers
XCUITest: How to jump into app code? How to modify the state of the app under test?
Coming from an Android/Espresso background, I am still struggling with XCUITest and UI testing for iOS.
My question is about two related but distinct issues:
How to compile and link against sources of the app under test?
How to jump into methods of…

Mike76
- 899
- 1
- 9
- 31