tests: async fallback handlers (#15027)
This commit is contained in:
parent
f2b3491705
commit
25bc4c4ac7
|
|
@ -330,3 +330,24 @@ it('should chain fallback into page', async ({ context, page, server }) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
expect(intercepted).toEqual([6, 5, 4, 3, 2, 1]);
|
expect(intercepted).toEqual([6, 5, 4, 3, 2, 1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should fall back async', async ({ page, context, server }) => {
|
||||||
|
const intercepted = [];
|
||||||
|
await context.route('**/empty.html', async route => {
|
||||||
|
intercepted.push(1);
|
||||||
|
await new Promise(r => setTimeout(r, 100));
|
||||||
|
route.fallback();
|
||||||
|
});
|
||||||
|
await context.route('**/empty.html', async route => {
|
||||||
|
intercepted.push(2);
|
||||||
|
await new Promise(r => setTimeout(r, 100));
|
||||||
|
route.fallback();
|
||||||
|
});
|
||||||
|
await context.route('**/empty.html', async route => {
|
||||||
|
intercepted.push(3);
|
||||||
|
await new Promise(r => setTimeout(r, 100));
|
||||||
|
route.fallback();
|
||||||
|
});
|
||||||
|
await page.goto(server.EMPTY_PAGE);
|
||||||
|
expect(intercepted).toEqual([3, 2, 1]);
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,27 @@ it('should fall back', async ({ page, server }) => {
|
||||||
expect(intercepted).toEqual([3, 2, 1]);
|
expect(intercepted).toEqual([3, 2, 1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should fall back async', async ({ page, server }) => {
|
||||||
|
const intercepted = [];
|
||||||
|
await page.route('**/empty.html', async route => {
|
||||||
|
intercepted.push(1);
|
||||||
|
await new Promise(r => setTimeout(r, 100));
|
||||||
|
route.fallback();
|
||||||
|
});
|
||||||
|
await page.route('**/empty.html', async route => {
|
||||||
|
intercepted.push(2);
|
||||||
|
await new Promise(r => setTimeout(r, 100));
|
||||||
|
route.fallback();
|
||||||
|
});
|
||||||
|
await page.route('**/empty.html', async route => {
|
||||||
|
intercepted.push(3);
|
||||||
|
await new Promise(r => setTimeout(r, 100));
|
||||||
|
route.fallback();
|
||||||
|
});
|
||||||
|
await page.goto(server.EMPTY_PAGE);
|
||||||
|
expect(intercepted).toEqual([3, 2, 1]);
|
||||||
|
});
|
||||||
|
|
||||||
it('should not chain fulfill', async ({ page, server }) => {
|
it('should not chain fulfill', async ({ page, server }) => {
|
||||||
let failed = false;
|
let failed = false;
|
||||||
await page.route('**/empty.html', route => {
|
await page.route('**/empty.html', route => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue