TestCase corresponds to every test() call in a test file. When a single test() is running in multiple projects or repeated multiple times, it will have multiple TestCase objects in corresponding projects' suites.
Whether the test is considered running fine. Non-ok tests fail the test run with non-zero exit code.
Usage
testCase.ok();
Returns
Testing outcome for this test. Note that outcome is not the same as testResult.status:
'expected'.'flaky'.Usage
testCase.outcome();
Returns
Returns a list of titles from the root down to this test.
Usage
testCase.titlePath();
Returns
testResult.annotations of the last test run.
Usage
testCase.annotations
Type
Expected test status.
'skipped'.'failed'.'passed'.See also testResult.status for the actual status.
Usage
testCase.expectedStatus
Type
A test ID that is computed based on the test file name, test title and project name. The ID is unique within Playwright session.
Usage
testCase.id
Type
Location in the source where the test is defined.
Usage
testCase.location
Type
Suite this test case belongs to.
Usage
testCase.parent
Type
Contains the repeat index when running in "repeat each" mode. This mode is enabled by passing --repeat-each to the command line.
Usage
testCase.repeatEachIndex
Type
Results for each run of this test.
Usage
testCase.results
Type
The maximum number of retries given to this test in the configuration.
Learn more about test retries.
Usage
testCase.retries
Type
The list of tags defined on the test or suite via test() or test.describe(), as well as @-tokens extracted from test and suite titles.
Learn more about test tags.
Usage
testCase.tags
Type
The timeout given to the test. Affected by testConfig.timeout, testProject.timeout, test.setTimeout(), test.slow() and testInfo.setTimeout().
Usage
testCase.timeout
Type
Test title as passed to the test() call.
Usage
testCase.title
Type
Returns "test". Useful for detecting test cases in suite.entries().
Usage
testCase.type
Type
© 2025 Microsoft
Licensed under the Apache License, Version 2.0.
https://playwright.dev/docs/api/class-testcase