Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs: update more step.skip() examples (#35052)

Yury Semikhatsky9e76b3695c3f
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
* // ...
* });