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

This commit is contained in:
Dmitry Gozman 2022-06-30 09:05:39 -07:00 коммит произвёл GitHub
Родитель 71fc53bbf8
Коммит f0b3b280a5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
10 изменённых файлов: 32 добавлений и 32 удалений

Просмотреть файл

@ -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`);

Просмотреть файл

@ -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"');
});

Просмотреть файл

@ -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');
});

Просмотреть файл

@ -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');
}

Просмотреть файл

@ -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-…"');
});

Просмотреть файл

@ -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');
});

Просмотреть файл

@ -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');

Просмотреть файл

@ -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': `

Просмотреть файл

@ -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 });

Просмотреть файл

@ -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 });