Detect issues like logic failures, UI problems, and performance regressions by running tests on your app.

Posts under Testing tag

110 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

[xcode 15, ios 17]UseDestinationArtifacts key does not work when used in xctestrun file to execute the test with test-without-building
I am using xcode 15 beta and ios 17 beta 6 and experiencing a bug where the key UseDestinationArtifacts does not work when used in an xctestrun file to execute the test with the test-without-building flag. When I set the UseDestinationArtifacts key to true in my xctestrun file and run the tests with the test-without-building flag, Xcode throws the below error Testing failed: Application Bundle Not Found Runner encountered an error (Failed to install or launch the test runner. (Underlying Error: Application Bundle Not Found. Configure the path to a bundle to be installed on the device.)) **UseDestinationArtifacts works smoothly on ** xcode version<15 xcode 15 + ios 16 I have attached a reproduction of the bug. Steps to reproduce: Update below keys in xctestrun file remove DependentProductPaths, TestHostPath, UITargetAppPath Add UseDestinationArtifacts, TestBundleDestinationRelativePath, UITargetAppBundleIdentifier
4
4
1.1k
Aug ’23
Testflight error message: "Could not install app."
Testflight error message: "Could not install app. Your request couldn't be completed. Try again." I have tried installing TestFlight builds 7 times with different apps, but none have been installed. I have the latest TestFlight updates, so that is not an issue. I also referred to this link too to troubleshoot this: https://developer.apple.com/forums/thread/701330 I have not had any other issues with deploying the app. Can Apple fix this so we can install the TestFlight build?
0
0
1k
Aug ’23
How to test IAP in the Sandbox environment?
I've been reading through the documents and I feel like each particular doc jumps over the piece of info that I need. It explains how to create a Sandbox Test User and I've done that. I did plenty of IAP work many years ago, but things have changed enough that it's not working as I expect. When I read the docs, I feel like I can't find the missing piece. When I test in a simulator with Xcode, it does my IAP transactions in the Xcode environment. That makes sense. https://developer.apple.com/documentation/storekit/in-app_purchase/testing_in-app_purchases_with_sandbox This page says: To run your app using your Sandbox Apple ID, build and run your app from Xcode. But when I test on a physical device installing directly from Xcode, it also does my IAP transactions in the Xcode environment. I thought this would put me in the Sandbox environment, but it didn't. The initial purchase view controller didn't reference the Sandbox at all and the "You're All Set" alert shows Environment: Xcode. When I put a test build into TestFlight and test using that version, my IAP transactions are happening in production using my real Apple Id (but I'm not actually charged for any transactions). I assumed that testing in TestFlight would give me the Sandbox environment, but it happens in the Production environment. (The purchase view controller doesn't show Sandbox and the "You're All Set" alert doesn't show Sandbox.) So, how do I test in the Sandbox? Every way I try to test either puts me in the Xcode environment or the Production Environment. What am I missing? I've logged out of my real Apple id on my phone and then logged in with the Sandbox User credentials I created in AppStore Connect. But when I tried to test the app, by installing from Xcode it still says I'm in the Xcode test environment. When I create transactions, those transactions show up in the Xcode Transaction Manager. How do I test in the Sandbox environment?
6
4
2.5k
Aug ’23
Not able to find user generated alerts in XCTest on Ventura
This is for MacOS My app posts errors during its operation. Two years ago the following used to be able to test whether the alert was correct (or missing) func isRightAlert(alertImgStr: String, target: String) -> Bool{ let app = XCUIApplication() let ackdialog = app.dialogs["alert"] let imageexists = ackdialog.images[alertImgStr/*"CaptureEclipse alert"*/].exists //let full = app.debugDescription XCTAssert(imageexists) let acklist = ackdialog.children(matching: .staticText) //NSLog( String(acklist.count)) var found = false NSLog("Alert>>>>>>>>>>>") for index in 0...acklist.count - 1{ <see if is is one of the expected ones> } <other tests> } Now that I am on Ventura with XCode 14.3 it is no longer able to detect the alert. ackdialog returns as not found. imageexists is false which triggers the Assert The alert is on the screen when the timeouts I added trigger app.debugDescription justs lists all of my menu entries These are my own alerts (NSAlert) and not system alerts.
5
0
715
Aug ’23
Apple Silicon and UI tests
Several of our UI tests started failing when we switched over to M2 Macs... The issue with the affected tests seems to be that have a element.swipeLeft() in them, the swipeLeft doesn't seem to work the same... Is there a fix to the swipeLeft() issue yet? If not, is there an easy way to programmatically test if we are running on an Apple Silicon Mac? Any other ideas? Thank you!
2
0
691
Aug ’23
XCUIElement's Print Statement Not Including Nested Button
Example Image: Expected Behavior: When an XCUIElement is rendered from a screen with (Initial Conditions): An ImageView with.. isUserInteractionEnabled = YES… IsAccessibilityElement = YES… A nested button… isUserInteractionEnabled = YES… IsAccessibilityElement = YES… Assigned to the ImageViews accessibility elements array XCUIElement’s print statement includes the nested button Current Behavior: When an XCUIElement is rendered from a screen with: (above Initial Conditions) XCUIElement’s print statement only include the ImageView Attempted Fixes: Combinations of the Initial Conditions: Attempted all combinations of Initial Condition variable values. (ie: myImageView.accessibilityElements = [imageView, nestedButton] myImageView.accessibilityElements = [nestedButton] isUserInteractionEnabled = YES/NO [for both] IsAccessibilityElement = YES/NO [for both] etc…) Debug Print: Image View with No Descendants - Image, 0x7fa875d23e80, {{172.7, 292.7}, {45.0, 41.7}}, label: 'demo image' po element.images and po element.buttons - Find: Descendants matching type Image Output: { Image, 0x7fa876e14e70, {{-8.0, 99.0}, {136.7, 109.3}} Image, 0x7fa876e14f80, {{-8.0, 741.7}, {136.7, 102.3}} Image, 0x7fa876e13da0, {{269.7, 737.0}, {136.3, 123.0}} Image, 0x7fa876e1a060, {{172.7, 292.7}, {45.0, 41.7}}, label: 'demo image' } Output: { Button, 0x7fa875c12740, {{0.0, 47.0}, {68.0, 44.0}}, label: 'myApp UIKit' Button, 0x7fa875c24f00, {{338.0, 47.0}, {44.0, 44.0}}, identifier: 'Settings Button', label: 'Settings' Button, 0x7fa875c2c800, {{175.0, 533.0}, {40.0, 40.0}} Button, 0x7fa875c2cf30, {{183.0, 541.0}, {24.0, 24.0}} Button, 0x7fa875c2fa20, {{40.0, 659.3}, {153.0, 44.0}}, label: 'Left' Button, 0x7fa875c30cd0, {{197.0, 659.3}, {153.0, 44.0}}, label: 'Right' } Comparing the coordinates of the parent image view and the nested button, the button isn't here. The 24x24 button that appears comes from another view on the same screen, noting the ample y coordinate from the parent image view. Request: Request that Apple, in the spirit of XCUI framework being to be near to human experience include this common design case
1
1
596
Aug ’23
Can one read the GPU performance state from code? When set via Xcode device conditions?
I have QA doing testing with Xcode performance state, but to help catch human error, I'd like to abort the test if GPU Performance state condition is not actually active, or is wrong. Is there a way I can do that, from the iOS app itself? It seems like it doesn't not set any environment variable or anything to indicate it is active.
1
0
604
Jul ’23
Cannot use verified Sandbox Account
I have setup and verified a sandbox account for testing. I have received both email and text verification and received the email noting that the account has been enabled for two-factor. Yet I receive the error below on both iOS and macOS devices. Can someone shed some light on this matter? Thanks! Steve iTunes Account creation not allowed This Apple ID cannot be used with the iTunes Store at this time. Please try again later
0
0
551
Jul ’23
UI test: Unable to access view in table view
I have some view which contents I want to interact with in UI test. In the first case, when view is added to view controller everything is fine - I can access all its contents. However, when the same view is added to table view cell, some of its content become unaccessible. Here is view example class SomeView: UIView { required init?(coder: NSCoder) { fatalError() } override init(frame: CGRect) { super.init(frame: frame) let label = UILabel(frame: .init(x: 5, y: 5, width: 100, height: 20)) label.text = "Label" label.accessibilityIdentifier = "label" addSubview(label) let button = UIButton(frame: .init(x: 5, y: 35, width: 100, height: 20)) button.setTitle("Button", for: .normal) button.accessibilityIdentifier = "button" button.setTitleColor(.black, for: .normal) addSubview(button) let view = UIView(frame: .init(x: 5, y: 65, width: 100, height: 20)) view.backgroundColor = .red view.accessibilityIdentifier = "container" addSubview(view) let view2 = UIView(frame: .init(x: 0, y: 0, width: 100, height: 20)) view2.backgroundColor = .red view2.accessibilityIdentifier = "inner_view" view.addSubview(view2) let label2 = UILabel(frame: .init(x: 0, y: 0, width: 100, height: 20)) label2.text = "Label2" label2.accessibilityIdentifier = "inner_label" view2.addSubview(label2) accessibilityIdentifier = "some_view" } } And output from UI test Attributes: Application, 0x7fb4b9d0e680, pid: 71041, label: 'UITest' Element subtree: →Application, 0x7fb4b9d0e680, pid: 71041, label: 'UITest' Window (Main), 0x7fb4b9d0ae20, {{0.0, 0.0}, {390.0, 844.0}} Other, 0x7fb4b9b08bc0, {{0.0, 0.0}, {390.0, 844.0}} Other, 0x7fb4b9b0b040, {{0.0, 0.0}, {390.0, 844.0}} Other, 0x7fb4b9b0ac80, {{0.0, 0.0}, {390.0, 844.0}} Other, 0x7fb4b9b09960, {{0.0, 50.0}, {200.0, 100.0}}, identifier: 'some_view' StaticText, 0x7fb4b9b0ec80, {{5.0, 55.0}, {100.0, 20.0}}, identifier: 'label', label: 'Label' Button, 0x7fb4b9b10770, {{5.0, 85.0}, {100.0, 20.0}}, identifier: 'button', label: 'Button' StaticText, 0x7fb4b9b0bbf0, {{28.0, 84.0}, {54.0, 22.0}}, label: 'Button' Other, 0x7fb4b981b1d0, {{5.0, 115.0}, {100.0, 20.0}}, identifier: 'container' Other, 0x7fb4b981b2e0, {{5.0, 115.0}, {100.0, 20.0}}, identifier: 'inner_view' StaticText, 0x7fb4b981c0d0, {{5.0, 115.0}, {100.0, 20.0}}, identifier: 'inner_label', label: 'Label2' Table, 0x7fb4b981c1e0, {{16.0, 343.0}, {361.0, 244.0}} Cell, 0x7fb4b981c2f0, {{16.0, 343.0}, {361.0, 100.0}} StaticText, 0x7fb4b981c420, {{21.0, 348.0}, {100.0, 20.0}}, identifier: 'label', label: 'Label' StaticText, 0x7fb4b981c530, {{21.0, 408.0}, {100.0, 20.0}}, identifier: 'inner_label', label: 'Label2' Button, 0x7fb4b981c640, {{21.0, 378.0}, {100.0, 20.0}}, identifier: 'button', label: 'Button' StaticText, 0x7fb4b981c750, {{44.0, 377.0}, {54.0, 22.0}}, label: 'Button' Other, 0x7fb4b981c860, {{16.0, 343.0}, {361.0, 100.0}} Other, 0x7fb4b981c970, {{16.0, 343.0}, {361.0, 100.0}} Other, 0x7fb4b9b05400, {{36.0, 442.7}, {341.0, 0.3}} Path to element: →Application, 0x7fb4b9d0e680, pid: 71041, label: 'UITest' Query chain: →Find: Target Application 'com.temp.temp.UITest' Output: { Application, 0x7fb4b981ce80, pid: 71041, label: 'UITest' } As you can see, in table view I am missing some_view, container and inner_view views. Is there a way to access these elements in table view?
0
0
551
Jul ’23