Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated waitForNavigation playwright API #1699

Merged
merged 3 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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