Move certificate export and revoke actions into header

This commit is contained in:
Walter Oggioni
2026-10-27 07:39:00 +08:00
committed by woggioni
parent 73e6a11463
commit 917e0c1d7c
4 changed files with 155 additions and 67 deletions
+32 -3
View File
@@ -101,15 +101,44 @@ test("core PKI workflow", async ({ page }) => {
await page.getByRole("button", { name: "Search" }).click();
await expect(page.getByRole("link", { name: leafName, exact: true })).toBeVisible();
// Revoke
// Certificate header actions replace the Export and Revoke tabs.
await page.getByRole("link", { name: leafName, exact: true }).click();
await page.locator(".nav-tabs").getByRole("tab", { name: "Revoke", exact: true }).click();
await page.getByRole("button", { name: "Revoke certificate" }).click();
const certificateTabs = page.locator(".nav-tabs");
await expect(certificateTabs.getByRole("tab", { name: "Export", exact: true })).toHaveCount(0);
await expect(certificateTabs.getByRole("tab", { name: "Revoke", exact: true })).toHaveCount(0);
const downloadPromise = page.waitForEvent("download");
await page.getByRole("button", { name: "Export", exact: true }).click();
const exportDialog = page.getByRole("dialog", { name: "Export certificate", exact: true });
await expect(exportDialog).toBeVisible();
await exportDialog.getByLabel("Format", { exact: true }).selectOption("pem");
await exportDialog.getByRole("button", { name: "Download", exact: true }).click();
const download = await downloadPromise;
expect(download.suggestedFilename()).toBe(`${leafName}.crt`);
await expect(exportDialog).toHaveCount(0);
await page.getByRole("button", { name: "Actions", exact: true }).click();
await expect(page.getByRole("menuitem", { name: "Renew", exact: true })).toBeVisible();
await expect(page.getByRole("menuitem", { name: "Delete", exact: true })).toBeVisible();
const revokeAction = page.getByRole("menuitem", { name: "Revoke", exact: true });
await expect(revokeAction).toBeEnabled();
await revokeAction.click();
const revokeDialog = page.getByRole("dialog", { name: "Revoke certificate", exact: true });
await expect(revokeDialog).toBeVisible();
await revokeDialog.getByLabel("Reason", { exact: true }).selectOption("keyCompromise");
await revokeDialog.getByRole("button", { name: "Revoke certificate", exact: true }).click();
await expect(revokeDialog).toHaveCount(0);
await expect(page.getByText("revoked", { exact: true })).toBeVisible();
await page.getByRole("button", { name: "Actions", exact: true }).click();
await expect(page.getByRole("menuitem", { name: "Revoke", exact: true })).toBeDisabled();
// CRL from the CA
await page.goto(caUrl);
await expect(page.getByRole("heading", { name: caName })).toBeVisible();
await page.getByRole("button", { name: "Actions", exact: true }).click();
await expect(page.getByRole("menuitem", { name: "Revoke", exact: true })).toBeDisabled();
await page.getByRole("button", { name: "Actions", exact: true }).click();
await page.locator(".nav-tabs").getByRole("tab", { name: "CA", exact: true }).click();
await page.getByRole("button", { name: "Generate CRL" }).click();
await expect(page).toHaveURL(/\/crls\//);