xcuitest

XCUITest using Robot pattern can't print the erroneous line

落花浮王杯 提交于 2021-02-11 16:58:46
问题 I'm trying to refactor the UI test of my project to use Robot pattern. But it seems like it can't show what line in the code is the one with the error. Here's the screenshot: As you can see here, the testShowAppHealthAndBackWithoutRobot() can show the error in red line while the testShowAppHealthAndBack() doesn't. Here are the robots's code: class Robot { let app: XCUIApplication init(app: XCUIApplication) { self.app = app } func tap(_ element: XCUIElement, timeout: TimeInterval = 5) { guard

How to delete/reset an app from iOS 13 with XCTest?

扶醉桌前 提交于 2020-08-03 08:16:37
问题 Recently I started testing an iOS app using XCTest but I found some difficulties, the main difficulty was deleting or resetting the app content in each test class. I'm currently using XCode 11 and trying to delete/reset an app from iOS 13 for each test class, I've already tried: Delete app through springboard Delete app by going to the app settings This step is really important in my tests because in each test I need to create a profile and log in, so in the next test I need to have the app

Can we automate audio/video calls in native iOS devices?

时光毁灭记忆、已成空白 提交于 2020-07-20 06:26:29
问题 how to automate audio/video calls in iOS devices? How do caller get to know if callee has picked up the call or rejected? How to automate two devices at a time? Is it feasible to automate video/audio call in iOS devices? if yes can you please share the references? 回答1: Automating end-to-end scenarios is a challenging task. I would start with automating calls on one device and assert the network response with your server's APIs. Not really a StackOverflow question. Read these companies blogs

Access App Groups container directory from test runner

感情迁移 提交于 2020-05-14 09:15:00
问题 There is some data stored by main target in app groups container directory. And i'am running some xcui tests. Is it possible to access the data of the container from test runner? Alternatives? It seems like for me that the answer is NO, because containerURL(forSecurityApplicationGroupIdentifier:) method returns nil . Thank you! 回答1: Actually, you can! Simulator: Write / duplicate your shared data to this location; it should be accessible to both the UITestRunner and your application. Remember

iOS UITest: How to test custom accessibility actions?

做~自己de王妃 提交于 2020-03-21 11:51:05
问题 I want to support VoiceOver. I have an UIButton inside of an UITableViewCell . According to a best practice I have disabled the button for accessibility ( .isAccessibilityElement = false ) and implemented a custom accessibility action for the cell ( accessibilityCustomActions, NSAccessibilityCustomAction ). This way VoiceOver would not find and read the button as an own element. To make the feature behind the button accessible, I have added a custom accessibility action to the cell. With the

XCUITest - fail to find UICollectionView Cell and cell items

徘徊边缘 提交于 2020-03-04 21:33:16
问题 i have collection list of items cell , i wants to make UI test (XCUItest). But unable to find the element collection view cell and its elements inside it . UIViewController ---> UICollectionView ----> UICollectionViewCell -----> The element that I would like to get. func testProductListingPageLoad() { let collection = app.collectionViews["ProductList"] let element = collection.cells["ProductListItemCell0"].firstMatch XCTAssert(collection.exists) // it is successful XCTAssert(element.exists) /

How to Dynamically add XCTestCase

本小妞迷上赌 提交于 2020-01-13 12:08:13
问题 I'm writing a UI Test for a white label project where each app has a different set of menu items. The test taps on each menu item and takes a screenshot (using fastlane snapshot). Currently this all happens inside one XCTestCase called testScreenshotAllMenuItems() which looks like this: func testScreenshotAllMenuItems() { // Take a screenshot of the menu openTheMenu() snapshot("Menu") var cells:[XCUIElement] = [] // Store each menu item for use later for i in 0..<app.tables.cells.count {

XCUITest and UIActivityViewController

自闭症网瘾萝莉.ら 提交于 2020-01-12 10:54:28
问题 How do you access a UIActivityViewController (share / actions sheet) in XCUITest? According to the Accessibility Inspector, t is comprised of several UICollectionViews, which makes it hard to disambiguate the sheet itself. Querying for XCUIApplication().sheets.count returns 0 when the sheet is presented. 回答1: It turns out, when using the view debugger, the sheet is accessible via a somewhat hidden accessibilityIdentifier of ActivityListView (as of Xcode 9.2). It can be accessed with:

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

允我心安 提交于 2020-01-02 21:55:18
问题 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

How to get app information like app version, device os version in ios using Appium?

筅森魡賤 提交于 2019-12-24 01:01:51
问题 I am testing the app using appium and integrating the test output in testrail. I need to add the device and app information in the testrail. In android i am able to get app and device information like device model, device version and app version using adb command like following: adb -s 012313gasda shell getprop ro.product.model adb -s 012313gasda shell getprop ro.build.version.release adb -s 012313gasda shell dumpsys package com.test.app |grep versionName How can i achieve the same