Skip to content

TEST.run()

Runs another test file at the specified path.

TEST.run() allows you to reuse and compose test scripts, such as shared login flows or setup steps, by executing another test file from within the current test.

The test file path can be:

  • relative to the current test file, or
  • absolute from the project root

WARNING

All test files executed via TEST.run() share the same JavaScript context and scope.

This means that:

  • variables declared in one test file are accessible in subsequently run test files
  • changes to variable values propagate to subsequent test files

Because of this, re-declaring the same variable name using let or const across test files may result in runtime errors.

If you want to ensure isolation between test files, wrap your test code in a self-calling function, like this:

js
(function(){
   var data = TEST.loadDataFromJson("data/admin-user.json")
   I.fill("Username", data.username)
   I.fill("Password", data.password)
   I.click("Log In")
})()

Usage

js
TEST.run(path: string)

Parameters

ParameterTypeDescription
path stringPath to the test file to run. Can be relative to the current test file or from the project root.

Example

js
TEST.run("login/login_as_buyer")
I.see("Wishlist")

This runs the test login/login_as_buyer, and then continues execution in the current test with I.see("Wishlist").