Skip to content

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

test: increase small timeouts to accomodate two workers (#15257)

Dmitry Gozmanf0b3b280a516
diff --git a/tests/library/hit-target.spec.ts b/tests/library/hit-target.spec.ts
index f53493da9f..2825296e6f 100644
--- a/tests/library/hit-target.spec.ts
+++ b/tests/library/hit-target.spec.ts
@@ -250,7 +250,7 @@ it('should not click iframe overlaying the target', async ({ page, server }) =>
<iframe srcdoc="<body onclick='window.top._clicked=2' style='background-color:red;height:40px;'></body>" style="display: block; border: 0px; width: 100vw; height: 48px;"></iframe>
</div>
`);
- const error = await page.click('text=click-me', { timeout: 500 }).catch(e => e);
+ const error = await page.click('text=click-me', { timeout: 1000 }).catch(e => e);
expect(await page.evaluate('window._clicked')).toBe(undefined);
expect(error.message).toContain(`<iframe srcdoc="<body onclick='window.top._clicked=2' st…></iframe> from <div>…</div> subtree intercepts pointer events`);
});
@@ -264,7 +264,7 @@ it('should not click an element overlaying iframe with the target', async ({ pag
`);
const target = page.frameLocator('iframe').frameLocator('iframe').locator('text=inner');
- const error = await target.click({ timeout: 500 }).catch(e => e);
+ const error = await target.click({ timeout: 1000 }).catch(e => e);
expect(await page.evaluate('window._clicked')).toBe(undefined);
expect(error.message).toContain(`<div onclick="window.top._clicked=5">PINK OVERLAY</div> intercepts pointer events`);
diff --git a/tests/page/locator-frame.spec.ts b/tests/page/locator-frame.spec.ts
index 494510d27c..d4b4064fda 100644
--- a/tests/page/locator-frame.spec.ts
+++ b/tests/page/locator-frame.spec.ts
@@ -96,7 +96,7 @@ it('should work for $ and $$', async ({ page, server }) => {
it('should wait for frame', async ({ page, server }) => {
await page.goto(server.EMPTY_PAGE);
- const error = await page.frameLocator('iframe').locator('span').click({ timeout: 300 }).catch(e => e);
+ const error = await page.frameLocator('iframe').locator('span').click({ timeout: 1000 }).catch(e => e);
expect(error.message).toContain('waiting for frame "iframe"');
});
diff --git a/tests/page/page-click.spec.ts b/tests/page/page-click.spec.ts
index edb7a223ba..ad676fc7ce 100644
--- a/tests/page/page-click.spec.ts
+++ b/tests/page/page-click.spec.ts
@@ -515,7 +515,7 @@ it('should wait for becoming hit target with trial run', async ({ page, server }
it('trial run should work with short timeout', async ({ page, server }) => {
await page.goto(server.PREFIX + '/input/button.html');
await page.$eval('button', button => button.disabled = true);
- const error = await page.click('button', { trial: true, timeout: 500 }).catch(e => e);
+ const error = await page.click('button', { trial: true, timeout: 2000 }).catch(e => e);
expect(error.message).toContain('click action (trial run)');
expect(await page.evaluate(() => window['result'])).toBe('Was not clicked');
});
diff --git a/tests/page/page-select-option.spec.ts b/tests/page/page-select-option.spec.ts
index ab32c03f0a..e9808b4349 100644
--- a/tests/page/page-select-option.spec.ts
+++ b/tests/page/page-select-option.spec.ts
@@ -68,7 +68,7 @@ it('should not select single option when some attributes do not match', async ({
await page.goto(server.PREFIX + '/input/select.html');
await page.$eval('select', s => s.value = undefined);
try {
- await page.selectOption('select', { value: 'green', label: 'Brown' }, { timeout: 300 });
+ await page.selectOption('select', { value: 'green', label: 'Brown' }, { timeout: 1000 });
} catch (e) {
expect(e.message).toContain('Timeout');
}
diff --git a/tests/page/page-wait-for-request.spec.ts b/tests/page/page-wait-for-request.spec.ts
index f9352bc55e..030ec4f83a 100644
--- a/tests/page/page-wait-for-request.spec.ts
+++ b/tests/page/page-wait-for-request.spec.ts
@@ -62,7 +62,7 @@ it('should respect default timeout', async ({ page, playwright }) => {
});
it('should log the url', async ({ page }) => {
- const error = await page.waitForRequest('long-long-long-long-long-long-long-long-long-long-long-long-long-long.css', { timeout: 100 }).catch(e => e);
+ const error = await page.waitForRequest('long-long-long-long-long-long-long-long-long-long-long-long-long-long.css', { timeout: 1000 }).catch(e => e);
expect(error.message).toContain('waiting for request "long-long-long-long-long-long-long-long-long-long-…"');
});
diff --git a/tests/page/page-wait-for-response.spec.ts b/tests/page/page-wait-for-response.spec.ts
index 829dac6930..7acaba1b35 100644
--- a/tests/page/page-wait-for-response.spec.ts
+++ b/tests/page/page-wait-for-response.spec.ts
@@ -47,9 +47,9 @@ it('should respect default timeout', async ({ page, playwright }) => {
});
it('should log the url', async ({ page }) => {
- const error1 = await page.waitForResponse('foo.css', { timeout: 100 }).catch(e => e);
+ const error1 = await page.waitForResponse('foo.css', { timeout: 1000 }).catch(e => e);
expect(error1.message).toContain('waiting for response "foo.css"');
- const error2 = await page.waitForResponse(/foo.css/i, { timeout: 100 }).catch(e => e);
+ const error2 = await page.waitForResponse(/foo.css/i, { timeout: 1000 }).catch(e => e);
expect(error2.message).toContain('waiting for response /foo.css/i');
});
diff --git a/tests/page/selectors-misc.spec.ts b/tests/page/selectors-misc.spec.ts
index b5360c038c..fb03201fbf 100644
--- a/tests/page/selectors-misc.spec.ts
+++ b/tests/page/selectors-misc.spec.ts
@@ -47,8 +47,8 @@ it('should work with :visible', async ({ page }) => {
`);
expect(await page.$('div:visible')).toBe(null);
- const error = await page.waitForSelector(`div:visible`, { timeout: 100 }).catch(e => e);
- expect(error.message).toContain('100ms');
+ const error = await page.waitForSelector(`div:visible`, { timeout: 1000 }).catch(e => e);
+ expect(error.message).toContain('1000ms');
const promise = page.waitForSelector(`div:visible`, { state: 'attached' });
await page.$eval('#target2', div => div.textContent = 'Now visible');
@@ -67,8 +67,8 @@ it('should work with >> visible=', async ({ page }) => {
`);
expect(await page.$('div >> visible=true')).toBe(null);
- const error = await page.waitForSelector(`div >> visible=true`, { timeout: 100 }).catch(e => e);
- expect(error.message).toContain('100ms');
+ const error = await page.waitForSelector(`div >> visible=true`, { timeout: 1000 }).catch(e => e);
+ expect(error.message).toContain('1000ms');
const promise = page.waitForSelector(`div >> visible=true`, { state: 'attached' });
await page.$eval('#target2', div => div.textContent = 'Now visible');
diff --git a/tests/playwright-test/playwright.expect.misc.spec.ts b/tests/playwright-test/playwright.expect.misc.spec.ts
index 12e8adf225..b19ecda9c5 100644
--- a/tests/playwright-test/playwright.expect.misc.spec.ts
+++ b/tests/playwright-test/playwright.expect.misc.spec.ts
@@ -70,13 +70,13 @@ test('should support toHaveCount', async ({ runInlineTest }) => {
test('fail zero', async ({ page }) => {
await page.setContent('<div><span></span></div>');
const locator = page.locator('span');
- await expect(locator).toHaveCount(0, { timeout: 500 });
+ await expect(locator).toHaveCount(0, { timeout: 1000 });
});
test('fail zero 2', async ({ page }) => {
await page.setContent('<div><span></span></div>');
const locator = page.locator('span');
- await expect(locator).not.toHaveCount(1, { timeout: 500 });
+ await expect(locator).not.toHaveCount(1, { timeout: 1000 });
});
`,
}, { workers: 1 });
@@ -86,7 +86,7 @@ test('should support toHaveCount', async ({ runInlineTest }) => {
expect(result.exitCode).toBe(1);
expect(output).toContain('Expected: 0');
expect(output).toContain('Received: 1');
- expect(output).toContain('expect.toHaveCount with timeout 500ms');
+ expect(output).toContain('expect.toHaveCount with timeout 1000ms');
});
test('should support toHaveJSProperty', async ({ runInlineTest }) => {
@@ -274,7 +274,7 @@ test('should support toHaveTitle', async ({ runInlineTest }) => {
test('fail', async ({ page }) => {
await page.setContent('<title>Bye</title>');
- await expect(page).toHaveTitle('Hello', { timeout: 100 });
+ await expect(page).toHaveTitle('Hello', { timeout: 1000 });
});
`,
}, { workers: 1 });
@@ -298,7 +298,7 @@ test('should support toHaveURL', async ({ runInlineTest }) => {
test('fail', async ({ page }) => {
await page.goto('data:text/html,<div>B</div>');
- await expect(page).toHaveURL('wrong', { timeout: 100 });
+ await expect(page).toHaveURL('wrong', { timeout: 1000 });
});
`,
}, { workers: 1 });
@@ -324,7 +324,7 @@ test('should support toHaveURL with baseURL from webServer', async ({ runInlineT
test('fail', async ({ page }) => {
await page.goto('/foobar');
- await expect(page).toHaveURL('/kek', { timeout: 100 });
+ await expect(page).toHaveURL('/kek', { timeout: 1000 });
});
`,
'playwright.config.ts': `
diff --git a/tests/playwright-test/playwright.expect.text.spec.ts b/tests/playwright-test/playwright.expect.text.spec.ts
index ef205cae0a..a64f3902a8 100644
--- a/tests/playwright-test/playwright.expect.text.spec.ts
+++ b/tests/playwright-test/playwright.expect.text.spec.ts
@@ -37,7 +37,7 @@ test('should support toHaveText w/ regex', async ({ runInlineTest }) => {
test('fail', async ({ page }) => {
await page.setContent('<div id=node>Text content</div>');
const locator = page.locator('#node');
- await expect(locator).toHaveText(/Text 2/, { timeout: 100 });
+ await expect(locator).toHaveText(/Text 2/, { timeout: 1000 });
});
`,
}, { workers: 1 });
@@ -68,7 +68,7 @@ test('should support toContainText w/ regex', async ({ runInlineTest }) => {
test('fail', async ({ page }) => {
await page.setContent('<div id=node>Text content</div>');
const locator = page.locator('#node');
- await expect(locator).toContainText(/ex2/, { timeout: 100 });
+ await expect(locator).toContainText(/ex2/, { timeout: 1000 });
});
`,
}, { workers: 1 });
@@ -115,7 +115,7 @@ test('should support toHaveText w/ text', async ({ runInlineTest }) => {
test('fail', async ({ page }) => {
await page.setContent('<div id=node>Text content</div>');
const locator = page.locator('#node');
- await expect(locator).toHaveText('Text', { timeout: 100 });
+ await expect(locator).toHaveText('Text', { timeout: 1000 });
});
`,
}, { workers: 1 });
@@ -145,7 +145,7 @@ test('should support toHaveText w/ not', async ({ runInlineTest }) => {
test('fail', async ({ page }) => {
await page.setContent('<div id=node>Text content</div>');
const locator = page.locator('#node');
- await expect(locator).not.toHaveText('Text content', { timeout: 100 });
+ await expect(locator).not.toHaveText('Text content', { timeout: 1000 });
});
`,
}, { workers: 1 });
diff --git a/tests/playwright-test/playwright.expect.true.spec.ts b/tests/playwright-test/playwright.expect.true.spec.ts
index c74c2386ca..7401ca03ec 100644
--- a/tests/playwright-test/playwright.expect.true.spec.ts
+++ b/tests/playwright-test/playwright.expect.true.spec.ts
@@ -74,19 +74,19 @@ test('should support toBeChecked w/ not', async ({ runInlineTest }) => {
test('fail not', async ({ page }) => {
await page.setContent('<input type=checkbox checked></input>');
const locator = page.locator('input');
- await expect(locator).not.toBeChecked({ timeout: 500 });
+ await expect(locator).not.toBeChecked({ timeout: 1000 });
});
test('fail 2', async ({ page }) => {
await page.setContent('<input type=checkbox checked></input>');
const locator = page.locator('input');
- await expect(locator).toBeChecked({ checked: false, timeout: 500 });
+ await expect(locator).toBeChecked({ checked: false, timeout: 1000 });
});
test('fail missing', async ({ page }) => {
await page.setContent('<div>no inputs here</div>');
const locator2 = page.locator('input2');
- await expect(locator2).not.toBeChecked({ timeout: 500 });
+ await expect(locator2).not.toBeChecked({ timeout: 1000 });
});
`,
}, { workers: 1 });
@@ -123,7 +123,7 @@ test('should support toBeEditable, toBeEnabled, toBeDisabled, toBeEmpty', async
test('failed', async ({ page }) => {
await page.setContent('<button disabled>Text</button>');
const locator = page.locator('button');
- await expect(locator).toBeEnabled({ timeout: 500 });
+ await expect(locator).toBeEnabled({ timeout: 1000 });
});
test('eventually enabled', async ({ page }) => {
@@ -173,7 +173,7 @@ test('should support toBeEditable, toBeEnabled, toBeDisabled, toBeEmpty', async
expect(result.failed).toBe(1);
expect(result.exitCode).toBe(1);
const output = stripAnsi(result.output);
- expect(output).toContain('expect(locator).toBeEnabled({ timeout: 500 }');
+ expect(output).toContain('expect(locator).toBeEnabled({ timeout: 1000 }');
});
test('should support toBeDisabled,toBeChecked,toBeHidden w/ value', async ({ runInlineTest }) => {
@@ -303,31 +303,31 @@ test('should support toBeVisible, toBeHidden fail', async ({ runInlineTest }) =>
test('visible', async ({ page }) => {
await page.setContent('<button style="display: none"></button>');
const locator = page.locator('button');
- await expect(locator).toBeVisible({ timeout: 500 });
+ await expect(locator).toBeVisible({ timeout: 1000 });
});
test('not visible', async ({ page }) => {
await page.setContent('<input></input>');
const locator = page.locator('input');
- await expect(locator).not.toBeVisible({ timeout: 500 });
+ await expect(locator).not.toBeVisible({ timeout: 1000 });
});
test('hidden', async ({ page }) => {
await page.setContent('<input></input>');
const locator = page.locator('input');
- await expect(locator).toBeHidden({ timeout: 500 });
+ await expect(locator).toBeHidden({ timeout: 1000 });
});
test('not hidden', async ({ page }) => {
await page.setContent('<button style="display: none"></button>');
const locator = page.locator('button');
- await expect(locator).not.toBeHidden({ timeout: 500 });
+ await expect(locator).not.toBeHidden({ timeout: 1000 });
});
test('not hidden 2', async ({ page }) => {
await page.setContent('<div></div>');
const locator = page.locator('button');
- await expect(locator).not.toBeHidden({ timeout: 500 });
+ await expect(locator).not.toBeHidden({ timeout: 1000 });
});
`,
}, { workers: 1 });