Suite
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.
- File suite #1
- TestCase #1
- TestCase #2
- Suite corresponding to a test.describe() group
- < more test cases ... >
- File suite #2
- < more file suites ... >
- File suite #1
- Project suite #2
- < more project suites ... >
- Project suite #1. Has a child suite for each test file in the project.
Reporter is given a root suite in the reporter.onBegin() method.
方法
allTests
Added in: v1.10Returns the list of all test cases in this suite and its descendants, as opposite to suite.tests.
使用方式
suite.allTests();
傳回值
entries
Added in: v1.44Test 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.
使用方式
suite.entries();
傳回值
project
Added in: v1.10Configuration of the project this suite belongs to, or void for the root suite.
使用方式
suite.project();
傳回值
- FullProject | [undefined]#
titlePath
Added in: v1.10Returns a list of titles from the root down to this suite.
使用方式
suite.titlePath();
傳回值
屬性 (Properties)
location
Added in: v1.10Location in the source where the suite is defined. Missing for root and project suites.
使用方式
suite.location
型別 (Type)
parent
Added in: v1.10Parent suite, missing for the root suite.
使用方式
suite.parent
型別 (Type)
suites
Added in: v1.10Child suites. See Suite for the hierarchy of suites.
使用方式
suite.suites
型別 (Type)
tests
Added in: v1.10Test 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.
使用方式
suite.tests
型別 (Type)
title
Added in: v1.10Suite title.
- Empty for root suite.
- Project name for project suite.
- File path for file suite.
- Title passed to test.describe() for a group suite.
使用方式
suite.title
型別 (Type)
type
Added in: v1.44Returns the type of the suite. The Suites form the following hierarchy: root
-> project
-> file
-> describe
-> ...describe
-> test
.
使用方式
suite.type
型別 (Type)
- "root" | "project" | "file" | "describe"