Skip to content

Commit dbab087

Browse files
feat(roll): roll to ToT Playwright (18-12-24) (#1627)
1 parent 7112fce commit dbab087

1 file changed

Lines changed: 93 additions & 0 deletions

File tree

nodejs/docs/api/class-test.mdx

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,6 +1511,99 @@ test('example', async ({ page }) => {
15111511

15121512
---
15131513

1514+
### test.step.fail {#test-step-fail}
1515+
1516+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.50</font><x-search>test.test.step.fail</x-search>
1517+
1518+
Marks a test step as "should fail". Playwright runs this test step and ensures that it actually fails. This is useful for documentation purposes to acknowledge that some functionality is broken until it is fixed.
1519+
1520+
:::note
1521+
1522+
If the step exceeds the timeout, a [TimeoutError] is thrown. This indicates the step did not fail as expected.
1523+
:::
1524+
1525+
**Usage**
1526+
1527+
You can declare a test step as failing, so that Playwright ensures it actually fails.
1528+
1529+
```js
1530+
import { test, expect } from '@playwright/test';
1531+
1532+
test('my test', async ({ page }) => {
1533+
// ...
1534+
await test.step.fail('currently failing', async () => {
1535+
// ...
1536+
});
1537+
});
1538+
```
1539+
1540+
**Arguments**
1541+
- `title` [string]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="test-step-fail-option-title"/><a href="#test-step-fail-option-title" class="list-anchor">#</a>
1542+
1543+
Step name.
1544+
- `body` [function]\(\):[Promise]&lt;[Object]&gt;<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="test-step-fail-option-body"/><a href="#test-step-fail-option-body" class="list-anchor">#</a>
1545+
1546+
Step body.
1547+
- `options` [Object] *(optional)*
1548+
- `box` [boolean] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="test-step-fail-option-box"/><a href="#test-step-fail-option-box" class="list-anchor">#</a>
1549+
1550+
Whether to box the step in the report. Defaults to `false`. When the step is boxed, errors thrown from the step internals point to the step call site. See below for more details.
1551+
- `location` [Location] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="test-step-fail-option-location"/><a href="#test-step-fail-option-location" class="list-anchor">#</a>
1552+
1553+
Specifies a custom location for the step to be shown in test reports and trace viewer. By default, location of the [test.step()](/api/class-test.mdx#test-step) call is shown.
1554+
- `timeout` [number] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="test-step-fail-option-timeout"/><a href="#test-step-fail-option-timeout" class="list-anchor">#</a>
1555+
1556+
Maximum time in milliseconds for the step to finish. Defaults to `0` (no timeout).
1557+
1558+
**Returns**
1559+
- [Promise]&lt;[void]&gt;<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="test-step-fail-return"/><a href="#test-step-fail-return" class="list-anchor">#</a>
1560+
1561+
---
1562+
1563+
### test.step.fixme {#test-step-fixme}
1564+
1565+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.50</font><x-search>test.test.step.fixme</x-search>
1566+
1567+
Mark a test step as "fixme", with the intention to fix it. Playwright will not run the step.
1568+
1569+
**Usage**
1570+
1571+
You can declare a test step as failing, so that Playwright ensures it actually fails.
1572+
1573+
```js
1574+
import { test, expect } from '@playwright/test';
1575+
1576+
test('my test', async ({ page }) => {
1577+
// ...
1578+
await test.step.fixme('not yet ready', async () => {
1579+
// ...
1580+
});
1581+
});
1582+
```
1583+
1584+
**Arguments**
1585+
- `title` [string]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="test-step-fixme-option-title"/><a href="#test-step-fixme-option-title" class="list-anchor">#</a>
1586+
1587+
Step name.
1588+
- `body` [function]\(\):[Promise]&lt;[Object]&gt;<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="test-step-fixme-option-body"/><a href="#test-step-fixme-option-body" class="list-anchor">#</a>
1589+
1590+
Step body.
1591+
- `options` [Object] *(optional)*
1592+
- `box` [boolean] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="test-step-fixme-option-box"/><a href="#test-step-fixme-option-box" class="list-anchor">#</a>
1593+
1594+
Whether to box the step in the report. Defaults to `false`. When the step is boxed, errors thrown from the step internals point to the step call site. See below for more details.
1595+
- `location` [Location] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="test-step-fixme-option-location"/><a href="#test-step-fixme-option-location" class="list-anchor">#</a>
1596+
1597+
Specifies a custom location for the step to be shown in test reports and trace viewer. By default, location of the [test.step()](/api/class-test.mdx#test-step) call is shown.
1598+
- `timeout` [number] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="test-step-fixme-option-timeout"/><a href="#test-step-fixme-option-timeout" class="list-anchor">#</a>
1599+
1600+
Maximum time in milliseconds for the step to finish. Defaults to `0` (no timeout).
1601+
1602+
**Returns**
1603+
- [Promise]&lt;[void]&gt;<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="test-step-fixme-return"/><a href="#test-step-fixme-return" class="list-anchor">#</a>
1604+
1605+
---
1606+
15141607
### test.use {#test-use}
15151608

15161609
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.10</font><x-search>test.test.use</x-search>

0 commit comments

Comments
 (0)