Open jamie-phlo opened 1 year ago
This is not supported yet, but something that would be feasible to add in the future. We would need to move from Rhino to GraalJS engine
i need to make mongodb calls to get the proper data in order to onboard user in the tests. do you have any timeline on when it would be possible to use more complex scripts with dependencies?
Duplicate of #576
Hello @axelniklasson , I'm not sure this is really a duplicate of #576
I can not comment for @jamie-phlo, but in our case we want to be able to import faker lib to generate random informations for our e2e tests.
In particular, I think that the use case described in this issue doesn't pose the same security concerns as https://github.com/mobile-dev-inc/maestro/issues/576#issuecomment-1400777286 and would therefore, I imagine, be less of a challenge to implement, while also unlocking a great deal of potential for script execution in maestro.
Got it, thanks for the nudge @gkueny -- reopening this one.
For some more context: allowing importing libs from npm is not something we're planning to tackle soon, so for the immediate time being I recommend including whatever dependencies you have in your script file and use it that way instead.
Is there any update on this? I have a generic setupTests
function in a helpers file that I can pass in object type parameters to to setup my test entities correctly. I need to import this setup function into each individual setup script with custom options but I cannot do that
Alternatively I could pass those options in as an object however currently maestro doesnt allow passing environment variables that are not strings :/
Any help on this would be deeply appreciated! 🙏
It's such a pity. I believe that Maestro is a framework with great potential. At this stage, many test engineers probably already have automated test scripts running, but this limitation greatly affects people's desire to switch jobs. I think if this issue could be resolved soon, it would make the framework much more appealing.
I got around this issue by pre-generating/building a .js file separately that is then executed by maestro. My use case was generating formatted times/dates with moment.js, so pre-generating this data into a .js file got around the issue.
The other option is to setup a small node http server that you can communicate with via GETs that can serve data back to maestro.
When executing JavaScript via runScript I get errors when trying to import or require
import error:
org.mozilla.javascript.EvaluatorException: missing ; before statement
require error:
ReferenceError: ReferenceError: "require" is not defined.
Is it possible to import from other JS libraries when using runScript?
If it's not currently possible is it something that could be added? It seems that whatever JS engine is used doesn't allow this.