maestro icon indicating copy to clipboard operation
maestro copied to clipboard

iOS miss `-` Launch Arguments when value type is Bool

Open littlema0404 opened this issue 1 year ago • 6 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and didn't find mine.

Steps to reproduce

appId: xxx
- launchApp:
    clearState: true
    permissions:
      userTracking: deny
    arguments:
        argumentA: true
        argumentB: 1
        argumentC: "abc"

Actual results

CommandLine.arguments // ["argumentA", "true", "-argumentB", "1", "-argumentC", "abc"]

Expected results

CommandLine.arguments // ["-argumentA", "true", "-argumentB", "1", "-argumentC", "abc"]

About app

Closed source iOS native app

About environment

Java version

openjdk version "17.0.10" 2024-01-16 LTS
OpenJDK Runtime Environment Corretto-17.0.10.7.1 (build 17.0.10+7-LTS)
OpenJDK 64-Bit Server VM Corretto-17.0.10.7.1 (build 17.0.10+7-LTS, mixed mode, sharing)

OS and its version

macOS 14.6.1(23G93)

Processor architecture

M2 arm64

Logs

Logs
<!-- Replace this line with your logs. *DO NOT* remove the backticks! -->

Maestro version

1.38.1

How did you install Maestro?

install script (https://get.maestro.mobile.dev)

Anything else?

- This is the specification for iOS launch arguments. Currently, only when the YAML value type is Bool, the - sign is not added. However, if the value type is Int or String, the - sign is automatically added.

When I use UserDefaults to retrieve argumentA, I won’t be able to find it.

let standardDefaultsDict = UserDefaults.standard.dictionaryRepresentation()
standardDefaultsDict["argumentA"] as? Bool // will get nil
standardDefaultsDict["argumentB"] as? Int // will get 1

I think the issue might be here.

https://github.com/mobile-dev-inc/maestro/blob/main/maestro-ios-driver/src/main/kotlin/util/IOSLaunchArguments.kt#L10-L18

It seems intentional, but I don’t understand why only boolean values are not prefixed with -.

littlema0404 avatar Oct 24 '24 09:10 littlema0404