maestro icon indicating copy to clipboard operation
maestro copied to clipboard

iOS Simulator: add ability to set permission for cross website tracking

Open elizabethfalkner-jpg opened this issue 4 weeks ago • 11 comments

Use case

Using the permissions parameter for the launchApp command, I'm able to set all available permissions via the framework. However, the cross-website tracking permission is not available to set. This is problematic because there's no way to accept or dismiss the alert by default (as Appium's frameworks do)

Proposal

It's likely that the framework would need to edit the xctest database to achieve this, as I've been unable to find a way to set the permission via simctl manually. Alternatively, addressing the autoAcceptAlerts requests in the repo would serve the same purpose.

Anything else?

No response

elizabethfalkner-jpg avatar Dec 18 '25 15:12 elizabethfalkner-jpg

MAE-355

linear[bot] avatar Dec 18 '25 15:12 linear[bot]

This is different from the usertracking permission?

Fishbowler avatar Dec 18 '25 15:12 Fishbowler

Image

Yes; this screenshot is taken from a simulator where I applied the all option for permissions.

elizabethfalkner-jpg avatar Dec 18 '25 15:12 elizabethfalkner-jpg

What version of iOS are you using? Where's this toggle, so that I can play along?

Fishbowler avatar Dec 18 '25 15:12 Fishbowler

iOS 18.6 / iOS 26 - this particular permission was introduced in iOS 14 I believe. That toggle is in Settings => App => <App Name>. There's a separate group for these two permissions on that UI toggle screen (no idea why), but this is the same screen where you'd see the state of the rest of the permissions for your app.

Cross site tracking is visible for our app because we declare it in our Entitlements, but it's not something I see in simctl help docs.

elizabethfalkner-jpg avatar Dec 18 '25 16:12 elizabethfalkner-jpg

It's my belief this is an upstream bug from your framework, see the output from xcrun simctl below. However, this does mean there's no real work-around for that particular alert.

xcrun simctl privacy --help 
Grant, revoke, or reset privacy and permissions
Usage: simctl privacy <device> <action> <service> [<bundle identifier>]

	action
	     The action to take:
	         grant - Grant access without prompting. Requires bundle identifier.
	         revoke - Revoke access, denying all use of the service. Requires bundle identifier.
	         reset - Reset access, prompting on next use. Bundle identifier optional.
	     Some permission changes will terminate the application if running.
	service
	     The service:
	         all - Apply the action to all services.
	         calendar - Allow access to calendar.
	         contacts-limited - Allow access to basic contact info.
	         contacts - Allow access to full contact details.
	         location - Allow access to location services when app is in use.
	         location-always - Allow access to location services at all times.
	         photos-add - Allow adding photos to the photo library.
	         photos - Allow full access to the photo library.
	         media-library - Allow access to the media library.
	         microphone - Allow access to audio input.
	         motion - Allow access to motion and fitness data.
	         reminders - Allow access to reminders.
	         siri - Allow use of the app with Siri.
	bundle identifier
	     The bundle identifier of the target application.

Examples:
	reset all permissions: privacy <device> reset all
	grant test host photo permissions: privacy <device> grant photos com.example.app.test-host

Warning:
Normally applications must have valid Info.plist usage description keys and follow the API guidelines to request access to services. Using this command to bypass those requirements can mask bugs.

elizabethfalkner-jpg avatar Dec 18 '25 16:12 elizabethfalkner-jpg

Maestro uses a combination of simctl and applesimutils to set permissions, to try to Catch Em All. But I don't know if this is covered by either yet 😬

Fishbowler avatar Dec 18 '25 16:12 Fishbowler

Such privacy focus that you can't set the privacy setting. The most Apple of Apple things to do haha

elizabethfalkner-jpg avatar Dec 18 '25 16:12 elizabethfalkner-jpg

I'm looking at how hard it'd be to extend applesimutils to support this, but require a test app.

I thought that adding this to the test app would be enough to get the toggle to show, but on an iOS 26.2, I still only see "Allow Tracking". Any tips?

Fishbowler avatar Dec 18 '25 16:12 Fishbowler

This has sent me down a bizarre rabbit hole with creating settings bundles in iOS. I've yet to determine if this is the direction my team took (as I'm more of a test automation expert rather than an iOS engineer) - https://stackoverflow.com/questions/64897054/using-nscrosswebsitetrackingusagedescription-to-request-user-disable-itp-for-wkw

elizabethfalkner-jpg avatar Dec 18 '25 17:12 elizabethfalkner-jpg

That's what I saw, and hoped would work. Not only did it have no effect, Xcode doesn't even recognise it 🤔

Image

I wonder if the iOS version is relevant, since when I toggle "Allow Tracking" it sounds a lot like Cross-Website Tracking:

Image

Fishbowler avatar Dec 19 '25 14:12 Fishbowler