mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
test: remove some flakiness (#12346)
This commit is contained in:
parent
fedd8a9628
commit
137236ee2a
@ -911,13 +911,8 @@ describe('network', function () {
|
||||
it('should work for document type', async () => {
|
||||
const {page, server} = await getTestState();
|
||||
|
||||
const requests: HTTPRequest[] = [];
|
||||
page.on('request', request => {
|
||||
return requests.push(request);
|
||||
});
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
expect(requests).toHaveLength(1);
|
||||
const request = requests[0]!;
|
||||
const response = await page.goto(server.EMPTY_PAGE);
|
||||
const request = response!.request();
|
||||
expect(request.resourceType()).toBe('document');
|
||||
});
|
||||
|
||||
@ -942,13 +937,7 @@ describe('network', function () {
|
||||
it('should work', async () => {
|
||||
const {page, server} = await getTestState();
|
||||
|
||||
const responses: HTTPResponse[] = [];
|
||||
page.on('response', response => {
|
||||
return responses.push(response);
|
||||
});
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
expect(responses).toHaveLength(1);
|
||||
const response = responses[0]!;
|
||||
const response = (await page.goto(server.EMPTY_PAGE))!;
|
||||
const remoteAddress = response.remoteAddress();
|
||||
// Either IPv6 or IPv4, depending on environment.
|
||||
expect(
|
||||
|
@ -1008,14 +1008,11 @@ describe('cooperative request interception', function () {
|
||||
const {page, server} = await getTestState();
|
||||
|
||||
await page.setRequestInterception(true);
|
||||
const requests: HTTPRequest[] = [];
|
||||
page.on('request', request => {
|
||||
requests.push(request);
|
||||
void request.continue({}, 0);
|
||||
});
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
expect(requests).toHaveLength(1);
|
||||
const request = requests[0]!;
|
||||
const response = await page.goto(server.EMPTY_PAGE);
|
||||
const request = response!.request();
|
||||
expect(request.resourceType()).toBe('document');
|
||||
});
|
||||
|
||||
|
@ -937,14 +937,11 @@ describe('request interception', function () {
|
||||
const {page, server} = await getTestState();
|
||||
|
||||
await page.setRequestInterception(true);
|
||||
const requests: HTTPRequest[] = [];
|
||||
page.on('request', request => {
|
||||
requests.push(request);
|
||||
void request.continue();
|
||||
});
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
expect(requests).toHaveLength(1);
|
||||
const request = requests[0]!;
|
||||
const response = await page.goto(server.EMPTY_PAGE);
|
||||
const request = response!.request();
|
||||
expect(request.resourceType()).toBe('document');
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user