test(e2e): add update and delete content type tests (#22325)

This commit is contained in:
Ben Irvin 2024-12-03 09:07:47 +01:00 committed by GitHub
parent 03640aa70e
commit 555a72384e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 64 additions and 0 deletions

View File

@ -166,4 +166,36 @@ test.describe('Edit collection type', () => {
await expect(page.getByRole('heading', { name: ctName })).toBeVisible();
});
test('Can change type name', async ({ page }) => {
const newname = 'New name';
await page.getByRole('button', { name: 'Edit', exact: true }).click();
await page.getByRole('textbox', { name: 'Display name' }).fill(newname);
await page.getByRole('button', { name: 'Finish', exact: true }).click();
await waitForRestart(page);
// TODO: fix bug that requires a page refresh to see that content types have been updated
await page.reload();
await expect(page.getByRole('heading', { name: newname })).toBeVisible();
});
test('Can delete type', async ({ page }) => {
await page.getByRole('button', { name: 'Edit', exact: true }).click();
// need to accept the browser modal
page.on('dialog', (dialog) => dialog.accept());
await page.getByRole('button', { name: 'Delete', exact: true }).click();
await waitForRestart(page);
// TODO: fix bug that requires a page refresh to see that content types have been updated
await page.reload();
await expect(page.getByRole('heading', { name: ctName })).not.toBeVisible();
});
});

View File

@ -91,4 +91,36 @@ test.describe('Edit single type', () => {
await expect(page.getByRole('heading', { name: ctName })).toBeVisible();
});
test('Can change type name', async ({ page }) => {
const newname = 'New name';
await page.getByRole('button', { name: 'Edit', exact: true }).click();
await page.getByRole('textbox', { name: 'Display name' }).fill(newname);
await page.getByRole('button', { name: 'Finish', exact: true }).click();
await waitForRestart(page);
// TODO: fix bug that requires a page refresh to see that content types have been updated
await page.reload();
await expect(page.getByRole('heading', { name: newname })).toBeVisible();
});
test('Can delete type', async ({ page }) => {
await page.getByRole('button', { name: 'Edit', exact: true }).click();
// need to accept the browser modal
page.on('dialog', (dialog) => dialog.accept());
await page.getByRole('button', { name: 'Delete', exact: true }).click();
await waitForRestart(page);
// TODO: fix bug that requires a page refresh to see that content types have been updated
await page.reload();
await expect(page.getByRole('heading', { name: ctName })).not.toBeVisible();
});
});