Questions tagged [xcuitest]

Apple's XCUITest framework for UI Testing on iOS and Mac OS.

638 questions
8
votes
1 answer

How to set an accessibility identifier properly in SwiftUI?

I would like to be able to tap a concrete button on my stack of views. To achieve this, first I set on my code an accessibility id: Button(action: { withAnimation(.easeOut(duration: 1)) { …
Andoni Da Silva
  • 1,161
  • 15
  • 31
8
votes
2 answers

Xcode UITest scrolling to the bottom of an UITableView

I am writing an UI test case, in which I need to perform an action, and then on the current page, scroll the only UITableView to the bottom to check if specific text shows up inside the last cell in the UITableView. Right now the only way I can…
Amy L.
  • 210
  • 2
  • 4
  • 14
8
votes
2 answers

How to access a right item button on navigation bar in XCUITest?

I am writing UITest cases for my iOS Swift app. In the app I have created a custom right item button on the navigation bar in this way: let barButtonItem = UIBarButtonItem(customView: customView) navigationItem.rightBarButtonItem =…
Zhengqian Kuang
  • 1,079
  • 1
  • 9
  • 12
8
votes
2 answers

Force Touch/ 3D Touch in XCUITest

I am trying to add a force touch automation for an iOS App. I looked into the Apple docs for the same problem but cannot find anything useful. We can do the force touch from the assistive touch but I am looking for something as simple as the tap()…
Kushal Jogi
  • 265
  • 5
  • 15
8
votes
1 answer

Is it possible to open a screen directly in XCUITest?

I have 3 screens, lets say, Login Forgot Password Help screen By default the Login screen open when the app starts. The Forgot Password screen is shown when you click on the Forgot Password button, and Help Screen opens when the Help link is…
anotherCoder
  • 712
  • 3
  • 11
  • 25
8
votes
3 answers

Xcode UITest sometimes does not find property of XCUIElement

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…
Reinhard Männer
  • 14,022
  • 5
  • 54
  • 116
7
votes
3 answers

addUIInterruptionMonitor() not working on device running iOS 14.0.1

Since upgrading my device (iPhone 11) to iOS 14.0.1, I have found addUIInterruptionMonitor() to not be triggered at all. It was working before on iOS 13.4.1, which was the last version I had installed. My…
podomunro
  • 495
  • 4
  • 16
7
votes
3 answers

How to set Dark Mode in XCUIApplication in swift UITests?

I was wondering if there is a way to set dark mode in-code for the XCUIApplication within a swift UITests project. I have a need to launch the app in light mode and dark mode in the same test. Setting this in the scheme as a hard coded value will…
TheJeff
  • 3,665
  • 34
  • 52
7
votes
1 answer

Is it possible to copy a file in a UITests target to the documents directory of the app?

I have a sample text file in my UITests target. I want to copy this file to the documents directory of the app so that when I perform tests on uploading of file in my app, I can select it via Files app and upload it.
mownier
  • 1,719
  • 2
  • 13
  • 27
7
votes
2 answers

Accessing buttons on a UIActivityViewController in an iOS 13 UI test causes a crash

Is anyone else having problems running Xcode UI tests with Xcode 11 targeting an iOS 13 simulator or device where looking for the buttons on an UIActivityViewController causes a crash? I have multiple UI tests that verify the buttons that appear in…
Mattio
  • 2,014
  • 3
  • 24
  • 37
7
votes
1 answer

How to fix 'XCtests failing intermittently to launch app in the simulator' in Xcode 10

When I try to run my test cases in simulator, I'm getting this error: "Failure requesting automation session for com.name.name:61876: Timeout waiting for fulfillment of promise for 'Requesting automation session for com.name.name" when app…
Suneel IOS
  • 71
  • 6
7
votes
1 answer

128 character limit in UI test Xcode

This test in failing because exceeds maximum length of 128 characters. You can work around this limitation by constructing a query with a custom NSPredicate that specifies the property (label, title, value, placeholderValue, or identifier)…
user426132
  • 1,341
  • 4
  • 13
  • 28
7
votes
2 answers

iOS UITest: How to test custom accessibility actions?

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…
Artur Friesen
  • 155
  • 1
  • 1
  • 9
7
votes
1 answer

UI Tests with react native. How to fix Timestamped Event Matching Error: Failed to find matching element

I am trying to integrate UI tests in an quite big react native project. But as soon as i want to record the ui test i get the warning Timestamped Event Matching Error: Failed to find matching element This is the ui element i am…
Martin Mlostek
  • 2,755
  • 1
  • 28
  • 57
7
votes
2 answers

How do I get the number of elements matching an identifier, say "fooImage" returned by an XCUIQuery?

lets say I have a table with three images whose accessiblityIdentifier set to "fooImage". XCTAssertTrue(table["tableName"].images.count == 3) will work, but this is sucky -- what if someone adds another image type? I want the count of all the images…
ablarg
  • 2,400
  • 1
  • 24
  • 32
1
2
3
42 43