From af908ff3141b1b926850e1bfdab0b34b1de2f3f2 Mon Sep 17 00:00:00 2001 From: Jan Potoms <2109932+Janpot@users.noreply.github.com> Date: Wed, 22 Feb 2023 15:29:53 +0100 Subject: [PATCH] Remove deprecated waitForNavigation playwright API (#1699) --- test/integration/appTemplates.spec.ts | 6 ------ test/integration/duplication/index.spec.ts | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/integration/appTemplates.spec.ts b/test/integration/appTemplates.spec.ts index 1589f92ab2a..af1e8a0fa4f 100644 --- a/test/integration/appTemplates.spec.ts +++ b/test/integration/appTemplates.spec.ts @@ -7,8 +7,6 @@ test('can use default app template', async ({ page }) => { await homeModel.goto(); const app = await homeModel.createApplication({ appTemplateId: 'default' }); - page.waitForNavigation(); - const runtimeModel = new ToolpadRuntime(page); await runtimeModel.gotoPage(app.id, 'page1'); @@ -21,8 +19,6 @@ test('can use hr template', async ({ page }) => { await homeModel.goto(); const app = await homeModel.createApplication({ appTemplateId: 'hr' }); - page.waitForNavigation(); - const runtimeModel = new ToolpadRuntime(page); await runtimeModel.gotoPage(app.id, 'page1'); @@ -35,8 +31,6 @@ test('can use images app template', async ({ page }) => { await homeModel.goto(); const app = await homeModel.createApplication({ appTemplateId: 'images' }); - page.waitForNavigation(); - const runtimeModel = new ToolpadRuntime(page); await runtimeModel.gotoPage(app.id, 'dogBreedsPage'); diff --git a/test/integration/duplication/index.spec.ts b/test/integration/duplication/index.spec.ts index b48f490bc8a..7c2397ccf93 100644 --- a/test/integration/duplication/index.spec.ts +++ b/test/integration/duplication/index.spec.ts @@ -17,7 +17,9 @@ test('duplication', async ({ page, api }) => { { await editorModel.openHierarchyMenu('connections', 'connection'); const duplicateMenuItem = page.getByRole('menuitem', { name: 'Duplicate' }); - await Promise.all([duplicateMenuItem.click(), page.waitForNavigation()]); + await duplicateMenuItem.click(); + + await page.waitForURL(/\/_toolpad\/app\/[^/]+\/connections\/[^/]+$/); const input = page.getByLabel('base url'); await expect(input).toHaveValue('https://example.com/'); @@ -26,7 +28,7 @@ test('duplication', async ({ page, api }) => { const deleteMenuItem = page.getByRole('menuitem', { name: 'Delete' }); await deleteMenuItem.click(); const deleteButton = editorModel.confirmationDialog.getByRole('button', { name: 'Delete' }); - await Promise.all([deleteButton.click(), page.waitForNavigation()]); + await deleteButton.click(); await expect(editorModel.hierarchyItem('connections', 'connection1')).toBeHidden(); } @@ -34,13 +36,15 @@ test('duplication', async ({ page, api }) => { { await editorModel.openHierarchyMenu('components', 'myComponent'); const duplicateMenuItem = page.getByRole('menuitem', { name: 'Duplicate' }); - await Promise.all([duplicateMenuItem.click(), page.waitForNavigation()]); + await duplicateMenuItem.click(); + + await page.waitForURL(/\/_toolpad\/app\/[^/]+\/codeComponents\/[^/]+$/); await editorModel.openHierarchyMenu('components', 'myComponent1'); const deleteMenuItem = page.getByRole('menuitem', { name: 'Delete' }); await deleteMenuItem.click(); const deleteButton = editorModel.confirmationDialog.getByRole('button', { name: 'Delete' }); - await Promise.all([deleteButton.click(), page.waitForNavigation()]); + await deleteButton.click(); await expect(editorModel.hierarchyItem('components', 'myComponent1')).toBeHidden(); } @@ -48,7 +52,9 @@ test('duplication', async ({ page, api }) => { { await editorModel.openHierarchyMenu('pages', 'page1'); const duplicateMenuItem = page.getByRole('menuitem', { name: 'Duplicate' }); - await Promise.all([duplicateMenuItem.click(), page.waitForNavigation()]); + await duplicateMenuItem.click(); + + await page.waitForURL(/\/_toolpad\/app\/[^/]+\/pages\/[^/]+$/); const button = editorModel.appCanvas.getByRole('button', { name: 'hello world' }); await expect(button).toBeVisible(); @@ -57,7 +63,7 @@ test('duplication', async ({ page, api }) => { const deleteMenuItem = page.getByRole('menuitem', { name: 'Delete' }); await deleteMenuItem.click(); const deleteButton = editorModel.confirmationDialog.getByRole('button', { name: 'Delete' }); - await Promise.all([deleteButton.click(), page.waitForNavigation()]); + await deleteButton.click(); await expect(editorModel.hierarchyItem('pages', 'page2')).toBeHidden(); }