mobile-dev-inc / maestro

Painless Mobile UI Automation
https://maestro.mobile.dev/
Apache License 2.0
5.86k stars 279 forks source link

Run JavaScript - passing a parameter does not work as described in docs #2139

Closed NikolaSimsic closed 16 minutes ago

NikolaSimsic commented 22 hours ago

Is there an existing issue for this?

Steps to reproduce

I am trying to pass the parameters to the javascript file exactly as it is described here.

This is the code:

- runScript:
    file: checkText.js
    env:
        elementId: logBox
        expectedText: random

And checkText.js:

const elId = elementId;
const expectedTxt = expectedText;
console.log("out log", elId, expectedTxt);

Actual results

After the execution, result is without values being read:

║ Log messages:
║ out log

Expected results

It should be possible to pass the env values as a parameters to the js file.

About app

It is a native app, execution on Android device. But this does not matter for the case.

About environment

M1 MacBook Air arm64 macOS Sequoia 15.1. openjdk 17.0.9 2023-10-17 OpenJDK Runtime Environment Homebrew (build 17.0.9+0)

Logs

Logs ``` ```

Maestro version

1.39.1

How did you install Maestro?

Homebrew

Anything else?

No response

linear[bot] commented 22 hours ago

MA-2548 Run JavaScript - passing a parameter does not work as described in docs

Fishbowler commented 22 hours ago

Logging only supports a single parameter right now

https://maestro.mobile.dev/advanced/javascript/logging

Fishbowler commented 16 minutes ago

Gonna close this for now. Please feel free to reopen if that doesn't solve your problem.