test: unflake some tests (#23984)
This commit is contained in:
parent
e28312ba63
commit
92c738b14a
|
|
@ -257,8 +257,8 @@ export class Route extends SdkObject {
|
|||
|
||||
async abort(errorCode: string = 'failed') {
|
||||
this._startHandling();
|
||||
await this._delegate.abort(errorCode);
|
||||
this._request._context.emit(BrowserContext.Events.RequestAborted, this._request);
|
||||
await this._delegate.abort(errorCode);
|
||||
this._endHandling();
|
||||
}
|
||||
|
||||
|
|
@ -285,13 +285,13 @@ export class Route extends SdkObject {
|
|||
}
|
||||
const headers = [...(overrides.headers || [])];
|
||||
this._maybeAddCorsHeaders(headers);
|
||||
this._request._context.emit(BrowserContext.Events.RequestFulfilled, this._request);
|
||||
await this._delegate.fulfill({
|
||||
status: overrides.status || 200,
|
||||
headers,
|
||||
body,
|
||||
isBase64,
|
||||
});
|
||||
this._request._context.emit(BrowserContext.Events.RequestFulfilled, this._request);
|
||||
this._endHandling();
|
||||
}
|
||||
|
||||
|
|
@ -322,9 +322,9 @@ export class Route extends SdkObject {
|
|||
throw new Error('New URL must have same protocol as overridden URL');
|
||||
}
|
||||
this._request._setOverrides(overrides);
|
||||
await this._delegate.continue(this._request, overrides);
|
||||
if (!overrides.isFallback)
|
||||
this._request._context.emit(BrowserContext.Events.RequestContinued, this._request);
|
||||
await this._delegate.continue(this._request, overrides);
|
||||
this._endHandling();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -318,8 +318,6 @@ it('should isolate proxy credentials between contexts', async ({ contextFactory,
|
|||
});
|
||||
|
||||
it('should exclude patterns', async ({ contextFactory, server, browserName, headless, proxyServer }) => {
|
||||
it.fixme(browserName === 'chromium' && !headless, 'Chromium headed crashes with CHECK(!in_frame_tree_) in RenderFrameImpl::OnDeleteFrame.');
|
||||
|
||||
proxyServer.forwardTo(server.PORT);
|
||||
// FYI: using long and weird domain names to avoid ATT DNS hijacking
|
||||
// that resolves everything to some weird search results page.
|
||||
|
|
@ -335,31 +333,49 @@ it('should exclude patterns', async ({ contextFactory, server, browserName, head
|
|||
expect(await page.title()).toBe('Served by the proxy');
|
||||
proxyServer.requestUrls = [];
|
||||
|
||||
const nonFaviconUrls = () => {
|
||||
return proxyServer.requestUrls.filter(u => !u.includes('favicon'));
|
||||
};
|
||||
|
||||
{
|
||||
const error = await page.goto('http://1.non.existent.domain.for.the.test/target.html').catch(e => e);
|
||||
expect(proxyServer.requestUrls).toEqual([]);
|
||||
expect(nonFaviconUrls()).toEqual([]);
|
||||
expect(error.message).toBeTruthy();
|
||||
|
||||
// Make sure error page commits.
|
||||
if (browserName === 'chromium')
|
||||
await page.waitForURL('chrome-error://chromewebdata/');
|
||||
else if (browserName === 'firefox')
|
||||
await page.waitForURL('http://1.non.existent.domain.for.the.test/target.html', { waitUntil: 'commit' });
|
||||
}
|
||||
|
||||
{
|
||||
const error = await page.goto('http://2.non.existent.domain.for.the.test/target.html').catch(e => e);
|
||||
expect(proxyServer.requestUrls).toEqual([]);
|
||||
expect(nonFaviconUrls()).toEqual([]);
|
||||
expect(error.message).toBeTruthy();
|
||||
|
||||
// Make sure error page commits.
|
||||
if (browserName === 'chromium')
|
||||
await page.waitForURL('chrome-error://chromewebdata/');
|
||||
else if (browserName === 'firefox')
|
||||
await page.waitForURL('http://2.non.existent.domain.for.the.test/target.html', { waitUntil: 'commit' });
|
||||
}
|
||||
|
||||
{
|
||||
const error = await page.goto('http://foo.is.the.another.test/target.html').catch(e => e);
|
||||
expect(proxyServer.requestUrls).toEqual([]);
|
||||
expect(nonFaviconUrls()).toEqual([]);
|
||||
expect(error.message).toBeTruthy();
|
||||
}
|
||||
|
||||
// Make sure error page commits.
|
||||
if (browserName === 'chromium')
|
||||
await page.waitForURL('chrome-error://chromewebdata/');
|
||||
// Make sure error page commits.
|
||||
if (browserName === 'chromium')
|
||||
await page.waitForURL('chrome-error://chromewebdata/');
|
||||
else if (browserName === 'firefox')
|
||||
await page.waitForURL('http://foo.is.the.another.test/target.html', { waitUntil: 'commit' });
|
||||
}
|
||||
|
||||
{
|
||||
await page.goto('http://3.non.existent.domain.for.the.test/target.html');
|
||||
expect(proxyServer.requestUrls).toContain('http://3.non.existent.domain.for.the.test/target.html');
|
||||
expect(nonFaviconUrls()).toContain('http://3.non.existent.domain.for.the.test/target.html');
|
||||
expect(await page.title()).toBe('Served by the proxy');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -125,9 +125,8 @@ it('should not throw when continuing while page is closing', async ({ page, serv
|
|||
page.close(),
|
||||
]);
|
||||
});
|
||||
const error = await page.goto(server.EMPTY_PAGE).catch(e => e);
|
||||
await page.goto(server.EMPTY_PAGE).catch(e => e);
|
||||
await done;
|
||||
expect(error).toBeInstanceOf(Error);
|
||||
});
|
||||
|
||||
it('should not throw when continuing after page is closed', async ({ page, server, isWebView2 }) => {
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ test('fixture time in beforeAll hook should not affect test', async ({ runInline
|
|||
import { test as base, expect } from '@playwright/test';
|
||||
const test = base.extend({
|
||||
fixture: async ({}, use) => {
|
||||
await new Promise(f => setTimeout(f, 500));
|
||||
await new Promise(f => setTimeout(f, 2000));
|
||||
await use('hey');
|
||||
},
|
||||
});
|
||||
|
|
@ -260,7 +260,6 @@ test('fixture time in beforeAll hook should not affect test', async ({ runInline
|
|||
});
|
||||
test('test ok', async ({}) => {
|
||||
test.setTimeout(1000);
|
||||
await new Promise(f => setTimeout(f, 800));
|
||||
});
|
||||
`
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue