From 9e76b3695c3f62bcf31cd69d3b863452b64c1fbc Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Wed, 5 Mar 2025 08:38:05 -0800 Subject: [PATCH] docs: update more step.skip() examples (#35052) --- docs/src/test-api/class-teststepinfo.md | 9 ++++----- packages/playwright/types/test.d.ts | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/docs/src/test-api/class-teststepinfo.md b/docs/src/test-api/class-teststepinfo.md index 9af00b4143..0a0b521deb 100644 --- a/docs/src/test-api/class-teststepinfo.md +++ b/docs/src/test-api/class-teststepinfo.md @@ -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 // ... }); @@ -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 // ... }); diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index d135b91504..19ab77c303 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -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 * // ... * }); @@ -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 * // ... * });