Move certificate export and revoke actions into header
This commit is contained in:
+32
-3
@@ -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\//);
|
||||
|
||||
@@ -29,7 +29,11 @@ test("XCA-style subject alternative name editor", async ({ page }) => {
|
||||
await page.getByRole("link", { name: vaultName }).click();
|
||||
const vaultUrl = page.url();
|
||||
|
||||
const settingsResponse = page.waitForResponse(
|
||||
(response) => response.url().includes("/api/vaults/") && response.url().endsWith("/settings") && response.ok()
|
||||
);
|
||||
await page.goto(`${vaultUrl}/certificates/new`);
|
||||
await settingsResponse;
|
||||
await (await field(page, "Internal name")).fill(certName);
|
||||
await (await field(page, "Common name (CN)")).fill(certName);
|
||||
await page.locator("#new-key").check();
|
||||
|
||||
Reference in New Issue
Block a user