mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
test: unflake a few tests (#27519)
This commit is contained in:
parent
2776d8446b
commit
d05c865389
@ -188,32 +188,39 @@ it('should exclude patterns', async ({ browserType, server, browserName, headles
|
||||
proxy: { server: `localhost:${server.PORT}`, bypass: '1.non.existent.domain.for.the.test, 2.non.existent.domain.for.the.test, .another.test' }
|
||||
});
|
||||
|
||||
const page = await browser.newPage();
|
||||
await page.goto('http://0.non.existent.domain.for.the.test/target.html');
|
||||
expect(await page.title()).toBe('Served by the proxy');
|
||||
{
|
||||
const page = await browser.newPage();
|
||||
await page.goto('http://0.non.existent.domain.for.the.test/target.html');
|
||||
expect(await page.title()).toBe('Served by the proxy');
|
||||
await page.close();
|
||||
}
|
||||
|
||||
{
|
||||
const page = await browser.newPage();
|
||||
const error = await page.goto('http://1.non.existent.domain.for.the.test/target.html').catch(e => e);
|
||||
expect(error.message).toBeTruthy();
|
||||
await page.close();
|
||||
}
|
||||
|
||||
{
|
||||
const page = await browser.newPage();
|
||||
const error = await page.goto('http://2.non.existent.domain.for.the.test/target.html').catch(e => e);
|
||||
expect(error.message).toBeTruthy();
|
||||
await page.close();
|
||||
}
|
||||
|
||||
{
|
||||
const page = await browser.newPage();
|
||||
const error = await page.goto('http://foo.is.the.another.test/target.html').catch(e => e);
|
||||
expect(error.message).toBeTruthy();
|
||||
await page.close();
|
||||
}
|
||||
|
||||
// Make sure error page commits.
|
||||
if (browserName === 'chromium')
|
||||
await page.waitForURL('chrome-error://chromewebdata/');
|
||||
|
||||
{
|
||||
const page = await browser.newPage();
|
||||
await page.goto('http://3.non.existent.domain.for.the.test/target.html');
|
||||
expect(await page.title()).toBe('Served by the proxy');
|
||||
await page.close();
|
||||
}
|
||||
|
||||
await browser.close();
|
||||
|
@ -144,16 +144,16 @@ test('should render console', async ({ showTraceViewer, browserName }) => {
|
||||
await expect(traceViewer.consoleLineMessages.nth(1)).toHaveText('Warning');
|
||||
await expect(traceViewer.consoleLineMessages.nth(2)).toHaveText('Error');
|
||||
await expect(traceViewer.consoleLineMessages.nth(3)).toHaveText('Unhandled exception');
|
||||
// Firefox can insert layout error here.
|
||||
await expect(traceViewer.consoleLineMessages.last()).toHaveText('Cheers!');
|
||||
// Browsers can insert more messages between these two.
|
||||
await expect(traceViewer.consoleLineMessages.filter({ hasText: 'Cheers!' })).toBeVisible();
|
||||
|
||||
const icons = traceViewer.consoleLines.locator('.codicon');
|
||||
await expect.soft(icons.nth(0)).toHaveClass('codicon codicon-browser status-none');
|
||||
await expect.soft(icons.nth(1)).toHaveClass('codicon codicon-browser status-warning');
|
||||
await expect.soft(icons.nth(2)).toHaveClass('codicon codicon-browser status-error');
|
||||
await expect.soft(icons.nth(3)).toHaveClass('codicon codicon-browser status-error');
|
||||
// Firefox can insert layout error here.
|
||||
await expect.soft(icons.last()).toHaveClass('codicon codicon-browser status-none');
|
||||
// Browsers can insert more messages between these two.
|
||||
await expect.soft(traceViewer.consoleLines.filter({ hasText: 'Cheers!' }).locator('.codicon')).toHaveClass('codicon codicon-browser status-none');
|
||||
await expect(traceViewer.consoleStacks.first()).toContainText('Error: Unhandled exception');
|
||||
|
||||
await traceViewer.selectAction('page.evaluate');
|
||||
@ -163,8 +163,8 @@ test('should render console', async ({ showTraceViewer, browserName }) => {
|
||||
await expect(listViews.nth(1)).toHaveClass('list-view-entry warning');
|
||||
await expect(listViews.nth(2)).toHaveClass('list-view-entry error');
|
||||
await expect(listViews.nth(3)).toHaveClass('list-view-entry error');
|
||||
// Firefox can insert layout error here.
|
||||
await expect(listViews.last()).toHaveClass('list-view-entry');
|
||||
// Browsers can insert more messages between these two.
|
||||
await expect(listViews.filter({ hasText: 'Cheers!' })).toHaveClass('list-view-entry');
|
||||
});
|
||||
|
||||
test('should open console errors on click', async ({ showTraceViewer, browserName }) => {
|
||||
|
Loading…
Reference in New Issue
Block a user