Skip to content

Suite ​

Added in: v1.10

Suite is a group of tests. All tests in Playwright Test form the following hierarchy:

  • Root suite has a child suite for each FullProject.
    • Project suite #1. Has a child suite for each test file in the project.
    • Project suite #2
    • < more project suites ... >

Reporter is given a root suite in the reporter.onBegin() method.

Methods ​

suite.allTests() ​

Added in: v1.10

Returns the list of all test cases in this suite and its descendants, as opposite to suite.tests.

Returns

  • Array<TestCase>

suite.entries() ​

Added in: v1.44

Test cases and suites defined directly in this suite. The elements are returned in their declaration order. You can differentiate between various entry types by using testCase.type and suite.type.

Returns

  • Array<TestCase | Suite>

suite.project() ​

Added in: v1.10

Configuration of the project this suite belongs to, or [void] for the root suite.

Returns

  • FullProject | undefined

suite.titlePath() ​

Added in: v1.10

Returns a list of titles from the root down to this suite.

Returns

  • Array<string>

Properties ​

suite.location ​

Added in: v1.10

Location in the source where the suite is defined. Missing for root and project suites.

Type

  • Location

suite.parent ​

Added in: v1.10

Parent suite, missing for the root suite.

Type

  • Suite

suite.suites ​

Added in: v1.10

Child suites. See Suite for the hierarchy of suites.

Type

  • Array<Suite>

suite.tests ​

Added in: v1.10

Test cases in the suite. Note that only test cases defined directly in this suite are in the list. Any test cases defined in nested test.describe() groups are listed in the child suite.suites.

Type

  • Array<TestCase>

suite.title ​

Added in: v1.10

Suite title.

  • Empty for root suite.
  • Project name for project suite.
  • File path for file suite.
  • Title passed to test.describe() for a group suite.

Type

  • string

suite.type ​

Added in: v1.44

Returns the type of the suite. The Suites form the following hierarchy: root -> project -> file -> describe -> ...describe -> test.

Type

  • "root" | "project" | "file" | "describe"

Released under the Apache 2.0 License.