maestro icon indicating copy to clipboard operation
maestro copied to clipboard

Throwing Error in JavaScript file causes unhandled exception in Log with Jackson parser

Open mikamikaWolt opened this issue 1 year ago • 4 comments

Is there an existing issue for this?

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

Steps to reproduce

  1. Create JS file that will perform some action.
  2. Add throw new Error("message") command.
  3. Error might be the single action in the JavaScript file to simplify reproducing
  4. Call this JS file from a test

On failure, the maestro log with have Jackson parser exception.

So, there is no error message from the Error that will help to understand why the test failed, just a useless unhandled exception.

Actual results

Unhandled exception in Jackson parser

Expected results

The message from error is displayed in the log file

About app

Any natove mobile app. Failure may happen before starting the app, if my script is creating test data before the test.

About environment

macOS 14.6.1 java 17.0.11 2024-04-16 LTS

Logs

Logs
[ERROR] maestro.cli.report.TestDebugReporter - Unable to parse commands
com.fasterxml.jackson.databind.JsonMappingException: org.mozilla.javascript.NativeObject cannot be cast to org.mozilla.javascript.NativeError (through reference chain: java.util.ArrayList[2]->maestro.cli.report.CommandDebugWrapper["metadata"]->maestro.cli.report.CommandDebugMetadata["error"]->org.mozilla.javascript.JavaScriptException["value"]->org.mozilla.javascript.NativeError["prototype"]->org.mozilla.javascript.NativeError["stackDelegated"])

Maestro version

14.6.1

How did you install Maestro?

Homebrew

Anything else?

No response

mikamikaWolt avatar Sep 02 '24 06:09 mikamikaWolt

Hey @mikamikaWolt, thanks for reporting this.

Just to make sure: Would you expect a throw new Error("message") in JavaScript to fail the currently executing flow?

bartekpacia avatar Sep 02 '24 09:09 bartekpacia

Came looking for this error.

Ideally a few things would happen:

  • Log to the console
  • Fail the test and stop processing commands
  • Reduce the amount of noise in the logs (I've attached an example)

maestro.log

Fishbowler avatar Sep 15 '24 14:09 Fishbowler

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it.

Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. When creating a new issue, please make sure to diligently fill out the issue template.

Thank you for your contribution to our open-source community!

github-actions[bot] avatar Sep 16 '24 18:09 github-actions[bot]

@bartekpacia Reopen please

Fishbowler avatar Sep 16 '24 18:09 Fishbowler