Post not yet marked as solved
So I have a simple view for my SwiftUI application below:
import SwiftUI
struct ContentView: View {
var body: some View {
List {
ForEach(0..<4) { index in
RowView(index: index)
.accessibilityIdentifier("row")
}
}
}
}
struct RowView: View {
let index: Int
var body: some View {
HStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
Spacer()
ButtonView(index: index)
}
.padding()
}
}
struct ButtonView: View {
let index: Int
var body: some View {
VStack {
if index != 3 {
Button(action: {}, label: {
Text("Cancel")
})
.accessibilityIdentifier("cancel_button")
}
Button(action: {}, label: {
Text("Submit")
})
.accessibilityIdentifier("submit_button")
}
}
}
My goal is to reference each cancel and submit button per row for a UI Test, which I have tried doing so here:
let rowElements = app.tables.cells.matching(identifier: "row")
for i in 0..<rowElements.count {
let cancelButton = rowElements.element(boundBy: i).buttons["cancel_button"]
let submitButton = rowElements.element(boundBy: i).buttons["submit_button"]
XCTAssertTrue(cancelButton.exists, "Cancel button does not exist in row \(i)")
XCTAssertTrue(submitButton.exists, "Submit button does not exist in row \(i)")
}
Even with the identifiers set like this my tests fail and say it cannot find the buttons labeled as they are with their specific identifiers or the rows. What is the correct way to reference elements if they are in a list or table for UI Testing? I'm specifically trying to use accessibility Identifiers to make my life easy.
Post not yet marked as solved
Hello everyone,
I'm programming my app and after a few days I opened and ran it on my iPhone. This app worked, but with one big problem. The problem is that the app doesn't show up in my settings and I don't know why. I didn't program/change anything.
Thanks for the advice
Post not yet marked as solved
This code works when I run it in the iOS Simulator with iOS 17.0.1:
let passcodeInput = springboard.secureTextFields["Passcode field"]
_ = passcodeInput.waitForExistence(timeout: 10)
passcodeInput.tap()
However if I run it on the iOS Simulator with iOS 17.4 I get this error:
t = nans Checking existence of `"Passcode field" SecureTextField`
t = nans Capturing debug information
t = nans Requesting snapshot of accessibility hierarchy for app with pid 66943
t = nans Tap "Passcode field" SecureTextField
t = nans Wait for com.apple.springboard to idle
t = nans Find the "Passcode field" SecureTextField
t = nans Find the "Passcode field" SecureTextField (retry 1)
t = nans Find the "Passcode field" SecureTextField (retry 2)
t = nans Requesting snapshot of accessibility hierarchy for app with pid 66943
<unknown>:0: error: PRCheckUITests : Failed to tap "Passcode field" SecureTextField: No matches found for Descendants matching type SecureTextField from input {(
Application, pid: 66943, label: ' '
)}
Did the hardcoded string "Passcode field" change for iOS 17.4?
How can I access the passcode field through springboard in a test?
Post not yet marked as solved
Hi everyone!
I'm developing a cross-platform application with Flutter framework and i found an anomaly that is not really answered on any forums or just I'm too blind to find that.
So if I'm making a debug build on a real device or I download a test app from TestFlight after the first launch the app pops a "*** would like to find and connect to devices on your local network" dialog.
I tested a few app from App Store (some of them was made with Flutter, for example Revolut) but non of them asks for the mentioned permission.
So my question is: the released apps in App Store also requires permission for connection to network (so the "*** would like to find and connect to devices on your local network" dialog shows up) and i need to set something in the configs to get the permission instantly or all apps in App Store got the permission by default.
Post not yet marked as solved
Good morning.
I'm executing XCUitest tests on a real iPhone with iOS 17 and I'm receiving the following error:
2024-04-09 11:11:10.000 E HelloWorldE2EUITests-Runner(FrontBoardServices)[489] <Error>: Snapshot request 0x281f1c390 complete with error: <NSError: 0x281f373f0; domain: FBSSceneSnapshotErrorDomain; code: 4; "an unrelated condition or state was not satisfied"> {
NSLocalizedDescription = an error occurred during a scene snapshotting operation;
}
2024-04-09 11:11:10.000 E HelloWorldE2E(XCTTargetBootstrap)[490] <Error>: Error loading automation support library: Error Domain=com.apple.dt.xctest.error Code=1 UserInfo={NSLocalizedDescription=<private>}
2024-04-09 11:11:12.000 E HelloWorldE2E(XCTTargetBootstrap)[491] <Error>: Error loading automation support library: Error Domain=com.apple.dt.xctest.error Code=1 UserInfo={NSLocalizedDescription=<private>}
2024-04-09 11:11:13.000 E HelloWorldE2EUITests-Runner(FileProvider)[489] <Error>: [ERROR] Cannot query for providers. Error: NSError: Cocoa 257 "The file couldn\M-b\M^@\M^Yt be opened because you don\M-b\M^@\M^Yt have permission to view it."
2024-04-09 11:11:13.000 E HelloWorldE2EUITests-Runner(FileProvider)[489] <Error>: [ERROR] received an error when listing providers, attempting again: Error Domain=NSCocoaErrorDomain Code=257 "The file couldn\M-b\M^@\M^Yt be opened because you don\M-b\M^@\M^Yt have permission to view it." (count: 3)
2024-04-09 11:11:13.000 E HelloWorldE2EUITests-Runner(FileProvider)[489] <Error>: [ERROR] Cannot query for providers. Error: NSError: Cocoa 257 "The file couldn\M-b\M^@\M^Yt be opened because you don\M-b\M^@\M^Yt have permission to view it."
2024-04-09 11:11:13.000 E HelloWorldE2EUITests-Runner(FileProvider)[489] <Error>: [ERROR] received an error when listing providers, attempting again: Error Domain=NSCocoaErrorDomain Code=257 "The file couldn\M-b\M^@\M^Yt be opened because you don\M-b\M^@\M^Yt have permission to view it." (count: 2)
2024-04-09 11:11:13.000 E HelloWorldE2EUITests-Runner(FileProvider)[489] <Error>: [ERROR] Cannot query for providers. Error: NSError: Cocoa 257 "The file couldn\M-b\M^@\M^Yt be opened because you don\M-b\M^@\M^Yt have permission to view it."
2024-04-09 11:11:13.000 E HelloWorldE2EUITests-Runner(FileProvider)[489] <Error>: [ERROR] received an error when listing providers, attempting again: Error Domain=NSCocoaErrorDomain Code=257 "The file couldn\M-b\M^@\M^Yt be opened because you don\M-b\M^@\M^Yt have permission to view it." (count: 1)
2024-04-09 11:11:13.000 E HelloWorldE2EUITests-Runner(FileProvider)[489] <Error>: [ERROR] Cannot query for providers. Error: NSError: Cocoa 257 "The file couldn\M-b\M^@\M^Yt be opened because you don\M-b\M^@\M^Yt have permission to view it."
2024-04-09 11:11:13.000 E HelloWorldE2EUITests-Runner(FileProvider)[489] <Error>: [ERROR] can't get the list of providers: NSError: Cocoa 257 "The file couldn\M-b\M^@\M^Yt be opened because you don\M-b\M^@\M^Yt have permission to view it."
2024-04-09 11:11:13.000 E HelloWorldE2EUITests-Runner(CoreMediaIO)[489] <Error>: CMIOExtensionDiscoverySession.m:244:-[CMIOExtensionDiscoverySession setUpRegistration]_block_invoke Error received 3
2024-04-09 11:11:13.000 E HelloWorldE2EUITests-Runner(CoreFoundation)[489] <Error>: Not updating lastKnownShmemState in CFPrefsPlistSource<0x28231aac0> (Domain: com.apple.cameracapture.volatile, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes): 0 -> 16
2024-04-09 11:11:15.000 E HelloWorldE2E(AXRuntime)[491] <Error>: Unknown client: HelloWorldE2E
2024-04-09 11:11:26.000 E HelloWorldE2E(XCTTargetBootstrap)[494] <Error>: Error loading automation support library: Error Domain=com.apple.dt.xctest.error Code=1 UserInfo={NSLocalizedDescription=<private>}
2024-04-09 11:11:29.000 E HelloWorldE2E(AXRuntime)[494] <Error>: Unknown client: HelloWorldE2E
2024-04-09 11:11:40.000 E HelloWorldE2E(XCTTargetBootstrap)[495] <Error>: Error loading automation support library: Error Domain=com.apple.dt.xctest.error Code=1 UserInfo={NSLocalizedDescription=<private>}
2024-04-09 11:11:42.000 E HelloWorldE2E(AXRuntime)[495] <Error>: Unknown client: HelloWorldE2E
2024-04-09 11:11:44.000 E HelloWorldE2EUITests-Runner(UIKitCore)[489] <Error>: Background Task 3 ("Called by UIKitCore, from <redacted>"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(_:) for your task in a timely manner to avoid this.
2024-04-09 11:11:46.000 E HelloWorldE2E(XCTTargetBootstrap)[497] <Error>: Error loading automation support library: Error Domain=com.apple.dt.xctest.error Code=1 UserInfo={NSLocalizedDescription=<private>}
2024-04-09 11:11:48.000 E HelloWorldE2E(XCTTargetBootstrap)[498] <Error>: Error loading automation support library: Error Domain=com.apple.dt.xctest.error Code=1 UserInfo={NSLocalizedDescription=<private>}
2024-04-09 11:11:51.000 E HelloWorldE2E(XCTTargetBootstrap)[500] <Error>: Error loading automation support library: Error Domain=com.apple.dt.xctest.error Code=1 UserInfo={NSLocalizedDescription=<private>}
2024-04-09 11:11:54.000 E HelloWorldE2E(XCTTargetBootstrap)[501] <Error>: Error loading automation support library: Error Domain=com.apple.dt.xctest.error Code=1 UserInfo={NSLocalizedDescription=<private>}
2024-04-09 11:11:56.000 E HelloWorldE2E(XCTTargetBootstrap)[502] <Error>: Error loading automation support library: Error Domain=com.apple.dt.xctest.error Code=1 UserInfo={NSLocalizedDescription=<private>}
2024-04-09 11:11:58.000 E HelloWorldE2E(XCTTargetBootstrap)[503] <Error>: Error loading automation support library: Error Domain=com.apple.dt.xctest.error Code=1 UserInfo={NSLocalizedDescription=<private>}
2024-04-09 11:12:01.000 E HelloWorldE2E(XCTTargetBootstrap)[504] <Error>: Error loading automation support library: Error Domain=com.apple.dt.xctest.error Code=1 UserInfo={NSLocalizedDescription=<private>}
2024-04-09 11:12:03.000 E HelloWorldE2E(AXRuntime)[504] <Error>: Unknown client: HelloWorldE2E
2024-04-09 11:12:29.000 E HelloWorldE2EUITests-Runner(XCTestCore)[489] <Error>: Exiting due to IDE disconnection.
I'm not understanding the error because this only happens on iOS 17, the same tests on iOS 16 is working just fine. Also, the log seems to make reference to two things:
Error on Snapshot request. Which is strange because I'm not making any snapshot on the tests.
Errors with the loading of this: Error loading automation support library: Error Domain=com.apple.dt.xctest.error. I'm confused here because I don't know where to start to begin to look for solve this.
Post not yet marked as solved
New Apple Developer here,
I've built my first iOS app in Xcode and wants to get it onto some friends' iPhones to do some external testing and give me some feedback. I've read the Apple Developer documentation on how to use TestFlight, but it's not understandable since step 1 is entering information about the app in App Store Connect and step 2 is uploading the app to App Store Connect?
Can someone please write some easy step-by-step directions on how to get an iOS app from Xcode onto external testers' iPhones for a first-timer in 2024?
Thank you so much!
Post not yet marked as solved
I have had an app on the apps store for about 4 years. The app uses an API to retrieve some data and displays/manipulates it. The app works for the vast majority of users however, for around 0.01% of users, the first time they open the app after downloading it, the API fails and reports that it cannot retrieve data (it exits elegantly but does not crash). They cannot get the app to work and I have to issue a refund.
I cannot repeat the error on simulator or on my test iPhone (13). There is no consistency on IOS or phone model reported. I am guessing that there is some form of configuration that cause the app to fail to retrieve the data.
I don't even know where to start to identify the problem. Can anyone point me to some documentation or provide advice as to how I can capture, analyse and fix these rare failures.
Thanks
Post not yet marked as solved
Hi,
I'm currently researching if we are able to migrate to Xcode Cloud in our project. I encountered one issue.
I run unit tests on Xcode Cloud and I see that they finish in ~150 seconds, but the whole step takes ~530s and there is no information in logs why. I even run the same command on my local computer and it doesn't take that long. Any ideas? Any way to optimize it?
Also one more thing: it looks like Xcode Cloud is not running on M1 machines. Do you know guys if there are plans for Xcode Cloud to take advantage of M1/M2?
Post not yet marked as solved
Since couple of weeks ago (probably after I've updated my macbook to Sonoma 14.3.1) my Xcode cannot load unit test.
When opening Test Navigator all I see is: Loading Tests... and it stays forever in that state.
This is completely new project and this is crazy. Only way I can start testing is if I use CMD+U to run all the tests which is my company's project take a lot of time.
Also there's no option to click on test-diamond-shaped button to run individual tests. Also tried checking "Test Plans" but I have infinite progress views:
Anyone has any idea how to fix this?
I tried to remove Derived Data, to reinstall Xcode (and different versions), did "git clean -fxd" nothing helped. Also some function like: "Rename", "Edit all in scope" stopped working as well.
Post not yet marked as solved
Hello world, I'm doing unit testing with Swift. I need to create a test for the registration process of an application. When I register, a confirmation link is sent to the specified email. How can I create a test that allows me to access the email and click on the link to confirm the registration?
Post not yet marked as solved
Hi,
We're currently developing a PWA for our company - with Vue 3 and Quasar - and we have added it into the App Store (but in testing only, for now).
We have multiple problems but the worst is the following one: it seems that the app doesn't want to open external links with "window.open()" JS method. Instead it shows a screen with a progress bar and a crossed-out Wi-Fi icon.
It shows this for a few seconds then once the progress bar is completly filled it goes back to the previous page where it triggered. Needless to say that the wireless is connected (see the status icons at the top).
We have the same behavior when we try to download a PDF created as a BLOB file with some JS code.
I don't have an iPhone to test so maybe you have a good idea about this ?
Kind regards,
V.
Post not yet marked as solved
I'm trying to write performance tests with Xcode 15, but it's not working: even though setting a baseline seems to work (baseline data files are created), Xcode seems to ignore that baseline altogether whenever the test is run. As a result, performance tests never fail, no matter how bad performance gets.
The source editor persistently displays a “No baseline average for Time” message.
Has anyone else encountered this? Figured out how to sidestep the issue?
Of note, the issue is easily reproduced: create a new (macOS in my case) app project with tests, add a dummy performance test; run the test once and save its baseline, and despite this subsequent tests will always succeed, even if you significantly slow the dummy test down.
(I've filed this as FB13330139)
Post not yet marked as solved
Hello!
Since Xcode 15 came out, I've been having this issue with UI tests where the test runner hangs for 60s when the keyboard is presented.
In the test logs I get this kind of messages:
00:07.588 Wait for com.example.app to idle
01:07.642 App event loop idle notification not received, will attempt to continue.
Interestingly, this only appears to be happening in CI environments (I've tried Xcode cloud and Circle CI). It works fine on my local machine.
Everything is fine with Xcode 14, but I can't keep my CI environment stuck on Xcode 14 forever.
I've tried disabling animations using UIView.setAnimationsEnabled(false), but it did not fix the problem.
Here are the full logs of what it takes to fill out a text field: logs.txt
Post not yet marked as solved
Hi everyone, I'm quite new on this platform and I wanted to know as a dev if I want to test out a app do I need to download it from the App Store or is there a other way to test app on apple ?
Post not yet marked as solved
Hello everyone!
I'm just working on my first app in swift, and am out of knowledge about this case.
First, the related code :
`@IBAction func ajouterNouvelleValeur(_ sender: Any) {
// Créer une alerte pour saisir la nouvelle valeur
let alert = UIAlertController(title: "Ajouter une nouvelle valeur", message: nil, preferredStyle: .alert)
alert.addTextField { (textField) in
textField.placeholder = "Entrez la nouvelle valeur"
}
// Ajouter un bouton "Ajouter" pour ajouter la nouvelle valeur
alert.addAction(UIAlertAction(title: "Ajouter", style: .default, handler: { [weak self] action in
guard let textField = alert.textFields?.first, let newValue = textField.text else { return }
self?.ajouterNouvelleValeur(newValue)
}))
// Ajouter un bouton "Annuler"
alert.addAction(UIAlertAction(title: "Annuler", style: .cancel, handler: nil))
// Afficher l'alerte
present(alert, animated: true, completion: nil)
}
this to present an alert with textField to enter a new value to an array. Works properly on simulator, but when testing on my iPhone12 SE, it appears not to catch any value for the textField. Has anyone encountered the same issue, and knows the solution?
Hope my english is not too bad (as a French member, I appologize if not!)
Best regards
Sébastien
Post not yet marked as solved
Hi there,
I'm trying to figure out an issue I'm seeing where the xcresult bundle isn't including the crash report after building and running with xcodebuild.
I have a simple test app that has a single button that intentionally crashes and an XCUI test to run it. The UI Test also passes which can probably be explained by the lack of any asserts after clicking the button, but I assumed the app crashing would fail the test.
The app itself is a Mac OS app with a single button called "Crash" that links to a method:
- (IBAction)crash:(id)sender
{
@throw NSInternalInconsistencyException;
}
and a test method:
XCUIApplication *app = [[XCUIApplication alloc] init];
[app launch];
XCUIElement *crashButton = [[XCUIApplication alloc] init].windows[@"Window"].buttons[@"Crash"];
XCTAssert([crashButton exists]);
[crashButton click];
There is an ips file corresponding to the crash in ~/Library/Logs/DiagnosticReports so the crash gets written, but the test passes.
After using xcresulttool to dump the Diagnostics folder from the xcresult bundle, I see these lines in the session log:
10:59:20.790 xcodebuild[23184:6634391] Handling Crash: MacAppTest (23189) main. libsystem_c.dylib: abort() called
10:59:20.792 MacAppTestUITests-Runner[23188:6635181] Process crashed with pid:23189 path:/Users/USER/Library/Developer/Xcode/DerivedData/MacAppTest-dxrjhasbuvyffhenipmdemzdpdht/Build/Products/Debug/MacAppTest.app/Contents/MacOS/MacAppTest bundleID:com.company.MacAppTest summary:main
10:59:20.792 MacAppTestUITests-Runner[23188:6635181] Ignoring crash for com.company.MacAppTest:23189 because we are not currently tracking it
10:59:21.371 MacAppTestUITests-Runner[23188:6634605] Returning result XCTWaiterResultCompleted for waiter <XCTWaiter: 0x6000025fd4d0>
10:59:21.371 MacAppTestUITests-Runner[23188:6634605] Wait <XCTWaiterWait: 0x600003e1b540> completed after 1.003s
10:59:21.371 MacAppTestUITests-Runner[23188:6634605] cleaning up delay
The Ignoring crash for com.company.MacAppTest:23189 because we are not currently tracking it is what I suspect is the issue. How can I get the UITest to track the app so that when it crashes, the test fails?
Some other lines from the logarchive file that may be helpful:
2024-02-14 10:59:20.612346 -0800 osanalyticshelper xpc log creation type 309 result success: /Users/<REDACTED>/Library/Logs/DiagnosticReports/MacAppTest-2024-02-14-105920.ips
2024-02-14 10:59:20.613030 -0800 testmanagerd Calling new file handler <__NSMallocBlock__: 0x6000031761f0> for MacAppTest-2024-02-14-105920.ips
2024-02-14 10:59:20.614240 -0800 ReportCrash client log create type 309 result success: /Users/<REDACTED>/Library/Logs/DiagnosticReports/MacAppTest-2024-02-14-105920.ips
2024-02-14 10:59:20.615417 -0800 testmanagerd Read crash report from /Users/<REDACTED>/Library/Logs/DiagnosticReports/MacAppTest-2024-02-14-105920.ips, got 17327 bytes of data
Thanks!
Post not yet marked as solved
Our CI pipeline produces .xcresult bundles that allow developers to diagnose failures by opening them in Xcode. If the test crashes, we used to be able to open the diagnostic folders and inspect the raw test logs. As of Xcode 15, that option is no longer available. I know the Diagnostic data is there because I can view it with Xcode 14. Am I just missing something in the Xcode 15 UI? Or has the capability to browse the Diagnostics actually been removed?
Post not yet marked as solved
Hi Team,
I am creating an application which is based on tele communications testing where I need to retrieve the SIP logs from the device.
How can we achieve?
Any approach apple team suggest which will be highly appreciated.
Thank You,
Vijay
Post not yet marked as solved
Hi all, I create apps for Apple and I've been encountering the issue that I cannot upload 4 or 5 apps in a day because they are rejected. It only allows me to upload one a day. Has anyone else encountered this issue/limit? Any advice or ways to resolve this issue? I have multiple apps to complete and upload but this issue has been delaying the process. Thanks in advance.
Post not yet marked as solved
I have an app that I built using Expo and its' only external internet-based dependency is the Google Places API, which it uses when the app is loaded and when settings are tweaked. The app requests use of location services then proceeds to use it in an axios query to fetch some bars nearby. I am able to run it without issues on my iPhone and on Android emulators using Expo's local deployment options. Any idea what might be going on here on the testers' end?