xcode-ui-testing

Intermittent “Failure attempting to launch” in ios UITest

拈花ヽ惹草 提交于 2019-11-30 14:10:33
I see this about 1/10 times with my UI Tests on Xcode7.3/iOS9.3 Test Case '-[WhatevUITests.RegistrationUITests testVerifyUnsupportedPhoneNumberAlert]' started. t = 0.00s Start Test t = 0.00s Set Up t = 0.01s Launch me.jackpine.whatev-dev t = 0.11s Terminate <XCUIApplicationProcess: 0x7ff91a712550 me.jackpine.whatev-dev (94280)> t = 1.14s Assertion Failure: UI Testing Failure - Failure attempting to launch <XCUIApplicationImpl: 0x7ff91a49fae0 me.jackpine.whatev-dev at /Users/mkirk/src/jackpine/Whatev-iOS/build/Whatev/Build/Products/Debug-iphonesimulator/Whatev Dev.app>, nil token for current

UITesting Xcode 7: How to tell if XCUIElement is visible?

女生的网名这么多〃 提交于 2019-11-30 13:31:17
I am automating an app using UI Testing in Xcode 7. I have a scrollview with XCUIElements (including buttons, etc) all the way down it. Sometimes the XCUIElements are visible, sometimes they hidden too far up or down the scrollview (depending on where I am on the scrollview). Is there a way to scroll items into view or maybe tell if they are visible or not? Thanks Unfortunately Apple hasn't provided any scrollTo method or a .visible parameter on XCUIElement . That said, you can add a couple helper methods to achieve some of this functionality. Here is how I've done it in Swift. First for

Xcode 7: is chasm between app tests and UI tests unbridgeable?

泄露秘密 提交于 2019-11-30 13:04:44
问题 Xcode 7† has a new way to test your UI directly, including a new testing target "iOS UI Testing Bundle" (or "OS X"). In the UI testing target, it appears there's no built-in access to the model or classes that comprise your App. E.g. [UIApplication sharedApplication] would not be callable from your UI tests. This implies that "app tests" and "UI tests" exist across a possibly unbridgeable chasm. As stated here: The problem is that Xcode’s UI testing does not allow access to the actual app.

Testing UIWebView with Xcode UI Testing

谁说我不能喝 提交于 2019-11-30 12:02:40
I'm using new Xcode UI Testing from XCTest Framework with the Xcode 7 GM . I've got an app with simple UIWebView (it's just a navigation controller + view controller with web view and button) and I want to check following scenario: Web View loads page www.example.com User taps on button Web View loads some page with URL: www.example2.com I want to check which page is loaded in UIWebView after pressing button. Is this possible with UI Testing right now? Actually I'm getting web view like this: let app:XCUIApplication = XCUIApplication() let webViewQury:XCUIElementQuery = app

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

你。 提交于 2019-11-30 11:02:41
问题 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 test, the linker throws an error (See below): In the application source file: func foo() { assert(true) } In the UI tests: import XCTest @testable import MyApp func testExample() { foo() } Error: Undefined symbols for architecture i386: "MyApp.foo ()

Is there a way to find if the XCUIElement has focus or not?

若如初见. 提交于 2019-11-30 08:52:47
One of my screen has multiple text fields, I can land to this screen from different other screens. In each case I am making one or another text field as first responder. I am not able to write test to determine whether the desired textField has focus or not. When I print the textfield in console - Output: { TextField 0x131171d40: traits: 146031247360, Focused , {{6.0, 108.3}, {402.0, 35.0}}, value: ​ } But I could not find any focus/isFocus property on XCUIElement. Is there a way to achieve this ? hris.to I little bit late for the party :) However as far as I can see from dumping the variable

Possible to bring the app from background to foreground?

余生颓废 提交于 2019-11-30 07:25:55
问题 When running an XCT UI test it is possible to put the application under test in the background with: XCUIDevice().pressButton(XCUIDeviceButton.Home) It it possible in some way to bring the app back to foreground (active state) without relaunching the application? 回答1: Update for Xcode 9 : Starting in Xcode 9, you can now simply call activate() on any XCUIApplication. let myApp = XCUIApplication() myApp.activate() // bring to foreground https://developer.apple.com/documentation/xctest

Can't get access to string localizations in UI Test (Xcode 7)

て烟熏妆下的殇ゞ 提交于 2019-11-30 06:33:47
问题 So I have a situation in which I have a few textFields that are validated. I'm trying to run a UI test, and when they fail they will get an alert to pop up with an error message (potentially a different message depending on what fields are invalid and in what way). I'd like to test that not only that an alert appeared, but that the correct message is displayed. The problem I'm having is that I need to get the localized text for comparison (if I run tests in another language other than english

Xcode 7: is chasm between app tests and UI tests unbridgeable?

家住魔仙堡 提交于 2019-11-30 05:16:58
Xcode 7† has a new way to test your UI directly, including a new testing target "iOS UI Testing Bundle" (or "OS X"). In the UI testing target, it appears there's no built-in access to the model or classes that comprise your App. E.g. [UIApplication sharedApplication] would not be callable from your UI tests. This implies that "app tests" and "UI tests" exist across a possibly unbridgeable chasm. As stated here : The problem is that Xcode’s UI testing does not allow access to the actual app. Questions: Can this chasm be bridged? If so, how, in detail, with build and linker settings and possibly

addUIInterruptionMonitor(withDescription:handler:) not working on iOS 10 or 9

删除回忆录丶 提交于 2019-11-30 05:11:45
The following tests works fine on iOS 11. It dismisses the alert asking permissions to use the locations services and then zooms in in the map. On iOS 10 or 9, it does none of this and the test still succeeds func testExample() { let app = XCUIApplication() var handled = false var appeared = false let token = addUIInterruptionMonitor(withDescription: "Location") { (alert) -> Bool in appeared = true let allow = alert.buttons["Allow"] if allow.exists { allow.tap() handled = true return true } return false } // Interruption won't happen without some kind of action. app.tap()