ASTA Docs
User Docs
Advanced Topics
Flows

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 reference

Flow 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.

ItemCurrent (v1)New (v2)
Locator"(tag="a", id="someId")"("a #someId")
2FA"authKey" = key"code" = $cmd.getAuthCode(key)
Wait"wait" = 1000$cmd.wait(1000)
State variablestate.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 page
    • useInvalidData (optional boolean): When true, 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() or invalidData = $cmd.generate_data(true)

Authentication

  • get_auth_key() - Extracts a 2FA authentication key from the current page
  • gen_auth_code(authKey) - Generates a 2FA code from an authentication key
  • get_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 pattern
    • selector: CSS selector or element identifier
    • regex: 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 NameDescriptionDefinition
FlowThe top-level structure of a flow declaration and a series of steps in breadcrumb notation.Flow ::= title #"(" Params ")" ":" Steps
ParamsA comma-separated list of parameters.Params ::= ListOf<param, ",">
StepsA sequence of steps in breadcrumb notation.Steps ::= Steps ">" Step --multi | Step

Flow Steps

Rule NameDescriptionDefinition
StepA single flow step. Any failure stops the flow.Step ::= UiAction | BrowserAction | flowCall | commandCall | VariableAssignment | AppAssertion | ConditionalAction
UiActionA user interface action within a flow.UiAction ::= InputAction | MouseAction | VisitAction
InputActionAn input action in the user interface.InputAction ::= (~Page ~TestItem Component) "=" (StringExp | NumericExp)
VisitActionA visit action to navigate to a URL.VisitAction ::= "visit" url
VariableAssignmentAn application variable assignment.VariableAssignment ::= appVariable "=" (StringExp | NumericExp | Component)
AppAssertionA context assertion within a flow.AppAssertion ::= "assert" Context
ConditionalActionA conditional action in a flow.ConditionalAction ::= "while" "(" Context ")" "do" Steps "end"

🔍 For expressions, argument lists, and shared command/flow syntax, see the Language Reference.