Skip to content

Commit

Permalink
cherry-pick(#35052): docs: update more step.skip() examples (#35055)
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s authored Mar 5, 2025
1 parent 9603226 commit 72622fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions docs/src/test-api/class-teststepinfo.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ Abort the currently running step and mark it as skipped. Useful for steps that a
import { test, expect } from '@playwright/test';

test('my test', async ({ page }) => {
await test.step('check expectations', async () => {
test.skip();
await test.step('check expectations', async step => {
step.skip();
// step body below will not run
// ...
});
Expand All @@ -109,9 +109,8 @@ Conditionally abort the currently running step and mark it as skipped with an op
import { test, expect } from '@playwright/test';

test('my test', async ({ page, isMobile }) => {
await test.step('check desktop expectations', async () => {
test.skip(isMobile, 'not present in the mobile layout');

await test.step('check desktop expectations', async step => {
step.skip(isMobile, 'not present in the mobile layout');
// step body below will not run
// ...
});
Expand Down
9 changes: 4 additions & 5 deletions packages/playwright/types/test.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9674,8 +9674,8 @@ export interface TestStepInfo {
* import { test, expect } from '@playwright/test';
*
* test('my test', async ({ page }) => {
* await test.step('check expectations', async () => {
* test.skip();
* await test.step('check expectations', async step => {
* step.skip();
* // step body below will not run
* // ...
* });
Expand All @@ -9695,9 +9695,8 @@ export interface TestStepInfo {
* import { test, expect } from '@playwright/test';
*
* test('my test', async ({ page, isMobile }) => {
* await test.step('check desktop expectations', async () => {
* test.skip(isMobile, 'not present in the mobile layout');
*
* await test.step('check desktop expectations', async step => {
* step.skip(isMobile, 'not present in the mobile layout');
* // step body below will not run
* // ...
* });
Expand Down

0 comments on commit 72622fe

Please sign in to comment.