Coding Mode (evaluating as a JS-expression)
Include calculations and JavaScript features in your scenarios π§
Last updated
Was this helpful?
Include calculations and JavaScript features in your scenarios π§
Last updated
Was this helpful?
You have the option to enable or disable JavaScript evaluation in scenario steps (ECMAScript 5.1):
Please note that if you enable this option and make a syntax mistake, the scenario will pause with an exception message.
You can verify the result of your expression by clicking the "Check the expression" link. You'll need to provide an object ID for validation.
Don't mix "Check the expression" feature with step testing.
Expression
π ΎοΈ JS-interpreter is off
β JS-interpreter is on
{{a}} +1
// {{a}} = 3
3 + 1
4
Math.random()
Math.random()
0.4353
// some random value 0.0β1.0
Today +1 day
Today +1 day
2020-05-04T00:00:00.000Z
// today at 00:00
'{{a}}'.length
// {{a}} == hello world
'hello world'.length
12
'{{a}}'.length
// {{a}} == 1,-12,hello
(array type)
'1,12,hello'.length
11
// Note! It evaluates as a string.
Don't forget to enclose '{{fields}}'
in quotes if you want them to be processed as strings.
MDN JavaScript Guide - Get a high-level overview of fundamental JavaScript concepts.
Codecademy Introduction to JavaScript - Learn JavaScript in this free online course with interactive lessons.
and expressions
Learn how to