Skip to content

test: unflake a few tests #27519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions tests/library/proxy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 6 additions & 6 deletions tests/library/trace-viewer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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 }) => {
Expand Down