test: move async predicate to waitForResponse describe (#8285)

This commit is contained in:
Darío Kondratiuk 2022-04-28 11:51:57 -03:00 committed by GitHub
parent 15583c3eac
commit 25d363bf9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -763,21 +763,6 @@ describe('Page', function () {
.catch((error_) => (error = error_));
expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError);
});
it('should work with async predicate', async () => {
const { page, server } = getTestState();
await page.goto(server.EMPTY_PAGE);
const [response] = await Promise.all([
page.waitForResponse(async (response) => {
return response.url() === server.PREFIX + '/digits/2.png';
}),
page.evaluate(() => {
fetch('/digits/1.png');
fetch('/digits/2.png');
fetch('/digits/3.png');
}),
]);
expect(response.url()).toBe(server.PREFIX + '/digits/2.png');
});
it('should work with no timeout', async () => {
const { page, server } = getTestState();
@ -846,6 +831,21 @@ describe('Page', function () {
]);
expect(response.url()).toBe(server.PREFIX + '/digits/2.png');
});
it('should work with async predicate', async () => {
const { page, server } = getTestState();
await page.goto(server.EMPTY_PAGE);
const [response] = await Promise.all([
page.waitForResponse(async (response) => {
return response.url() === server.PREFIX + '/digits/2.png';
}),
page.evaluate(() => {
fetch('/digits/1.png');
fetch('/digits/2.png');
fetch('/digits/3.png');
}),
]);
expect(response.url()).toBe(server.PREFIX + '/digits/2.png');
});
it('should work with no timeout', async () => {
const { page, server } = getTestState();