xcode-ui-testing

Upgraded to Xcode 7.2 and my UI Tests Pass without running

淺唱寂寞╮ 提交于 2019-12-11 10:10:01
问题 I just upgraded to Xcode 7.2 and now my tests succeed without even running. As soon as it finishes building, it gives me the "Test Succeeded" message and the console shows no output. Is anyone else having this issue? UPDATE: So it looks like it's not working only on one specific device, which is an iPAD AIR 2, and the UI Test platform doesn't even install onto the device. It doesn't work on 2 separate machines both with Xcode 7.2. 回答1: The issue was resolved when I updated my device to iOS 9

How to access the `detailTextLabel` in a `tableViewCell` at UITests?

只谈情不闲聊 提交于 2019-12-11 08:12:29
问题 I wanna check whether there is a tableViewCell.detailTextLabel with a given string in my UITest. The problem is when I search for app.tables.cells.children(matching: .staticText) it will only look for labels that are tableViewCell.textLabel . Any ideas on how to query for the detailTextLabel ? 回答1: You can try a more generic query to determine if the text exists at all. If you are trying to assert that a cell contains "123 Main St.", for example, you can use the following: let app =

XCUIApplication replacements for UIATarget captureScreenWithName()

淺唱寂寞╮ 提交于 2019-12-11 06:38:40
问题 We are trying to migrate from UIAutomation to XCUITests and did use the captureScreenWithName() API to programmatically generate screen shots. What is the replacement in the XCUITests ? (I know that automatically screenshots are taken in case of error, but we have a special test which runs forever in a loop and evaluates QA click,tap commands via network similar to the appium-xcuitest-driver https://github.com/appium/appium-xcuitest-driver) Do I need to rip out private headers (XCAXClient_iOS

How to run javascript and fetch a value of hidden variable in page source using XCUITest?

China☆狼群 提交于 2019-12-11 04:59:48
问题 I'm new to this iOS world but quite excited to use XCUITest to automate my iOS webView application. I'm trying to figure out as to how can i run javascript from my XCTest for webView application and fetch the value of the hidden variable. For e.g. my app has webView and it's page source contains the following elements <input type="hidden" name="demo" value="test"> I've got the handle of the webView using the following: let webViewQury:XCUIElementQuery = app.descendantsMatchingType(.WebView)

iOS - Exclude Test files from Release build

流过昼夜 提交于 2019-12-11 04:28:48
问题 While developing an iOS application, I am required to run unit & ui tests on a preloaded database. So, I planned to include the DB file preloaded in the App only for DEBUG build as UI/Unit tests will run only with DEBUG build. How can i exclude the DB file from Release build? Currently I can detect if the host app is running for testing or not using following way, https://stackoverflow.com/a/33466038/1084174, but how can exclude and include database.db using this technique? A little guidance

The bundle “MyProjectUITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle

懵懂的女人 提交于 2019-12-11 02:58:55
问题 I'm willing to add unit and UI tests to my app. I first configured unit tests with success, I tried to do the same with UI tests. Here is my Podfile, after adding a new UI Testing Bundle target : platform :ios, '8.0' use_frameworks! inhibit_all_warnings! def shared_pods pod 'Bolts' pod 'Branch' pod 'FBSDKCoreKit' pod 'FBSDKLoginKit' pod 'FBSDKShareKit' pod 'GoogleAnalytics' pod 'GooglePlaces' pod 'Parse' pod 'Toast-Swift' end target 'MyTarget' do shared_pods end target 'MyTargetUITests' do

Xcode 7 - How to initiate interface recording for UI Testing?

蹲街弑〆低调 提交于 2019-12-10 19:59:32
问题 I'm looking at the WWDC 2015 session 104 "What's new in Xcode" and see that in Xcode 7 I can record interface unit tests to automate clicking on buttons, enter text, etc. I have a new project created with UITests included, but how do I actually start recording interface interactions for UITests? Here's the snippet included in the test: - (void)setUp { [super setUp]; // Put setup code here. This method is called before the invocation of each test method in the class. // In UI tests it is

Xcode UI Testing - Finding element in Webview by id

浪尽此生 提交于 2019-12-10 19:06:39
问题 Our app is hybrid and contains webview. I'm trying to automate our app using Xcode UI Testing. I was able to locate web buttons using: let app = XCUIApplication() app.launch() let button = app.staticTexts["Button's text"] But in one of our tests we test localization - meaning the text changes and the static text query is no longer valid. Couldn't find any documentation how to locate an element by his id (or even class name). Any ideas? 回答1: I have had a similar problem trying to fill in text

Cannot find stackview in accessibility indicator in XCUITest

半世苍凉 提交于 2019-12-10 17:49:14
问题 I'm writing UI test cases for my view controller.it has three views 1.A header view ->Stackview -> 4 buttons 2.table View 3.footer view - > 5 buttons All views are accessible except stackview and its child buttons Can anyone guide me how do i get reference of stackview and its child elements? 回答1: Set the header view and stack view to be inaccessible and the child elements to be accessible. You can do this using the UIAccessibility API, setting isAccessibilityElement to false for the

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: \