Flows
You can specify custom flows to force the agent to take specific paths through your application, much like a test script. You can tell the agent to use your flows by adding them to the run parameters or by adding them directly to the work queue. If you add flows to the run parameters, the agent will execute your flows first, then (optionally) continue exploratory testing.
Like rules, flows use generalized selectors rather than page-specific selectors (like CSS selectors). This makes flows less vulnerable to breakage when the application code changes.
Note that verifications (assertions) can be included in flows, but best practice is to do verification using rules instead.
Flows are specified using a simple "breadcrumb" format:
- flow title (parameter-list): step > step ...
Each step can perform a user interface (mouse/keyboard) action, browser action, flow call, built-in command, assertion, or variable assignment. During a flow, the agent will not put additional actionable components on the work queue. At the end of a flow, the agent will put all actionalble components of the last page of the flow on the work queue and continue testing unless the Stop run after executing flows flag is on.
Impact Levels
Flows can be configured with impact levels to help prioritize test results. The impact level indicates the severity of issues found when the flow fails:
- Critical: Issues that prevent core functionality from working
- Serious: Issues that significantly impact user experience
- Moderate: Issues that affect functionality but have workarounds
- Minor: Issues that are cosmetic or have minimal impact
Impact levels are logged with test results and can be used in CI/CD quality gates and notification systems. For detailed information about impact levels, see the Impact Levels documentation.
Flow Example
login(): // Main flow
$login_with_2FA("myuserid", "mypassword", "mykey") // Call flow to perform login
login with 2FA(userId, password, key): // Called flow
"Login" // Go to the login page
> "Email" = $userId > "Password" = $password > ~submit // Enter info and submit form
> "Email" = $data.users[0].userName // Alternative syntax to use data asset
> "Verification code" = $cmd.getAuthCode(key) // Enter verification code using key
> $cmd.wait(1000) // wait one second
> assert "Logout" is ~visible // Verify login completed
> $app.user.status = "authenticated" // Remember state for future referenceFlow Syntax
The new flow syntax (v2) is documented below. The current syntax (v1) is similar with the following differences:
- The action performed on a component is inferred and cannot be specified
- Custom actions are specified by keyword instead of $cmd
- Browser actions are not preceded by an explicit "browser" keyword
- Variables can only be only one-member deep (x.y)
- Local variables are not escaped with $
The table below highlights upcoming changes to the flow syntax.
| Item | Current (v1) | New (v2) |
|---|---|---|
| Locator | "(tag="a", id="someId")" | ("a #someId") |
| 2FA | "authKey" = key | "code" = $cmd.getAuthCode(key) |
| Wait | "wait" = 1000 | $cmd.wait(1000) |
| State variable | state.name = "value" | $app.name = "value" |
| Run variable | $runid | $run.id |
| Local variable | "input" = arg | "input" = $arg |
Flows v1 supports the following:
- Custom actions: close_tab, clear_cookies, skip_video, move_mouse, back, profile, authKey, get_temp_code, get_auth_key, gen_auth_code, visit, open_tab, wait, extract_text, generate_data
- Classes: button, empty, error_message, input, invalid, login, text, valid, visible
Built-in Commands
The following built-in commands are available via $cmd.commandName() syntax:
Data Generation
generate_data(useInvalidData?)- Uses AI to generate realistic test data for form elements on the current pageuseInvalidData(optional boolean): Whentrue, generates invalid data for testing validation scenarios- Returns: Object with key-value pairs mapping form field names to generated values
- Example:
formData = $cmd.generate_data()orinvalidData = $cmd.generate_data(true)
Authentication
get_auth_key()- Extracts a 2FA authentication key from the current pagegen_auth_code(authKey)- Generates a 2FA code from an authentication keyget_temp_code()- Extracts a temporary authentication code from the current page
Text Processing
extract_text(selector, regex)- Extracts text from a page element using a regex patternselector: CSS selector or element identifierregex: Regular expression pattern to extract specific text- Returns: Extracted text string
Utility
wait(ms)- Pauses execution for the specified number of milliseconds
Main Structures
| Rule Name | Description | Definition |
|---|---|---|
| Flow | The top-level structure of a flow declaration and a series of steps in breadcrumb notation. | Flow ::= title #"(" Params ")" ":" Steps |
| Params | A comma-separated list of parameters. | Params ::= ListOf<param, ","> |
| Steps | A sequence of steps in breadcrumb notation. | Steps ::= Steps ">" Step --multi | Step |
Flow Steps
| Rule Name | Description | Definition |
|---|---|---|
| Step | A single flow step. Any failure stops the flow. | Step ::= UiAction | BrowserAction | flowCall | commandCall | VariableAssignment | AppAssertion | ConditionalAction |
| UiAction | A user interface action within a flow. | UiAction ::= InputAction | MouseAction | VisitAction |
| InputAction | An input action in the user interface. | InputAction ::= (~Page ~TestItem Component) "=" (StringExp | NumericExp) |
| VisitAction | A visit action to navigate to a URL. | VisitAction ::= "visit" url |
| VariableAssignment | An application variable assignment. | VariableAssignment ::= appVariable "=" (StringExp | NumericExp | Component) |
| AppAssertion | A context assertion within a flow. | AppAssertion ::= "assert" Context |
| ConditionalAction | A conditional action in a flow. | ConditionalAction ::= "while" "(" Context ")" "do" Steps "end" |
🔍 For expressions, argument lists, and shared command/flow syntax, see the Language Reference.