You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
awaitexpect(this.page.getByRole('button', { name:'View profile and more' })).toBeVisible();
1397
+
}
1398
+
}
1376
1399
1377
-
### option: Test.step.box
1378
-
* since: v1.39
1379
-
-`box` <boolean>
1400
+
test('example', async ({ page }) => {
1401
+
constloginPage=newLoginPage(page);
1402
+
awaitloginPage.login();
1403
+
});
1404
+
```
1405
+
1406
+
**Boxing**
1380
1407
1381
-
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.
1408
+
When something inside a step fails, you would usually see the error pointing to the exact action that failed. For example, consider the following login step:
As we see above, the test may fail with an error pointing inside the step. If you would like the error to highlight the "login" step instead of its internals, use the `box` option. An error inside a boxed step points to the step call site.
1438
+
1439
+
```js
1440
+
asyncfunctionlogin(page) {
1441
+
awaittest.step('login', async () => {
1442
+
// ...
1443
+
}, { box:true }); // Note the "box" option here.
1444
+
}
1445
+
```
1446
+
1447
+
```txt
1448
+
Error: Timed out 5000ms waiting for expect(locator).toBeVisible()
1449
+
... error details omitted ...
1450
+
1451
+
14 | await page.goto('https://github.com/login');
1452
+
> 15 | await login(page);
1453
+
| ^
1454
+
16 | });
1455
+
```
1456
+
1457
+
You can also create a TypeScript decorator for a boxed step, similar to a regular step decorator above:
awaitpom.assertGoodPage(); // <-- Error will be reported on this line.
1478
+
test('example', async ({ page }) => {
1479
+
constloginPage=newLoginPage(page);
1480
+
awaitloginPage.login(); // <-- Error will be reported on this line.
1419
1481
});
1420
1482
```
1421
1483
1484
+
### param: Test.step.title
1485
+
* since: v1.10
1486
+
-`title` <[string]>
1487
+
1488
+
Step name.
1489
+
1490
+
1491
+
### param: Test.step.body
1492
+
* since: v1.10
1493
+
-`body` <[function]\(\):[Promise]<[any]>>
1494
+
1495
+
Step body.
1496
+
1497
+
### option: Test.step.box
1498
+
* since: v1.39
1499
+
-`box` <boolean>
1500
+
1501
+
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.
0 commit comments