xcuitest

Xcode UITest sometimes does not find property of XCUIElement

时光怂恿深爱的人放手 提交于 2019-12-10 14:19:34
问题 In my UI tests, the frame property of some XCUIElement are found, but not of others. The accessibility identifiers used below are set in storyboard, and app is initialised in setUp() as XCUIApplication() . Here is the storyboard layout: The two UI elements used in the test are Text Field and Add Button . Here is the relevant code: func test() { // given let mainViewNavigationBar = app.navigationBars[„NavBar“] let navBarHeight = mainViewNavigationBar.frame.size.height print("navBarHeight: \

XCUITest: Running tests across two apps in a coordinated fashion

余生长醉 提交于 2019-12-08 05:27:23
问题 I am looking at using XCUITest for UI tests for my iOS apps. It looks like XCUITest has a wide arrange of functionality, including the ability to work with multiple apps. However, the multiple app support seems somewhat limited. It seems that using XCUIApplication I can start another app using Bundle ID and even monitor its state. However, what I want to do is be able to run a coordinated test for two apps that have tight interaction (for example, one app does an open URL to another app,

How do I access my swift classes from my UI tests?

痞子三分冷 提交于 2019-12-08 04:32:51
问题 I have a UI test like so : func testHome(){ if(isRedOrange.clear()){ //code } } How would I access my isRedOrange.clear function from my isRedOrange.swift file from my UI tests? 回答1: UI Tests are black boxed, so you cant have access to your code . You can use @testable import in Unit Tests , so full access will be provided. When you're running UITests this is not working, because during a UITest your test class cannot access your app's code. From Apple's Docs: UI testing differs from unit

Xcode 9, iOS 11, XCUITest failure: Main Thread Checker Flurry Analytics

北城以北 提交于 2019-12-08 00:25:42
问题 Running my suite of XCUITests using Xcode 9 running on iOS 11. Tests all run perfect in Xcode 8 (iOS10), but in Xcode 9 I get the following error: Main Thread Checker: UI API called on background thread [UIApplication statusBarOrientation]... ... Queue name: com.Flurry.Analytics.Session This can be fixed by commenting out all the Flurry code, but that is obviously not ideal. This issue has been seen by devs previously: https://github.com/flurry/flurry-ios-sdk/issues/91 However, in this case,

XCUITest - How to disable Wi Fi while app is running?

旧时模样 提交于 2019-12-06 12:47:36
问题 I want to automate how ios App behave while running the XCUITest. When manually executing the test, I turn off the wi fi adapter. How do I do that using Xcode UI test? thanks p.s. I found that we can use below command to disable wi fi. But to do this I will need to send my app to background. I need to do this without sending current app to background. let settingsApp = XCUIApplication(bundleIdentifier: "com.apple.Preferences") settingsApp.launch() settingsApp.tables.cells["Airplane Mode"].tap

How to test if a UIImageView contains an image with a specific name using XCUITest?

大兔子大兔子 提交于 2019-12-06 10:35:24
I have a collectionView that has a bunch of cells that contain a single UIImageView in each cell. I want to test wether or not in each cell, the imageView's image matches the correct image name. In the production code, I've added an accessibility identifier to the UIImageView example: "My Image View". I loop through an array of strings containing image names and set the cell's image in accordance to the index, example: ["image0.png", "image1.png", "image2.png"] so cells at index 0-2 would have those images respectively. In my XCUITest file I'm trying something like this: XCTAssert(cells.images

Is it possible to automate two apps at the same time in iOS?

巧了我就是萌 提交于 2019-12-06 10:25:42
We have this scenario: Execute the script in app1, in certain step app1 sends us a SMS with a URL, app1 is expecting a validation code in a textfield We have to open SMS app to verify if SMS exists, this SMS has a URL and when we click on it, it sends us to app1 again but automatically the validation code is written in the textfield. then, continue with the script. is it possible to do this? what do we need to make it? Thanks. Yes, As per your scenario you have to launch the messages(call it as app2) application in the middle of execution of script in app1. You can open the app2 by using below

XCUITest - How to disable Wi Fi while app is running?

时光总嘲笑我的痴心妄想 提交于 2019-12-04 18:18:39
I want to automate how ios App behave while running the XCUITest. When manually executing the test, I turn off the wi fi adapter. How do I do that using Xcode UI test? thanks p.s. I found that we can use below command to disable wi fi. But to do this I will need to send my app to background. I need to do this without sending current app to background. let settingsApp = XCUIApplication(bundleIdentifier: "com.apple.Preferences") settingsApp.launch() settingsApp.tables.cells["Airplane Mode"].tap() You can re-activate your app afterwards with the new activate() method on XCUIApplication. It will

How do I install the XCUITest runner app and ipa on a real device and get the results?

帅比萌擦擦* 提交于 2019-12-04 16:06:06
How do I install the XCUITest runner app and ipa on a real device and get the results? I have a runner.app that was generated by building it for testing, and a deployed/signed .ipa. Now what I would like to happen is to have it installed on a real device, execute it, and get the device log. Edited with answer... It is possible to achieve this. In order to build an ipa of the UI Testing app bundle you can follow these steps: Open your project containing in Xcode. Select the device you'd like to build the ipa for next to the scheme. This can be an actual device or a simulator. Product > Build

Xcode Scheme Default Location is ignored in Tests

ぐ巨炮叔叔 提交于 2019-12-03 06:59:54
I've created a GPX file and added it to my project. If I have my project running, I can select the GPX file from the dropdown of possible locations to simulate and have it correctly apply the defined path. The project contains 2 schemes: the Main Scheme and the MainTest Scheme. I've set up both to use the GPX file as the "Default Location" on the "Options" tab. Further, Under the "Test" area of both schemes, I've specified the same file again. Main Scheme Run Options Main Scheme Test setup Test Scheme Run Options Test Scheme Test setup When I Run the app on a simulator, it correctly applies