xcode-ui-testing

How to UI test a Cocoa Touch Framework?

扶醉桌前 提交于 2019-12-06 05:04:05
What is the best practice for UI testing a Cocoa Touch Framework that contains UI helper methods and extensions? I was thinking of adding a new iOS project to it as well as a UI test project and having them built and ran only within the ProjectTests scheme. Is this how it's done? I can't find much documentation about this. 来源: https://stackoverflow.com/questions/40910756/how-to-ui-test-a-cocoa-touch-framework

Xcode UI test : Accessibility query fail on UITableViewCell

社会主义新天地 提交于 2019-12-06 01:57:31
问题 The issue Using Xcode UI test, I can not query the cells in a UITableView Explanations The UITableView The UITableView contains 3 cells : import UIKit @objc class DumpTable: UITableViewController { var objects: [NSDate] = [NSDate]() override func viewDidLoad() { super.viewDidLoad() objects.append(NSDate()) objects.append(NSDate()) objects.append(NSDate()) tableView.isAccessibilityElement = true tableView.accessibilityLabel = "Thetable" tableView.accessibilityIdentifier = "Thetable" } override

Xcode ui test: staticTexts start with

廉价感情. 提交于 2019-12-06 01:47:45
问题 I want to check if an element on my ui which start with a prefix is present. How is it possible to implement it in Xcode 7 UI Tests? app.tables["AAA"].staticTexts["Fax: 0049XXXXXXXX"].exists I have three element into a tableview cell and only one (the third or last one) starts with the prefix Fax: 0049. How can i check the present of this element? I tried with app.tables["AAA"].cells.staticTexts.elementBoundByIndex(2).exists But nothing, some ideas? Cheers 回答1: You can use a BEGINSWITH

Testing Action Extension with UI Tests

拈花ヽ惹草 提交于 2019-12-06 00:52:50
问题 Is it possible to perform UI tests on Action Extension targets? I am unable to create a UI testing target with the Action Extension as the "Target to be Tested." I am trying to load the Action Extension from within Safari (or Photos, although Safari/both is prefered) If I record my interactions I can get as far as: app.icons["Safari"].tap() I can then manually add: XCUIDevice.sharedDevice().pressButton(.Home) before the generated code, but it doesn't work as expected (the simulator is left on

How to test UITextField in Xcode UI Testing when the text field is empty?

雨燕双飞 提交于 2019-12-06 00:15:10
I am making a UITest in Xcode. When I record my test it works fine but when I run the test, it gives an error. These are the lines of code where the error occurs: XCUIElement *clearTextTextField = [app.textFields containingType:XCUIElementTypeButton identifier:@"Clear text"].element; [clearTextTextField typeText:@"sheffield"]; The error says UI Testing Failure - No matches found for textfield I imagine this is because my Text Field does not have any initial string and the tester cannot find a text box with initial string "Clear Text" . I watched the following tutorial on youtube. The

In XCTest UI Testing, how to check the background color of button, label , views?

☆樱花仙子☆ 提交于 2019-12-06 00:07:39
问题 I am trying to validate if the background color can be obtained in XCTest UI Testing, I am looking to compare the background color with the set value, so that i don't have to rely on image comparison 回答1: XCTest is for functional testing, rather than asserting visual requirements. To test requirements such as background color, use a unit test to initialize the view controller in question and check the view's background color there. You don't need to rely on image comparison, and unit tests

How to access the App Delegate from a UI Test?

青春壹個敷衍的年華 提交于 2019-12-05 22:45:58
I want to access a particular property router from the App Delegate of the launched app during a UI Test, but I can't figure out if this is possible or not. I have tried: let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate let router = appDelegate.router but this gives a failure and won't even build. I am using @testable on my project module. Any ideas? Xcode UI testing is designed such that the test code can only see what a user can see, so no objects from the application under test can be used or inspected in the test code. This is also why the views on the screen

How do I turn off the Accessibility Inspector in the iOS 9 simulator?

十年热恋 提交于 2019-12-05 21:52:51
The accessibility inspector is turned on by my KIF tests (apparently it's necessary for KIF to work.) Problem is, its window occludes controls some subsequent UI tests need to tap on and those tests fail. How can I turn the Accessibility Inspector off when my KIF tests are done with it so my UI Tests can run? (Turning it off "manually" from the simulator's Settings app is not a solution—I'm looking for something I can call from code, set in the target or...?) It is not on by default. You must turn it on manually. bby I saw the following on Stew Gleadow's blog . You just need to change the line

Attempting to run multiple tests using Xcode's new UI testing fails

本秂侑毒 提交于 2019-12-05 19:18:10
When I try to run multiple UI tests at the same time in the new Xcode beta, it fails after the first test, with the error "UI Testing Failure: App state is still not terminated" for each test after the first. Anyone got a fix for this? I have faced the same issue. It seems that, at least in my case, application had never been terminated. I solved it by putting the following statement in the setUp() method: continueAfterFailure = false This should stop a running test process after first failure. I cannot post a comment, so I will try to answer your question while getting some clarification. I

XCode bot error: Early unexpected exit, operation never finished bootstrapping -

空扰寡人 提交于 2019-12-05 18:14:39
问题 I have a project written in swift, and i have the main target and two test targets, one for unit testing using quick framework and it has 3 KIF tests. the other target has the XCUItests. so whenever i run XCode bot integration with our XCode CI Server, i get the following error: Bot Issue for Acceptance Bot (error) Integration #63 of Acceptance Bot Open in Xcode: xcbot://iosci/botID/1229919cecfcd510f090e37aed014a23/integrationID/16a3709d3ae008a68a65ff2fe9bb5a7b Assertion: Test target