feat(ui): add plugin uninstall confirmations (#2886)
This commit is contained in:
@@ -39,6 +39,21 @@ test("mobile plugin row: whole card opens settings, controls still act", async (
|
||||
expect(linkBox.width).toBeGreaterThanOrEqual(rowBox.width - 2);
|
||||
expect(linkBox.height).toBeGreaterThanOrEqual(rowBox.height - 2);
|
||||
|
||||
// Uninstall keeps its confirmation inside the row on a coarse pointer.
|
||||
// Cancel first so the same fixture can cover the existing disable action
|
||||
// and the detail-surface confirmation below.
|
||||
const rowUninstall = pluginRow.getByRole("button", { name: "Uninstall" });
|
||||
expect((await rowUninstall.boundingBox())?.height).toBeGreaterThanOrEqual(44);
|
||||
await rowUninstall.tap();
|
||||
const rowConfirmation = pluginRow.getByTestId("plugin-uninstall-inline-confirmation");
|
||||
await expect(rowConfirmation).toBeVisible();
|
||||
await expect(testPage.locator('[data-slot="dialog-overlay"]')).toHaveCount(0);
|
||||
expect(
|
||||
(await rowConfirmation.getByTestId("plugin-uninstall-confirm").boundingBox())?.height,
|
||||
).toBeGreaterThanOrEqual(44);
|
||||
await rowConfirmation.getByRole("button", { name: "Cancel" }).tap();
|
||||
await expect(rowConfirmation).toHaveCount(0);
|
||||
|
||||
// Every control sits above the overlay. If one slipped below it the tap would
|
||||
// navigate instead of acting, and on a phone there is no hover state to
|
||||
// reveal which is which.
|
||||
@@ -52,5 +67,21 @@ test("mobile plugin row: whole card opens settings, controls still act", async (
|
||||
// change; keep clear of the row's own controls.
|
||||
await pluginRow.tap({ position: { x: 12, y: 12 } });
|
||||
await expect(testPage).toHaveURL(new RegExp(`/settings/plugins/${PLUGIN_ID}$`));
|
||||
await expect(testPage.getByTestId(`plugin-detail-${PLUGIN_ID}`)).toBeVisible();
|
||||
const detail = testPage.getByTestId(`plugin-detail-${PLUGIN_ID}`);
|
||||
await expect(detail).toBeVisible();
|
||||
|
||||
// The detail danger zone uses the same phone-native inline confirmation and
|
||||
// keeps both actions at the 44px touch target minimum.
|
||||
const detailUninstall = detail.getByRole("button", { name: "Uninstall" });
|
||||
expect((await detailUninstall.boundingBox())?.height).toBeGreaterThanOrEqual(44);
|
||||
await detailUninstall.tap();
|
||||
const detailConfirmation = testPage.getByTestId("plugin-uninstall-inline-confirmation");
|
||||
await expect(detailConfirmation).toBeVisible();
|
||||
await expect(testPage.locator('[data-slot="dialog-overlay"]')).toHaveCount(0);
|
||||
expect(
|
||||
(await detailConfirmation.getByTestId("plugin-uninstall-confirm").boundingBox())?.height,
|
||||
).toBeGreaterThanOrEqual(44);
|
||||
await detailConfirmation.getByTestId("plugin-uninstall-confirm").tap();
|
||||
await expect(testPage).toHaveURL(/\/settings\/plugins$/);
|
||||
await expect(testPage.getByTestId(`plugin-row-${PLUGIN_ID}`)).toHaveCount(0);
|
||||
});
|
||||
|
||||
@@ -325,7 +325,9 @@ test.describe("Plugins — gRPC plugin install/load/live-update/uninstall", () =
|
||||
// --- 7. Uninstall via UI (with confirmation): row disappears, package
|
||||
// directory tree is removed from disk. ---
|
||||
await pluginRow.getByRole("button", { name: "Uninstall" }).click();
|
||||
await testPage.getByRole("button", { name: "Confirm uninstall" }).click();
|
||||
await expect(testPage.getByTestId("plugin-uninstall-confirm-popover")).toContainText("E2E");
|
||||
await expect(testPage.locator('[data-slot="dialog-overlay"]')).toHaveCount(0);
|
||||
await testPage.getByTestId("plugin-uninstall-confirm").click();
|
||||
await expect(pluginRow).toHaveCount(0, { timeout: 10_000 });
|
||||
|
||||
const pluginDir = path.join(pluginsDir, PLUGIN_ID);
|
||||
@@ -383,6 +385,37 @@ test.describe("Plugins — gRPC plugin install/load/live-update/uninstall", () =
|
||||
await expect(globalToggle).toHaveAttribute("aria-checked", "false");
|
||||
});
|
||||
|
||||
test("row and detail uninstall confirmations stay local to their initiating controls", async ({
|
||||
testPage,
|
||||
}) => {
|
||||
test.setTimeout(60_000);
|
||||
|
||||
await openInstallDialog(testPage);
|
||||
await uploadPackage(testPage, PACKAGE_PATH);
|
||||
const pluginRow = testPage.getByTestId(`plugin-row-${PLUGIN_ID}`);
|
||||
await expect(pluginRow).toBeVisible({ timeout: 15_000 });
|
||||
|
||||
await pluginRow.getByRole("button", { name: "Uninstall" }).click();
|
||||
const rowConfirmation = testPage.getByTestId("plugin-uninstall-confirm-popover");
|
||||
await expect(rowConfirmation).toContainText("Kandev E2E Fixture Plugin");
|
||||
await expect(testPage.locator('[data-slot="dialog-overlay"]')).toHaveCount(0);
|
||||
await rowConfirmation.getByRole("button", { name: "Cancel" }).click();
|
||||
await expect(rowConfirmation).toHaveCount(0);
|
||||
|
||||
await pluginRow.click({ position: { x: 600, y: 12 } });
|
||||
await expect(testPage).toHaveURL(new RegExp(`/settings/plugins/${PLUGIN_ID}$`));
|
||||
const detail = testPage.getByTestId(`plugin-detail-${PLUGIN_ID}`);
|
||||
await expect(detail).toBeVisible();
|
||||
await detail.getByRole("button", { name: "Uninstall" }).click();
|
||||
|
||||
const detailConfirmation = testPage.getByTestId("plugin-uninstall-confirm-popover");
|
||||
await expect(detailConfirmation).toContainText("Kandev E2E Fixture Plugin");
|
||||
await expect(testPage.locator('[data-slot="dialog-overlay"]')).toHaveCount(0);
|
||||
await testPage.getByTestId("plugin-uninstall-confirm").click();
|
||||
await expect(testPage).toHaveURL(/\/settings\/plugins$/);
|
||||
await expect(testPage.getByTestId(`plugin-row-${PLUGIN_ID}`)).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("shows boot failure diagnostics and retries an errored plugin", async ({
|
||||
testPage,
|
||||
apiClient,
|
||||
@@ -735,6 +768,18 @@ test.describe("Plugins — gRPC plugin install/load/live-update/uninstall", () =
|
||||
{ timeout: 15_000, intervals: [250, 500, 1000] },
|
||||
)
|
||||
.toBe("s3cret-roundtrip");
|
||||
|
||||
// --- Uninstall from the detail danger zone: the confirmation stays at
|
||||
// the initiating control and only successful cleanup returns to the list. ---
|
||||
await testPage.goto(`/settings/plugins/${PLUGIN_ID}`);
|
||||
const detail = testPage.getByTestId(`plugin-detail-${PLUGIN_ID}`);
|
||||
await expect(detail).toBeVisible();
|
||||
await detail.getByRole("button", { name: "Uninstall" }).click();
|
||||
await expect(testPage.getByTestId("plugin-uninstall-confirm-popover")).toContainText("E2E");
|
||||
await expect(testPage.locator('[data-slot="dialog-overlay"]')).toHaveCount(0);
|
||||
await testPage.getByTestId("plugin-uninstall-confirm").click();
|
||||
await expect(testPage).toHaveURL(/\/settings\/plugins$/);
|
||||
await expect(testPage.getByTestId(`plugin-row-${PLUGIN_ID}`)).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("uploading a corrupted package surfaces install-plugin-error", async ({ testPage }) => {
|
||||
|
||||
Reference in New Issue
Block a user