In Maestro 17.10.x there is a new feature exposed in the Code View that I have been trying to understand the use case for, and I am not sure if I am missing something. When in code view, you now have the option to "Move Rules to JS File". 

While conceptually that makes sense, I do have a couple of questions:

  1. Once you have created the JS resource, how do you go back and modify it? I can add a Javascript Library to my form and reference it the new resource, but cannot figure out how to get access to the source to modify it. Where does the source get stored and how do I access it?
  2. Since the code gets packaged as functions automatically, is our recommended approach for using this feature:
    1. Create your code for the individual events
    2.  Once all code is complete, move it to JS file
  3. Is there any cautions (i.e. refactoring) to this approach or benefits (i.e. code is in a central location). I am just wondering if this is related to functions in TM or can be used with some other new feature coming, or in development regarding TM?

    CommentAdd your comment...

    1 answer


      Responding to Item 1

      1. After creating the JS via "continue with move", the JavaScript must needs to be loaded into the form by adding a "JavaScript Library" component.
        1. After adding the JavaScript Library component, open it's Properties
        2. set Source → Resource
        3. set Selected Resource → your library will appear
      2. To view/edit/download the file
        1. click the "Code" view in Maestro
        2. from the left panel, select the JavaScript Library component and expand
        3. select "{} Code"
        4. this opens a code editor, upload and download links are at top

      Since this is new, I'm not sure about best practices.  However, it is very similar to an approach we're advocating which is to develop validation and event handling code in a js library outside of Maestro and then import it.  This allows us to write unit tests for our javascript using frameworks like mocha/jasmine.  It also reduced the amount of code you need to work with in Maestro.

      1. Gary Thain

        Hi William,


        I somehow missed that view (Code View > JS file to see the code). Cheers

      CommentAdd your comment...