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/skip/fix some tests (#38905)

Dmitry Gozman42d4f18d7fff
diff --git a/tests/library/hit-target.spec.ts b/tests/library/hit-target.spec.ts
index d13f21f8fa..69fcd19251 100644
--- a/tests/library/hit-target.spec.ts
+++ b/tests/library/hit-target.spec.ts
@@ -82,7 +82,7 @@ it('should click when element detaches in mousedown', async ({ page, server }) =
});
});
- await page.click('button', { timeout: 1000 });
+ await page.click('button', { timeout: 15000 });
expect(await page.evaluate('result')).toBe('Mousedown');
});
@@ -391,7 +391,7 @@ it('should detect overlaid element in a transformed iframe', async ({ page }) =>
"></iframe>
`);
const locator = page.frameLocator('iframe').locator('div');
- const error = await locator.click({ timeout: 3000 }).catch(e => e);
+ const error = await locator.click({ timeout: 5000 }).catch(e => e);
expect(error.message).toContain('<section>Overlay</section> intercepts pointer events');
});
diff --git a/tests/library/inspector/cli-codegen-2.spec.ts b/tests/library/inspector/cli-codegen-2.spec.ts
index 64ab109eb9..79899c011f 100644
--- a/tests/library/inspector/cli-codegen-2.spec.ts
+++ b/tests/library/inspector/cli-codegen-2.spec.ts
@@ -15,7 +15,6 @@
*/
import { test, expect } from './inspectorTest';
-import fs from 'fs';
test.describe('cli codegen', () => {
test.skip(({ mode }) => mode !== 'default');
@@ -452,27 +451,6 @@ await page1.GotoAsync("about:blank?foo");`);
await recorder.waitForOutput('JavaScript', `await page.goto('${server.PREFIX}/page2.html');`);
});
- test('should save assets via SIGINT', async ({ runCLI, platform }, testInfo) => {
- test.skip(platform === 'win32', 'SIGINT not supported on Windows');
-
- const storageFileName = testInfo.outputPath('auth.json');
- const harFileName = testInfo.outputPath('har.har');
- const cli = runCLI([`--save-storage=${storageFileName}`, `--save-har=${harFileName}`]);
- await cli.waitFor(`import { test, expect } from '@playwright/test'`);
- // Since our interrupt is non-graceful, we need to wait for the process to settle.
- // This test should be fixed.
- await new Promise(resolve => setTimeout(resolve, 2000));
- const { exitCode, signal } = await cli.sigint();
- if (exitCode !== null) {
- expect(exitCode).toBe(130);
- } else {
- // If the runner is slow enough, the process will be forcibly terminated by the signal
- expect(signal).toBe('SIGINT');
- }
- expect(fs.existsSync(storageFileName)).toBeTruthy();
- expect(fs.existsSync(harFileName)).toBeTruthy();
- });
-
test('should fill tricky characters', async ({ openRecorder }) => {
const { page, recorder } = await openRecorder();
diff --git a/tests/library/permissions.spec.ts b/tests/library/permissions.spec.ts
index f753adc794..6965554b40 100644
--- a/tests/library/permissions.spec.ts
+++ b/tests/library/permissions.spec.ts
@@ -256,8 +256,11 @@ it.describe(() => {
it('local network request is allowed from public origin', {
annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/37861' }
-}, async ({ page, context, server, browserName }) => {
- it.fail(browserName === 'webkit');
+}, async ({ page, context, server, browserName, channel, browserMajorVersion }) => {
+ it.skip(browserName === 'webkit');
+ it.skip(channel?.startsWith('msedge'));
+ it.skip(browserName === 'chromium' && browserMajorVersion < 145, 'local-network-access permission support has changed between versions');
+
if (browserName === 'chromium')
await context.grantPermissions(['local-network-access']);
const serverRequests = [];
diff --git a/tests/library/proxy.spec.ts b/tests/library/proxy.spec.ts
index f0d83e8503..9f068fcb01 100644
--- a/tests/library/proxy.spec.ts
+++ b/tests/library/proxy.spec.ts
@@ -90,8 +90,9 @@ it.describe('should proxy local network requests', () => {
description: 'link-local'
}
]) {
- it(`${params.description}`, async ({ platform, browserName, browserType, server, proxyServer }) => {
+ it(`${params.description}`, async ({ platform, browserName, browserType, server, proxyServer, channel }) => {
it.skip(browserName === 'webkit' && platform === 'darwin' && ['localhost', '127.0.0.1'].includes(params.target) && additionalBypass, 'Mac webkit does not proxy localhost when bypass rules are set.');
+ it.fixme(channel?.startsWith('msedge'), 'times out while loading the page');
const path = `/target-${additionalBypass}-${params.target}.html`;
server.setRoute(path, async (req, res) => {
@@ -175,7 +176,9 @@ it('should work with authenticate followed by redirect', async ({ browserName, b
await browser.close();
});
-it('should exclude patterns', async ({ browserType, server, browserName, headless }) => {
+it('should exclude patterns', async ({ browserType, server, channel }) => {
+ it.fixme(channel?.startsWith('msedge'), 'times out while loading the page');
+
server.setRoute('/target.html', async (req, res) => {
res.end('<html><title>Served by the proxy</title></html>');
});
diff --git a/tests/page/page-click-timeout-4.spec.ts b/tests/page/page-click-timeout-4.spec.ts
index a973061ed8..695f7b63cb 100644
--- a/tests/page/page-click-timeout-4.spec.ts
+++ b/tests/page/page-click-timeout-4.spec.ts
@@ -90,7 +90,7 @@ it('should fail to click the button behind a large header after scrolling around
</script>
`);
await page.$eval('#li14', e => e.scrollIntoView());
- const error = await page.click('#target', { timeout: 1500 }).catch(e => e);
+ const error = await page.click('#target', { timeout: 3500 }).catch(e => e);
expect(error.message).toContain(`<div class="fixed"></div> intercepts pointer events`);
expect(await page.evaluate(() => window['__clicked'])).toBe(undefined);
const scrollTops = await page.evaluate(() => window['scrollTops']);
diff --git a/tests/page/page-click.spec.ts b/tests/page/page-click.spec.ts
index 5221be5b95..322452373a 100644
--- a/tests/page/page-click.spec.ts
+++ b/tests/page/page-click.spec.ts
@@ -1079,7 +1079,7 @@ it('should click a button that is overlaid by a permission popup', async ({ page
navigator.geolocation.getCurrentPosition(position => { });
});
// If popup blocks the click, then some of the `page.click` calls below will hang.
- for (let i = 0; i < 100; ++i)
+ for (let i = 0; i < 30; ++i)
await page.click(`text=${i}`);
});
diff --git a/tests/playwright-test/expect.spec.ts b/tests/playwright-test/expect.spec.ts
index c3d2997875..a47dff42c6 100644
--- a/tests/playwright-test/expect.spec.ts
+++ b/tests/playwright-test/expect.spec.ts
@@ -586,15 +586,15 @@ test('should log scale the time', async ({ runInlineTest }) => {
test('pass', async ({ page }) => {
await page.setContent('<div id=div>Wrong</div>');
- await expect(page.locator('div')).toHaveText('Text', { timeout: 2000 });
+ await expect(page.locator('div')).toHaveText('Text', { timeout: 5000 });
});
`,
}, { workers: 1 });
const output = result.output;
const tokens = output.split('unexpected value');
- // Log scale: 0, 100, 250, 500, 1000, 1000, should be less than 8.
+ // Log scale: 0, 100, 250, 500, 1000, 1000, ... - should be less than 10.
expect(tokens.length).toBeGreaterThan(1);
- expect(tokens.length).toBeLessThan(8);
+ expect(tokens.length).toBeLessThan(10);
expect(result.passed).toBe(0);
expect(result.exitCode).toBe(1);
});