mobile-dev-inc / maestro

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

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

Closed NikolaSimsic closed 1 week ago

NikolaSimsic commented 1 week 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 1 week ago

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

Fishbowler commented 1 week ago

Logging only supports a single parameter right now

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

Fishbowler commented 1 week ago

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

NikolaSimsic commented 1 week ago

It does not solve the problem, now I tried with

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

checkText.js:

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

and result was: ║ Log messages:
║ out log

NikolaSimsic commented 1 week ago

what a weird way to fuck off users by just closing the issue :)

github-actions[bot] commented 1 minute ago

This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue. Thank you for helping keep us our issue tracker clean!