Playwright step

The Playwright step allows you to run UI automation scripts using Playwright as part of your Loadmill flow.

This is especially useful when validating UI behavior alongside your API steps — for example, logging in through the UI, verifying elements on the page, or simulating full end-user workflows.

Playwright step editor

Usage

The Playwright step contains a single code editor where you write your Playwright script.

🧠 Only write the contents of a test() block — do not include the test declaration itself.

Correct:

Incorrect:

Parameters and context

In the Playwright step, all suite and flow parameters are available directly as variables — no need to use ${param} syntax like in other inputs.

Correct:

Incorrect:

Cookies

Session cookies are passed automatically into the Playwright browser context, so you can stay authenticated between API and UI steps.

To manually set cookies, you can use Playwright’s built-in context.addCookies method:

Attaching screenshots to the report

You can attach screenshots directly to your test report using Playwright’s testInfo.attach method.

✅ Example:

Changing timeout

You can change the default timeout for Playwright actions using the setDefaultTimeout method:

Changing view resolution

To set the browser viewport size, use the setViewportSize method:

Requirements

To use Playwright steps, a private agent with UI tests enabled is required.

You can enable UI testing using one of the following options:

  • Desktop App - UI testing is supported out of the box with no additional configuration required.

  • Docker - Set the following environment variable when running the container:

  • NPM Package - Run the agent with the --ui-tests flag:

    ⚠️ This option requires additional dependencies and lacks the isolation benefits of Docker or the Desktop app.

Last updated