Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 task done
NikolaSimsic opened this issue Nov 13, 2024 · 7 comments
Closed
1 task done

Comments

@NikolaSimsic
Copy link

Is there an existing issue for this?

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

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
<!-- Replace this line with your logs. *DO NOT* remove the backticks! -->

Maestro version

1.39.1

How did you install Maestro?

Homebrew

Anything else?

No response

Copy link

linear bot commented Nov 13, 2024

@Fishbowler
Copy link
Contributor

Logging only supports a single parameter right now

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

@Fishbowler
Copy link
Contributor

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

@NikolaSimsic
Copy link
Author

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

Copy link

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!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 22, 2024
@Fishbowler
Copy link
Contributor

Howdy @NikolaSimsic.

I gave it a day before closing AND included a suggestion to reopen the issue if it didn't solve your problem.

Your example doesn't follow the docs I linked.

Needs to be:

console.log("out log: " + elId);

@mobile-dev-inc mobile-dev-inc unlocked this conversation Nov 22, 2024
Copy link

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!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 29, 2024
@mobile-dev-inc mobile-dev-inc deleted a comment from NikolaSimsic Jan 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants