xcode-ui-testing

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

廉价感情. 提交于 2019-11-27 00:53:55
问题 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, you run all of the test cases contained in the test target you've selected. You can also do so with scan from Fastlane, though I believe you're restricted to running all of the tests of the build scheme you select (as above), so it's not different

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

旧城冷巷雨未停 提交于 2019-11-27 00:36:43
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 "MyApp Would Like to Send You Notifications" popup. I'd like my test to dismiss both popups. UI recording generated the following code for me: [app.alerts[@"cameraAccessTitle"].collectionViews.buttons[@"OK"] tap]; However, [app.alerts[@"cameraAccessTitle"] exists] resolves to false, and the code above generates an error: Assertion Failure: UI Testing

Accessing the host app code from the Xcode 7 UI Test target

可紊 提交于 2019-11-27 00:11:33
问题 I am developing an iOS project, and I need to access to the codes of the host app from the UI test target, but I found that it shows link error: undefined symbol when I tried to. I found the test host and bundle loader for this target are all empty, so I set those to my host app and could get past the link error. However, at runtime it still fails when calling XCUIApplication.launch(). Has anyone figured out how to access the codes of the host app from this UI test target? Without being able

Delay/Wait in a test case of Xcode UI testing

ⅰ亾dé卋堺 提交于 2019-11-26 23:49:59
问题 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 to cause a delay or wait mechanism in the XCTestCase before proceeding to further steps? There is no proper documentation available and I went through the Header files of the classes. Was not able to find anything related to this. Any ideas

How to tap on a specific point using Xcode UITests

喜你入骨 提交于 2019-11-26 21:09:11
问题 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. tap(x: 10, y: 10) should produce a tap at the point {10px; 10px} . That's probably very simple, but I can't figure out how to do it. Thanks. 回答1: You can tap a specific point with the XCUICoordinate API. Unfortunately you can't just say "tap 10,10"

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

落花浮王杯 提交于 2019-11-26 19:29:16
问题 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 is prompted about allowing use of location service with alert titled: Allow “App name” to access your location while you use the app? with Allow & Don't Allow buttons. Problem is or so it seems that since the alert is presented by OS itself it is

Xcode UI Test example

半城伤御伤魂 提交于 2019-11-26 16:08:02
问题 I have just recently learned about Unit Testing in Xcode. Now I am trying out Xcode 7 and I see there is a new group for UI Tests when I create a new project. I watched the WWDC 2015 video and it was pretty good, but do you have a super simple example that I could go through myself? The video examples were a little too complex for me. Notes The answer below is my attempt to figure this out, but I welcome any better answers. I have read these SO questions about UI Testing in Xcode but they are

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

自闭症网瘾萝莉.ら 提交于 2019-11-26 09:28:05
问题 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 \"MyApp Would Like to Send You Notifications\" popup. I\'d like my test to dismiss both popups. UI recording generated the following code for me: [app.alerts[@\"cameraAccessTitle\"].collectionViews.buttons[@\"OK\"] tap]; However, [app.alerts[@\