HideAllTips launch argument does not work in xctestplan

The launch argument -com.apple.TipKit.HideAllTips 1 does not work if it is defined in xctestplan arguments passed on launch. I tested it with the apple provided example app, where I created simple UI test and added xctestplan with launch argument -com.apple.TipKit.HideAllTips 1.

The app does not hide the tips when it is running the UI Tests.

Is there any solution that works? Thanks for reply.

Answered by DTS Engineer in 856751022

Arguments in the test plan are passed to the test runner, which is the process where the test code executes. For a UI test, this is a different process than the app itself, which you launch using XCUIApplication.

To pass arguments or environment variables to apps launched in a UI test, use the corresponding APIs on XCUIApplication (.arguments and .environment) before you call .launch()

Accepted Answer

Arguments in the test plan are passed to the test runner, which is the process where the test code executes. For a UI test, this is a different process than the app itself, which you launch using XCUIApplication.

To pass arguments or environment variables to apps launched in a UI test, use the corresponding APIs on XCUIApplication (.arguments and .environment) before you call .launch()

Thanks for clarification. This code works:

let app = XCUIApplication()
        app.launchArguments = ["-com.apple.TipKit.HideAllTips", "1"]

I made a mistake to write it as one string("-com.apple.TipKit.HideAllTips 1") and Xcode did not split it to key and value...

HideAllTips launch argument does not work in xctestplan
 
 
Q