Actions

Click

Click on an element.

targetDescription
string
required

Description of the element.

timeout
number

Timeout in milliseconds.

force
boolean
default:"false"

Sometimes, apps use non-trivial logic where hovering the element overlays it with another element that intercepts the click. This behavior is indistinguishable from a bug where element gets covered and the click is dispatched elsewhere. If you know this is taking place, you can bypass the actionability checks and force the click.

button
left | right | middle
default:"left"
modifiers
Alt | Control | ControlOrMeta | Meta | Shift
default:"none"

Type

Focuses the element and triggers an input event with the entered text. It works for <input>, <textarea> and [contenteditable] elements.

value
string
required

Text to type.

targetDescription
string
required

Description of the input element.

timeout
number

Timeout in milliseconds.

clickBeforeType
boolean
force
boolean

Skip actionability checks.

Select

Selects an option from a <select> element.

value
string
required

Value of the option to select.

targetDescription
string
required

Description of the select element.

timeout
number

Timeout in milliseconds.

force
boolean

Skip actionability checks.

Hover

Hover over an element.

targetDescription
string
required

Description of the element.

timeout
number

Timeout in milliseconds.

force
boolean

Skip actionability checks.

modifiers
Alt | Control | ControlOrMeta | Meta | Shift

Upload files

Click on an element and upload files.

targetDescription
string
required

Description of the element.

files
string[]
required

Array of file paths to upload.

timeout
number

Timeout in milliseconds.

force
boolean

Skip actionability checks.

button
left | right | middle
default:"left"
modifiers
Alt | Control | ControlOrMeta | Meta | Shift

Press key

Produces a single keystroke. It accepts the logical key names that are emitted in the keyboardEvent.key property of the keyboard events:

Backquote, Minus, Equal, Backslash, Backspace, Tab, Delete, Escape,
ArrowDown, End, Enter, Home, Insert, PageDown, PageUp, ArrowRight,
ArrowUp, F1 - F12, Digit0 - Digit9, KeyA - KeyZ, etc.
key
string
required

Key to press.

Wait

Sleep for X milliseconds.

Recommended approach is to rely on auto-waiting of steps. Using explicit waits can make tests flaky.

timeout
number
required

Timeout in milliseconds.

Wait to be visible

Wait for an element to be visible.

targetDescription
string
required

Description of the element.

timeout
number

Timeout in milliseconds.

JS

Execute JavaScript and Playwright code.

Scope: page, context, request, inputs, faker, expect, variables from previous steps, and custom fixtures.

Use return { item1, item2 } to pass variables to the scope of next steps.

code
string
required

Checks

Visual page validation

Compare screenshot of the page with the expected one.

fullPage
boolean
default:"false"

Whether to validate the full page or just the viewport.

useAI
boolean
default:"false"

Whether to use AI to ignore false positive failures.

instructions
string

Explain which parts of the page to ignore.

Visual component validation

Compare screenshot of the component with the expected one.

compareVisually
boolean
default:"false"

Whether to compare the component visually.

useAI
boolean
default:"false"

Whether to use AI to ignore false positive failures.

instructions
string

Explain which parts of the component to ignore.

Expect element

targetDescription
string
required

Description of the element.

timeout
number

Timeout in milliseconds.

Expect text

Pass if all text values are present.

values
{text: string, exactMatch: boolean}[]
required
text
string

Text that must be present.

exactMatch
boolean
default:"false"

Whether to find an exact match: case-sensitive and whole-string.

timeout
number

Timeout in milliseconds.

AI assert

Fail if any of the statements is not true.

instructions
string[]
required

Statements that must be true.

Go to

Navigate to a URL.

url
string
required
timeout
number

Open new tab

Open a new tab and navigate to a URL.

url
string
required
timeout
number

Refresh

Refresh the page.

timeout
number