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
39
votes
10 answers

Scroll until element is visible iOS UI Automation with Xcode 7

So with the new Xcode update Apple has revamped the way we do UI testing. In instruments we used java script function "isVisible" to determine if our targeted element is visible. I'm trying to replicate this in Objective-C but I can't seem to find…
CodeGeass
  • 619
  • 2
  • 7
  • 20
38
votes
7 answers

Running individual XCTest (UI, Unit) test cases for iOS apps from the command line

Is it possible to run individual test cases, or individual test suites, from an iOS app test target, instead of all the test cases, from a command line interface? You can run tests from command line with xcodebuild, out of the box. When you do so,…
Apophenia Overload
  • 2,485
  • 3
  • 28
  • 46
37
votes
11 answers

How to hide keyboard in Swift app during UI testing

I just started with UI testing in Xcode 7 and hit this problem: I need to enter text into a textfield and then click a button. Unfortunately this button is hidden behind the keyboard which appeared while entering text into the textfield. Xcode is…
leizeQ
  • 795
  • 1
  • 7
  • 18
36
votes
3 answers

Linker error when accessing application module in UI tests in Xcode 7.1

I'm trying to implement some UI tests in my project. Everything goes fine as long as I keep it simple: record the test case, add some asserts, then run the test. This works fine, however when I try to access the application module from inside my…
lawicko
  • 7,246
  • 3
  • 37
  • 49
35
votes
7 answers

Is it possible to "toggle software keyboard" via the code in UI test?

I have UI tests which testing login functionality (and uses it to test other stuff), but sometimes when focus is changed from one field to another - the keyboard hides, and although the cursor is blinking in the field, I getting error on…
extempl
  • 2,987
  • 1
  • 26
  • 38
33
votes
7 answers

Testing if an element is visible with Xcode 7 UITest

I want to verify if an element is visible or not depending on its .hidden property but I don't find a valid way to do that using the new Xcode 7 UI test stuff. I've tried with myelement.exists and myelement.hittable but they doesn't seems to work…
MatterGoal
  • 16,038
  • 19
  • 109
  • 186
32
votes
4 answers

How to tap on a specific point using Xcode UITests

I want to use Xcode UI tests with the Fastlane Snapshot to make screenshots of the Cordova app. Basically, as my entire app is just a web view, all the Xcode UI test helper methods become irrelevant, and I just want to tap on specific points, e.g.…
Dmitry Sokurenko
  • 6,042
  • 4
  • 32
  • 53
32
votes
8 answers

Xcode7 | Xcode UI Tests | How to handle location service alert?

I am writing UI Test Cases for one one of my app using the XCUIApplication, XCUIElement and XCUIElementQuery introduced in Xcode7/iOS 9. I have hit a road block. One of the screens in test case requires iOS's Location Services. As expected the user…
Taha Samad
  • 1,135
  • 1
  • 9
  • 22
31
votes
4 answers

Where is the screenshot file from Xcode UI Test?

I'm interested how to find the location of a screenshot which is created during UI Tests of my app. I would like to understand how Fastlane Snapshot grabs this screenshot. After couple of hours of research I can't find location of those screenshots.
Robert
  • 3,790
  • 1
  • 27
  • 46
31
votes
2 answers

Xcode UI Testing - Timestamped Event Matching Error

We are getting this error when recording a UI test. At this point the recorder stops recording code. What does it mean?
Jason Hocker
  • 6,879
  • 9
  • 46
  • 79
31
votes
4 answers

Xcode 7 UI Testing: Dismiss Push and Location alerts

I encountered a problem with Xcode 7 UI Testing. The app displays two alerts after my user logs in, the Request Location Alert and the Push Notifications Alert. Those notifications are shown one right after the other. The Location one appears…
Thomas LEVY
  • 310
  • 3
  • 5
30
votes
17 answers

Xcode 7 UI Tests, Recording button is greyed out

I am trying to add UI tests to my existing project using Xcode 7. However the UI test recording button is always greyed out. What I am missing here? I tried restarting Xcode, cleaning and rebuilding the project and adding a new UI test target. Does…
rustylepord
  • 5,681
  • 6
  • 36
  • 49
27
votes
3 answers

Handler of addUIInterruptionMonitor is not called for Alert related to Photos

private func acceptPermissionAlert() { _ = addUIInterruptionMonitor(withDescription: "") { alert -> Bool in if alert.buttons["Don’t Allow"].exists { //doesnt get here second time …
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
27
votes
4 answers

XCUITest Multiple matches found error

I am writing tests for my app and need to find the button "View 2 more offers" there are multiple of these buttons on my page but I would just like to click on one. When I try this, an error comes saying "Multiple matches found" So the question is,…
Billy Boyo
  • 819
  • 2
  • 12
  • 22
27
votes
1 answer

Can I disable animation for Xcode-UI-Tests?

I am using Xcode7 to write UITest, the problem is I need to wait for all the steps to happen before I validate the actual result. This takes a lot of time with all with view controller pushing/presenting/dimissing. Is there a way through which I…
Sandy
  • 3,021
  • 1
  • 21
  • 29
1
2
3
77 78