test: unflake various tests (#32014)
This commit is contained in:
parent
613ccb8d5b
commit
5c9ce6b9d9
|
|
@ -177,6 +177,7 @@ export class TestServer {
|
||||||
this._csp.clear();
|
this._csp.clear();
|
||||||
this._extraHeaders.clear();
|
this._extraHeaders.clear();
|
||||||
this._gzipRoutes.clear();
|
this._gzipRoutes.clear();
|
||||||
|
this._server.closeAllConnections();
|
||||||
const error = new Error('Static Server has been reset');
|
const error = new Error('Static Server has been reset');
|
||||||
for (const subscriber of this._requestSubscribers.values())
|
for (const subscriber of this._requestSubscribers.values())
|
||||||
subscriber[rejectSymbol].call(null, error);
|
subscriber[rejectSymbol].call(null, error);
|
||||||
|
|
|
||||||
|
|
@ -260,8 +260,8 @@ it('should report google.com frame with headed', async ({ browserType, server })
|
||||||
it('ElementHandle.boundingBox() should work', async function({ page, browser, server }) {
|
it('ElementHandle.boundingBox() should work', async function({ page, browser, server }) {
|
||||||
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
||||||
await page.$eval('iframe', iframe => {
|
await page.$eval('iframe', iframe => {
|
||||||
iframe.style.width = '500px';
|
iframe.style.width = '520px';
|
||||||
iframe.style.height = '500px';
|
iframe.style.height = '520px';
|
||||||
iframe.style.marginLeft = '42px';
|
iframe.style.marginLeft = '42px';
|
||||||
iframe.style.marginTop = '17px';
|
iframe.style.marginTop = '17px';
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,9 @@ it('should scroll display:contents into view', async ({ page, browserName, brows
|
||||||
`);
|
`);
|
||||||
const div = await page.$('#target');
|
const div = await page.$('#target');
|
||||||
await div.scrollIntoViewIfNeeded();
|
await div.scrollIntoViewIfNeeded();
|
||||||
expect(await page.$eval('#container', e => e.scrollTop)).toBe(350);
|
const scrollTop = await page.$eval('#container', e => e.scrollTop);
|
||||||
|
// On Android the value is not exact due to various scale conversions.
|
||||||
|
expect(Math.abs(scrollTop - 350)).toBeLessThan(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should work for visibility:hidden element', async ({ page }) => {
|
it('should work for visibility:hidden element', async ({ page }) => {
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,9 @@ test('should work with a custom check', async ({ page, server }) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should work with locator.hover()', async ({ page, server }) => {
|
test('should work with locator.hover()', async ({ page, server, headless }) => {
|
||||||
|
test.skip(!headless, 'Stray hovers in headed mode');
|
||||||
|
|
||||||
await page.goto(server.PREFIX + '/input/handle-locator.html');
|
await page.goto(server.PREFIX + '/input/handle-locator.html');
|
||||||
|
|
||||||
await page.addLocatorHandler(page.getByText('This interstitial covers the button'), async () => {
|
await page.addLocatorHandler(page.getByText('This interstitial covers the button'), async () => {
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,15 @@ test.describe.configure({ mode: 'parallel', retries });
|
||||||
test('should show screenshots', async ({ runUITest }) => {
|
test('should show screenshots', async ({ runUITest }) => {
|
||||||
const { page } = await runUITest({
|
const { page } = await runUITest({
|
||||||
'a.test.ts': `
|
'a.test.ts': `
|
||||||
import { test } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
test('test 1', async ({ page }) => {
|
test('test 1', async ({ page }) => {
|
||||||
await page.setContent('<div style="background: red; width: 100%; height: 100%"></div>');
|
await page.setContent('<div style="background: red; width: 100%; height: 100%"></div>');
|
||||||
|
await expect(page.locator('body')).toBeVisible();
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForTimeout(1000);
|
||||||
});
|
});
|
||||||
test('test 2', async ({ page }) => {
|
test('test 2', async ({ page }) => {
|
||||||
await page.setContent('<div style="background: blue; width: 100%; height: 100%"></div>');
|
await page.setContent('<div style="background: blue; width: 100%; height: 100%">hello</div>');
|
||||||
|
await expect(page.locator('body')).toHaveText('hello');
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForTimeout(1000);
|
||||||
});
|
});
|
||||||
`,
|
`,
|
||||||
|
|
@ -36,14 +38,10 @@ test('should show screenshots', async ({ runUITest }) => {
|
||||||
await expect(page.getByTestId('status-line')).toHaveText('2/2 passed (100%)');
|
await expect(page.getByTestId('status-line')).toHaveText('2/2 passed (100%)');
|
||||||
|
|
||||||
await page.getByText('test 1', { exact: true }).click();
|
await page.getByText('test 1', { exact: true }).click();
|
||||||
await expect(
|
await expect(page.getByTestId('actions-tree')).toContainText('expect.toBeVisible');
|
||||||
page.locator('.CodeMirror .source-line-running'),
|
|
||||||
).toContainText(`test('test 1', async ({ page }) => {`);
|
|
||||||
await expect(page.locator('.film-strip-frame').first()).toBeVisible();
|
await expect(page.locator('.film-strip-frame').first()).toBeVisible();
|
||||||
|
|
||||||
await page.getByText('test 2', { exact: true }).click();
|
await page.getByText('test 2', { exact: true }).click();
|
||||||
await expect(
|
await expect(page.getByTestId('actions-tree')).toContainText('expect.toHaveText');
|
||||||
page.locator('.CodeMirror .source-line-running'),
|
|
||||||
).toContainText(`await page.waitForTimeout(1000);`);
|
|
||||||
await expect(page.locator('.film-strip-frame').first()).toBeVisible();
|
await expect(page.locator('.film-strip-frame').first()).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue