2021-07-23 04:56:36 +02:00
# class: Suite
2022-07-06 02:24:50 +02:00
* since: v1.10
2021-07-23 04:56:36 +02:00
* langs: js
`Suite` is a group of tests. All tests in Playwright Test form the following hierarchy:
* Root suite has a child suite for each [TestProject].
* Project suite #1 . Has a child suite for each test file in the project.
* File suite #1
* [TestCase] #1
* [TestCase] #2
2022-07-06 22:54:11 +02:00
* Suite corresponding to a [`method: Test.describe#1`] group
2021-07-23 04:56:36 +02:00
* [TestCase] #1 in a group
* [TestCase] #2 in a group
* < more test cases ... >
* File suite #2
* < more file suites ... >
* Project suite #2
* < more project suites ... >
Reporter is given a root suite in the [`method: Reporter.onBegin`] method.
## method: Suite.allTests
2022-07-06 02:24:50 +02:00
* since: v1.10
2021-07-23 04:56:36 +02:00
- returns: < [Array]< [TestCase]>>
Returns the list of all test cases in this suite and its descendants, as opposite to [`property: Suite.tests`].
## property: Suite.location
2022-07-06 02:24:50 +02:00
* since: v1.10
2022-04-07 04:02:10 +02:00
- type: ?< [Location]>
2021-07-23 04:56:36 +02:00
2022-04-07 04:02:10 +02:00
Location in the source where the suite is defined. Missing for root and project suites.
2021-07-23 04:56:36 +02:00
2021-10-19 17:38:04 +02:00
## property: Suite.parent
2022-07-06 02:24:50 +02:00
* since: v1.10
2022-04-07 04:02:10 +02:00
- type: ?< [Suite]>
2021-10-19 17:38:04 +02:00
2022-04-07 04:02:10 +02:00
Parent suite, missing for the root suite.
2021-10-19 17:38:04 +02:00
2021-11-08 19:08:46 +01:00
## method: Suite.project
2022-07-06 02:24:50 +02:00
* since: v1.10
2022-04-07 04:02:10 +02:00
- returns: ?< [TestProject]>
2021-10-19 17:38:04 +02:00
Configuration of the project this suite belongs to, or [void] for the root suite.
2021-07-23 04:56:36 +02:00
## property: Suite.suites
2022-07-06 02:24:50 +02:00
* since: v1.10
2021-07-23 04:56:36 +02:00
- type: < [Array]< [Suite]>>
Child suites. See [Suite] for the hierarchy of suites.
## property: Suite.tests
2022-07-06 02:24:50 +02:00
* since: v1.10
2021-07-23 04:56:36 +02:00
- type: < [Array]< [TestCase]>>
2022-07-06 22:54:11 +02:00
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 [`method: Test.describe#1`] groups are listed
2021-07-23 04:56:36 +02:00
in the child [`property: Suite.suites`].
## property: Suite.title
2022-07-06 02:24:50 +02:00
* since: v1.10
2021-07-23 04:56:36 +02:00
- type: < [string]>
Suite title.
* Empty for root suite.
* Project name for project suite.
* File path for file suite.
2022-07-06 22:54:11 +02:00
* Title passed to [`method: Test.describe#1`] for a group suite.
2021-07-23 04:56:36 +02:00
## method: Suite.titlePath
2022-07-06 02:24:50 +02:00
* since: v1.10
2021-07-23 04:56:36 +02:00
- returns: < [Array]< [string]>>
Returns a list of titles from the root down to this suite.