Skip to content

Commit

Permalink
Remove deprecated waitForNavigation playwright API (#1699)
Browse files Browse the repository at this point in the history
  • Loading branch information
Janpot authored Feb 22, 2023
1 parent aa5eccb commit af908ff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 0 additions & 6 deletions test/integration/appTemplates.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -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');

Expand All @@ -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');

Expand Down
18 changes: 12 additions & 6 deletions test/integration/duplication/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/');
Expand All @@ -26,29 +28,33 @@ 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();
}

{
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();
}

{
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();
Expand All @@ -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();
}
Expand Down

0 comments on commit af908ff

Please sign in to comment.