added

Parameterized JavaScript Steps

The mabl desktop app 1.4.2 release brings major improvements to JavaScript steps! Now you can define parameters in one-time or reusable JavaScript snippets. This enables easy reuse of custom JavaScript logic by passing in different parameter values. For example, you can have a "right click" snippet that accepts a CSS selector as shown below. Notice that the selector parameter becomes a function argument that you can directly reference in your code. Parameters can have optional default values.

22242224

To use a parameterized snippet in a step, simply pick the snippet and supply the parameter values. If a parameter has a default value, you can choose to use the default or override it. You can also use variables in parameter values (e.g., {{@menuSelector}}). In fact, we recommend passing variables into the script as parameters this way instead of using mablInput.variables.user.menuSelector because it makes the snippet easier to understand and maintain.

600600

🚧

mabl Desktop App before version 1.4.2

If you are running an earlier version of the mabl Desktop App, you will not be able to edit existing tests that contain parameterized JavaScript steps in your workspace. The mabl web app will disable test edit options for such tests if the version requirement is not met.

🚧

Chrome extension support

Parameterized JavaScript steps are not supported in the Chrome extension Trainer, which is being deprecated at the end of 2021. Users using the extension Trainer cannot create parameterized snippets, nor edit or open any test that includes a parameterized JavaScript step.

Please visit the help page for more information.