Skip to content

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

test: some test hygiene (#38303)

Simon Knotta6a4e57bec2e
diff --git a/tests/library/browsercontext-reuse.spec.ts b/tests/library/browsercontext-reuse.spec.ts
index 602f323522..b24473331b 100644
--- a/tests/library/browsercontext-reuse.spec.ts
+++ b/tests/library/browsercontext-reuse.spec.ts
@@ -269,8 +269,9 @@ for (const scenario of ['launch', 'connect'] as const) {
test('should reset mouse position', {
annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/22432' },
- }, async ({ reusedContext, browserName, platform }) => {
+ }, async ({ reusedContext, browserName, platform, headless }) => {
// Note: this test only reproduces the issue locally when run with --repeat-each=20.
+ test.skip(!headless, 'headed browser has mouse jiggles');
const pageContent = `
<style>
diff --git a/tests/library/inspector/cli-codegen-1.spec.ts b/tests/library/inspector/cli-codegen-1.spec.ts
index b693a08401..7402321e10 100644
--- a/tests/library/inspector/cli-codegen-1.spec.ts
+++ b/tests/library/inspector/cli-codegen-1.spec.ts
@@ -105,7 +105,7 @@ await page.GetByRole(AriaRole.Button, new() { Name = "Submit" }).DblClickAsync()
]);
// Do not trigger double click.
- await page.waitForTimeout(200);
+ await page.waitForTimeout(1000);
const [sources] = await Promise.all([
recorder.waitForOutput('JavaScript', `click();\n await`),
@@ -130,7 +130,7 @@ await page.GetByRole(AriaRole.Button, new() { Name = "Submit" }).DblClickAsync()
]);
// Do not trigger double click.
- await page.waitForTimeout(200);
+ await page.waitForTimeout(1000);
await Promise.all([
recorder.waitForOutput('JavaScript', `click();\n await`),
diff --git a/tests/page/page-click.spec.ts b/tests/page/page-click.spec.ts
index 083e9180fc..05b1c3068b 100644
--- a/tests/page/page-click.spec.ts
+++ b/tests/page/page-click.spec.ts
@@ -248,12 +248,15 @@ it('should click wrapped links', async ({ page, server }) => {
expect(await page.evaluate('__clicked')).toBe(true);
});
-it('should click on checkbox input and toggle', async ({ page, server }) => {
+it('should click on checkbox input and toggle', async ({ page, server, headless }) => {
await page.goto(server.PREFIX + '/input/checkbox.html');
expect(await page.evaluate(() => window['result'].check)).toBe(null);
await page.click('input#agree');
expect(await page.evaluate(() => window['result'].check)).toBe(true);
- expect(await page.evaluate(() => window['result'].events)).toEqual([
+ let events: string[] = await page.evaluate(() => window['result'].events);
+ if (!headless)
+ events = events.filter(e => e !== 'mouseout' && e !== 'mouseleave');
+ expect(events).toEqual([
'mouseover',
'mouseenter',
'mousemove',