Skip to content

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

test: fix a broken reporter test (#29514)

Dmitry Gozmanbc2d4302f5bd
diff --git a/tests/playwright-test/test-step.spec.ts b/tests/playwright-test/test-step.spec.ts
index 6799ee5b55..5f1b386ce3 100644
--- a/tests/playwright-test/test-step.spec.ts
+++ b/tests/playwright-test/test-step.spec.ts
@@ -47,8 +47,8 @@ class Reporter {
distillError(error) {
return {
error: {
- message: stripAnsi(error.message),
- stack: stripAnsi(error.stack),
+ message: stripAnsi(error.message || ''),
+ stack: stripAnsi(error.stack || ''),
}
};
}
@@ -351,6 +351,12 @@ test('should not report nested after hooks', async ({ runInlineTest }) => {
},
],
},
+ {
+ error: {
+ message: 'Test timeout of 2000ms exceeded.',
+ stack: ''
+ },
+ },
]);
});
@@ -972,6 +978,18 @@ test('should not mark page.close as failed when page.click fails', async ({ runI
},
],
},
+ {
+ error: {
+ message: 'Test timeout of 2000ms exceeded.',
+ stack: '',
+ },
+ },
+ {
+ error: {
+ message: expect.stringContaining('Error: page.click'),
+ stack: expect.stringContaining('Error: page.click'),
+ },
+ },
]);
});
@@ -1172,7 +1190,7 @@ test('should propagate nested soft errors', async ({ runInlineTest }) => {
expect.soft(1).toBe(2);
});
});
-
+
await test.step('second outer', async () => {
await test.step('second inner', async () => {
expect(1).toBe(2);
@@ -1267,7 +1285,7 @@ test('should not propagate nested hard errors', async ({ runInlineTest }) => {
}
});
});
-
+
await test.step('second outer', async () => {
await test.step('second inner', async () => {
expect(1).toBe(2);