playwright/docs/src/test-reporter-api/class-teststep.md

74 lines
1.8 KiB
Markdown
Raw Normal View History

# class: TestStep
2022-07-06 02:24:50 +02:00
* since: v1.10
* langs: js
Represents a step in the [TestRun].
## property: TestStep.category
2022-07-06 02:24:50 +02:00
* since: v1.10
- type: <[string]>
Step category to differentiate steps with different origin and verbosity. Built-in categories are:
* `hook` for fixtures and hooks initialization and teardown
* `expect` for expect calls
* `pw:api` for Playwright API calls.
* `test.step` for test.step API calls.
## property: TestStep.duration
2022-07-06 02:24:50 +02:00
* since: v1.10
- type: <[float]>
Running time in milliseconds.
## property: TestStep.location
2022-07-06 02:24:50 +02:00
* since: v1.10
- type: ?<[Location]>
Optional location in the source where the step is defined.
## property: TestStep.error
2022-07-06 02:24:50 +02:00
* since: v1.10
- type: ?<[TestError]>
Error thrown during the step execution, if any.
## property: TestStep.parent
2022-07-06 02:24:50 +02:00
* since: v1.10
- type: ?<[TestStep]>
Parent step, if any.
## property: TestStep.startTime
2022-07-06 02:24:50 +02:00
* since: v1.10
- type: <[Date]>
Start time of this particular test step.
## property: TestStep.steps
2022-07-06 02:24:50 +02:00
* since: v1.10
- type: <[Array]<[TestStep]>>
List of steps inside this step.
## property: TestStep.attachments
* since: v1.50
- type: <[Array]<[Object]>>
- `name` <[string]> Attachment name.
- `contentType` <[string]> Content type of this attachment to properly present in the report, for example `'application/json'` or `'image/png'`.
- `path` ?<[string]> Optional path on the filesystem to the attached file.
- `body` ?<[Buffer]> Optional attachment body used instead of a file.
The list of files or buffers attached in the step execution through [`method: TestInfo.attach`].
## property: TestStep.title
2022-07-06 02:24:50 +02:00
* since: v1.10
- type: <[string]>
User-friendly test step title.
## method: TestStep.titlePath
2022-07-06 02:24:50 +02:00
* since: v1.10
- returns: <[Array]<[string]>>
Returns a list of step titles from the root step down to this step.