xcode-ui-testing

How to test UIImageView elements in iOS XCTest?

≡放荡痞女 提交于 2019-11-30 04:15:18
问题 I'm trying to test my UIs using XCTest UI testing, and having troubles of testing UIImageViewsI have in my app (hit tests, presence etc). In the list of the XCUIElementType there is no such type, and when I look at the children of the superview my UIImageViews are not listed there for some reason eventhough I can see them on screen and in the UI inspector in the Xcode. Has anyone had this kind of problem? 回答1: Assert the presence of an image by its accessibility label. Production Code let

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

偶尔善良 提交于 2019-11-29 23:32:08
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 () -> ()", referenced from: MyAppUITests.MyAppUITests.testExample (MyAppUITests.MyAppUITests)() -> () in

UI Test deleting text in text field

旧巷老猫 提交于 2019-11-29 22:02:17
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 keyboard Recording generated for me nothing. After doing the same with software keyboard I got: let key = app.keys["Usuń"] // Polish name for the key key.tap() key.tap() ... // x times or app.keys["Usuń"].pressForDuration(1.5) I was worried that my test is language-dependent so I have created something like this for my supported languages: extension

Intermittent “Failure attempting to launch” in ios UITest

人走茶凉 提交于 2019-11-29 20:05:27
问题 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

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

好久不见. 提交于 2019-11-29 18:37:59
问题 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 回答1: Unfortunately Apple hasn't provided any scrollTo method or a .visible parameter on XCUIElement . That said, you can add a

Testing UIWebView with Xcode UI Testing

谁都会走 提交于 2019-11-29 17:51:58
问题 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:

Check Email during Xcode UI Testing?

怎甘沉沦 提交于 2019-11-29 17:28:49
UPDATE: Is this still possible with the new way of UI testing with Xcode ? Can I programmatically access my email from an iOS UI Automation script? I want to access the signup code that my iPhone app emails to my email account. If you have a way for your device/simulator to receive the code while still in the app then you can write a script an iOS UIA script to do this. However with the current state of the built in iOS UIA tool, you cannot access anything that is outside of your app. So basically you cannot launch your app, then launch another app (like safari) go to mail.google.com blah blah

Xcode UI tests - Lost connection to test manager service

倖福魔咒の 提交于 2019-11-29 16:56:54
问题 Sometimes while running my UI tests, I get the following error Lost connection to test manager services . No logs or anything. Happens randomly. I would provide more information but I just don't have it because of the nature of the error. Using Xcode 7 beta 5. 回答1: The error appear for every async operations made in tests. It can be: Operation on non existing object dispatch_after Network operations with wrongly assign block handler 回答2: I was getting the same error when running UI tests

Xcode UI Tests can't find views that are added programatically

本秂侑毒 提交于 2019-11-29 15:56:11
So I'm adding a child view to my view programatically, and when I do I attach all accessibility params to it: [labelView setAccessibilityLabel:@"label"]; [labelView setIsAccessibilityElement:YES]; [labelView setUserInteractionEnabled:YES]; But when I query the UI like this: let app = XCUIApplication() app.staticTexts["label"] The test fails because it couldn't find the view. Any idea how to deal with this, how to make dynamically added views available for UI Testing ? You need to make sure that the container view of your label view (UIEditText?) doesn't have isAccessibilityElement set to YES.

Test target `MyAppTests` encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted)

核能气质少年 提交于 2019-11-29 14:20:22
Problem arise with continuous integration when try to run bot on device. Test target MyAppTests encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted) Do you know why it happens? Any ideas? The following worked for me. I don't know if some of the steps can be skipped, so I'm posting all of it. Update CocoaPods to version min. 1.1.0 on both dev machine and server sudo gem update cocoapods . As per terminal output during CocoaPods set Always Embed Swift Standard Libraries to No in the projects settings. I did it for the main, test and