Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
tests: async fallback handlers (#15027)
Ross Wollman25bc4c4ac7a1
diff --git a/tests/library/browsercontext-route.spec.ts b/tests/library/browsercontext-route.spec.tsindex 8b7ae35a4e..80e0f7a020 100644--- a/tests/library/browsercontext-route.spec.ts+++ b/tests/library/browsercontext-route.spec.ts@@ -330,3 +330,24 @@ it('should chain fallback into page', async ({ context, page, server }) => {await page.goto(server.EMPTY_PAGE);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]);+});diff --git a/tests/page/page-request-fallback.spec.ts b/tests/page/page-request-fallback.spec.tsindex 9b14617f7e..2e4093c641 100644--- a/tests/page/page-request-fallback.spec.ts+++ b/tests/page/page-request-fallback.spec.ts@@ -40,6 +40,27 @@ it('should fall back', async ({ page, server }) => {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 }) => {let failed = false;await page.route('**/empty.html', route => {