Skip to content

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

test: unflake a few (#40386)

Dmitry Gozman68e3c9a65b68
diff --git a/tests/library/browser.spec.ts b/tests/library/browser.spec.ts
index a3db493051..42750dad1c 100644
--- a/tests/library/browser.spec.ts
+++ b/tests/library/browser.spec.ts
@@ -68,6 +68,7 @@ test('should fire context event on newContext', async ({ browser }) => {
browser.on('context', ctx => events.push(ctx));
const context = await browser.newContext();
expect(events).toEqual([context]);
+ await context.close();
});
test('newContext should not leave a context upon failure', async ({ browser, toImpl }) => {
diff --git a/tests/library/inspector/cli-codegen-1.spec.ts b/tests/library/inspector/cli-codegen-1.spec.ts
index dcfe89c72a..97929c01ae 100644
--- a/tests/library/inspector/cli-codegen-1.spec.ts
+++ b/tests/library/inspector/cli-codegen-1.spec.ts
@@ -1078,8 +1078,9 @@ await page.GetByRole(AriaRole.Button, new() { Name = "Submit" }).ClickAsync();`)
});
test('should not throw csp directive violation errors', async ({ openRecorder, server }) => {
+ server.setCSP('/empty.html', `default-src 'self'`);
const { page } = await openRecorder();
- await page.goto(server.PREFIX + '/csp.html');
+ await page.goto(server.EMPTY_PAGE);
const predicate = (msg: ConsoleMessage) => msg.type() === 'error' && /Content[\- ]Security[\- ]Policy/i.test(msg.text());
await expect(page.waitForEvent('console', { predicate, timeout: 1000 })).rejects.toThrow();
});
diff --git a/tests/library/locator-highlight.spec.ts b/tests/library/locator-highlight.spec.ts
index 237b22c728..6e4fd5bf7a 100644
--- a/tests/library/locator-highlight.spec.ts
+++ b/tests/library/locator-highlight.spec.ts
@@ -18,7 +18,9 @@ import { expect, browserTest as test } from '../config/browserTest';
test.skip(({ mode }) => mode !== 'default', 'Highlight overlay uses an open shadow root only in default mode');
-test('highlight should accept a CSS string style', async ({ browser, server, browserName }) => {
+test('highlight should accept a CSS string style', async ({ browser, server, browserName, isFrozenWebkit }) => {
+ test.skip(isFrozenWebkit);
+
const context = await browser.newContext();
const page = await context.newPage();
await page.goto(server.PREFIX + '/input/button.html');
@@ -40,7 +42,9 @@ test('highlight should accept a CSS string style', async ({ browser, server, bro
await context.close();
});
-test('highlight should accept an object style (JS only)', async ({ browser, server, browserName }) => {
+test('highlight should accept an object style (JS only)', async ({ browser, server, browserName, isFrozenWebkit }) => {
+ test.skip(isFrozenWebkit);
+
const context = await browser.newContext();
const page = await context.newPage();
await page.goto(server.PREFIX + '/input/button.html');