Questions tagged [xcode-ui-testing]

UI Testing in Xcode was introduced in Xcode 7, allowing a developer to write UI tests in Swift/Objective-C. The primary method of interacting with an app is via an instance of XCUIApplication. Tests run via the Product > Test menu item or from the editor, with results displayed in the Test navigator. Not to be confused with the older UI Automation which used UIATarget and JavaScript.

1160 questions
222
votes
14 answers

Delay/Wait in a test case of Xcode UI testing

I am trying to write a test case using the new UI Testing available in Xcode 7 beta 2. The App has a login screen where it makes a call to the server to login. There is a delay associated with this as it is an asynchronous operation. Is there a way…
Tejas HS
  • 2,565
  • 2
  • 16
  • 13
168
votes
28 answers

UI Testing Failure - Neither element nor any descendant has keyboard focus on secureTextField

This is my case: let passwordSecureTextField = app.secureTextFields["password"] passwordSecureTextField.tap() passwordSecureTextField.typeText("wrong_password") //here is an error UI Testing Failure - Neither element nor any descendant has…
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
105
votes
10 answers

Xcode UI test - UI Testing Failure - Failed to scroll to visible (by AX action) when tap on Search field "Cancel' button

I am trying to dismiss the search field by tapping 'Cancel' button in search bar. The test case is failing to find the cancel button. It was working fine in Xcode 7.0.1 I have added predicate to wait for button to appear. The test case is failing…
Vinpai
  • 1,689
  • 3
  • 16
  • 18
104
votes
7 answers

Timestamped Event Matching Error: Failed to find matching element

I'm trying to generate a UItest in Xcode. When I try to swipe UIview I get an error: Timestamped Event Matching Error: Failed to find matching element error window This also happens if I try to tap UIView.
shay
  • 1,211
  • 2
  • 8
  • 6
94
votes
18 answers

UI Test deleting text in text field

In my test I have a text field with a pre-existing text. I want to delete the content and type a new string. let textField = app.textFields textField.tap() // delete "Old value" textField.typeText("New value") When deleting string with hardware…
Tomasz Bąk
  • 6,124
  • 3
  • 34
  • 48
88
votes
18 answers

Is there a way to reset the app between tests in Swift XCTest UI?

Is there an API call within XCTest that I can put into the setUP() or tearDown() to reset the app between tests? I looked in the dot syntax of XCUIApplication and all I saw was the .launch() OR is there a way to call a shell script in Swift? I could…
Laser Hawk
  • 1,988
  • 2
  • 23
  • 29
56
votes
8 answers

How to detect if iOS app is running in UI Testing mode

I would like my app to run special code (e.g. resetting its state) when running in UI Testing mode. I looked at environment variables that are set when the app is running from UI Testing and there aren't any obvious parameters to differentiate…
Liron Yahdav
  • 10,152
  • 8
  • 68
  • 104
55
votes
10 answers

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

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…
SeaJelly
  • 1,738
  • 1
  • 15
  • 30
50
votes
7 answers

How to select a picker view item in an iOS UI test in Xcode?

I have a picker view with few items: "Red", "Green", "Yellow", "Black". In my UI test I need to select a specific item "Green" from it. I am using the XCTest UI testing APIs that were intruduced with Xcode 7. What I managed to do so far is to…
Evgenii
  • 36,389
  • 27
  • 134
  • 170
45
votes
3 answers

xcode: Timestamped Event Matching Error: Failed to find matching element

I'm trying to record some XCUITesting functions. I get this error. Timestamped Event Matching Error: Failed to find matching element Is this an Xcode bug and/or issues with the complexity of my UI?
emoleumassi
  • 4,881
  • 13
  • 67
  • 93
44
votes
4 answers

How to access back bar button item in universal way under UITests in Xcode?

The problem is when I try to access back bar button item because it is presented with: Restaurants title, Back title without title Like it is on the screens: Currently I access it like this: let backButton =…
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
43
votes
1 answer

UI Testing Failure - Failure getting snapshot for element Error -25201

I currently encountered this issue while running my UI Tests for iOS Assertion Failure: UI Testing Failure - Failure getting snapshot Error Domain=XCTestManagerErrorDomain Code=9 "Error -25201 getting snapshot for element {pid=84523}"…
Abs F.
  • 431
  • 4
  • 3
42
votes
3 answers

iOS UI Testing On an Isolated View

I'm trying to incorporate UI tests in my iOS project, but one thing that continues to hold me up is the fact that it seems all of the tests you write must start from the beginning of the app and work their way through. For example, if I want to test…
mike
  • 1,441
  • 2
  • 19
  • 31
42
votes
12 answers

Xcode 7 UITests with localized UI

In my App I'm using NSLocalizedString to localize my app. Now I want to switch to UITests and have Testcode like this: [tabBarsQuery.buttons["particiants"] tap]; This works for English but fails for other…
netshark1000
  • 7,245
  • 9
  • 59
  • 116
41
votes
14 answers

‘NSInternalInconsistencyException’ when running UITesting with Xcode 7

Ok, I’ve not been able to run this test in any betas so far. Some of the issues I’ve encountered are here and here Now, I feel like I’m missing something. Here’s my progress so far Enabled “UI testing” option while creating a new project. This, in…
SuPotter
  • 762
  • 1
  • 8
  • 16
1
2 3
77 78