TypeScript and Playwright Editor

Use the TypeScript editor when you want direct Playwright control with Leapwork Play step tracking on top.

What to use

Need

Use

One executable business action

await leapwork.step(...)

Shared timeout or self-heal behavior

leapwork.configuration(...)

Input and output values between steps

leapwork.variables.get(...) and leapwork.variables.set(...)

DOM-based validation

Playwright expect(...)

Visual validation

assertScreenshot(...)

D365 F&O shortcuts

leapwork.d365.fno.* helpers

How to add testdata variables as a separate TS asset and use in multiple TCs

  1. Create a new typescript asset.

  2. Add your functions variables there and export them.

Plain Text

export const testVar = "testVal";

export function doSomething() {
  console.log("Do something");
}
  1. Now create a new test case.

  2. Drag and drop this in references section if you just want to import variables and functions else if you want to execute it something then drop it in steps sections.

  3. Go to playwright section and import and use your functions and variables like you do in playwright.

  4. An import statement will be created automatically as soon as typescript asset is dropped.

Plain Text

import { StepTest, testVar, doSomething } from "@assets/Add to basket and basket build-up/Step test";

console.log(testVar);
doSomething();

Reference pages