mobile-dev-inc / maestro

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

Unable to pass the values returned from a javascript file to the run flow #2040

Closed smehr123 closed 2 months ago

smehr123 commented 2 months ago

Is there an existing issue for this?

Steps to reproduce

Java script file: function generateEmailWithUniqueCode() { // Generate a random 6-digit code const sixDigitCode = Math.floor(100000 + Math.random() * 900000) const email = te.${sixDigitCode}@test.com return { code: ${sixDigitCode}, email: email } } // Retrieve both values from the function const result = generateEmailWithUniqueCode(); // Store the values in the output object const output = { code: result.code, email: result.email };

Maestro file: appId: com.example.dev

Actual results

The EMAIL parameter value is being set as org.mozilla.javascript.Undefined@1eb6a241

Expected results

The EMAIL parameter value should be set as something like - te.123456@test.com

About app

React Native app iOS Simulator - iPhone 15, iOS 17.5

About environment

Mac OS - Sonoma - 14.6.1

Logs

Logs ``` ```

Maestro version

1.37.9

How did you install Maestro?

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

Anything else?

No response

smehr123 commented 2 months ago

Please Note: I tried logging the email and code values to console and they are being printed fine

smehr123 commented 2 months ago

Issue got resolved in slack thread here https://mobile-dev-inc.slack.com/archives/C041FU72T54/p1725949349899639

bartekpacia commented 2 months ago

screenshot for posterity

Screenshot 2024-09-10 at 20 41 29

github-actions[bot] commented 2 months 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!