Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+116
-126
@@ -61,23 +61,20 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
skipOrFailWhenE2eFixtureMissing("Plugin settings fixture has no missing capabilities to review");
|
||||
}
|
||||
|
||||
const reviewPanelId = await reviewButton.getAttribute("aria-controls");
|
||||
expect(reviewPanelId).toMatch(/.+/u);
|
||||
// AK-UI-05: the review is a real ~/ui dialog. It is portaled to the body, so
|
||||
// it is scoped from the page, not from the plugin row. The "reviewed" state
|
||||
// lives in React (no hidden input any more) — the approve button's enabled
|
||||
// state IS the observable contract.
|
||||
await expect(reviewButton).toHaveAttribute("aria-haspopup", "dialog");
|
||||
await expect(reviewButton).toHaveAttribute("aria-expanded", "false");
|
||||
await reviewButton.focus();
|
||||
await expect(reviewButton).toBeFocused();
|
||||
await page.keyboard.press("Space");
|
||||
await expect(reviewButton).toHaveAttribute("aria-expanded", "true");
|
||||
|
||||
const reviewRow = reviewButton.locator("xpath=ancestor::li[1]");
|
||||
const reviewForm = reviewRow.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
|
||||
const reviewForm = page.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
|
||||
await expect(reviewForm).toBeVisible();
|
||||
await expect(reviewForm).toHaveAttribute("id", reviewPanelId!);
|
||||
await expect(reviewForm).toHaveAccessibleName(new RegExp(readinessPluginId, "u"));
|
||||
await expect(reviewForm.locator('input[name="id"]')).toHaveValue(/.+/u);
|
||||
await expect(reviewForm.locator('input[name="op"]')).toHaveValue(/^(grant|grantAndEnable)$/u);
|
||||
await expect(reviewForm.locator('input[name="capabilityReviewDigest"]')).toHaveValue(/.+/u);
|
||||
await expect(reviewForm.locator('input[name="capabilitiesReviewed"]')).toHaveValue("no");
|
||||
const approveButton = await firstExistingLocator(reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.button"]').first(), page.getByRole("button", { name: /approve|freigeben/i }).last());
|
||||
await expect(approveButton).toBeDisabled();
|
||||
|
||||
@@ -87,20 +84,14 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
for (let index = 0; index < checkboxCount; index += 1) {
|
||||
await checkboxes.nth(index).check();
|
||||
}
|
||||
await expect(reviewForm.locator('input[name="capabilitiesReviewed"]')).toHaveValue("yes");
|
||||
await expect(approveButton).toBeEnabled();
|
||||
|
||||
await checkboxes.first().uncheck();
|
||||
await expect(reviewForm.locator('input[name="capabilitiesReviewed"]')).toHaveValue("no");
|
||||
await expect(approveButton).toBeDisabled();
|
||||
|
||||
const confirmation = await firstExistingLocator(
|
||||
checkboxes.first(),
|
||||
page.getByLabel(/reviewed the requested plugin capabilities|angeforderten plugin-berechtigungen geprüft/i).first(),
|
||||
);
|
||||
const confirmation = checkboxes.first();
|
||||
await expect(confirmation).toBeVisible();
|
||||
await confirmation.check();
|
||||
await expect(reviewForm.locator('input[name="capabilitiesReviewed"]')).toHaveValue("yes");
|
||||
await expect(approveButton).toBeEnabled();
|
||||
|
||||
await expectNoHorizontalOverflow(page);
|
||||
@@ -135,8 +126,7 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
const submittedPost = await capturePluginPost(page);
|
||||
|
||||
await reviewButton.click();
|
||||
const reviewRow = reviewButton.locator("xpath=ancestor::li[1]");
|
||||
const reviewForm = reviewRow.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
|
||||
const reviewForm = page.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
|
||||
await expect(reviewForm).toBeVisible();
|
||||
|
||||
const checkboxes = reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.checkbox"]:not([disabled])');
|
||||
@@ -151,7 +141,6 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
for (let index = 0; index < checkboxCount; index += 1) {
|
||||
await checkboxes.nth(index).check();
|
||||
}
|
||||
await expect(reviewForm.locator('input[name="capabilitiesReviewed"]')).toHaveValue("yes");
|
||||
await expect(approveButton).toBeEnabled();
|
||||
|
||||
await denyButton.click();
|
||||
@@ -160,10 +149,10 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
await expect(reviewForm).toHaveCount(0);
|
||||
await expect.poll(submittedPost, { message: "capability deny stays non-mutating", timeout: 500 }).toBeNull();
|
||||
|
||||
// Deny drops every tick: re-opening starts from an unreviewed, blocked state.
|
||||
await reviewButton.click();
|
||||
await expect(reviewForm).toBeVisible();
|
||||
await expect(reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.checkbox"]').first()).not.toBeChecked();
|
||||
await expect(reviewForm.locator('input[name="capabilitiesReviewed"]')).toHaveValue("no");
|
||||
await expect(reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.button"]').first()).toBeDisabled();
|
||||
|
||||
await expectNoHorizontalOverflow(page);
|
||||
@@ -187,8 +176,7 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
|
||||
await reviewButton.click();
|
||||
await expect(reviewButton).toHaveAttribute("aria-expanded", "true");
|
||||
const reviewRow = reviewButton.locator("xpath=ancestor::li[1]");
|
||||
const reviewForm = reviewRow.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
|
||||
const reviewForm = page.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
|
||||
await expect(reviewForm).toBeVisible();
|
||||
const approveButton = await firstExistingLocator(
|
||||
reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.button"]').first(),
|
||||
@@ -205,7 +193,6 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
for (let index = 0; index < confirmationCount; index += 1) {
|
||||
await confirmations.nth(index).check();
|
||||
}
|
||||
await expect(reviewForm.locator('input[name="capabilitiesReviewed"]')).toHaveValue("yes");
|
||||
await expect(approveButton).toBeEnabled();
|
||||
|
||||
const expectedPathname = new URL(page.url()).pathname;
|
||||
@@ -226,18 +213,21 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
});
|
||||
|
||||
await approveButton.click();
|
||||
// AK-UI-05: a rejected grant must NOT tear the dialog down. The error is
|
||||
// announced inside the dialog the manager is standing in, and the controls
|
||||
// stay usable so they can retry.
|
||||
const alert = page.getByRole("alert").filter({ hasText: /capability review is stale|berechtigungsprüfung.*veraltet/i });
|
||||
await expect(alert).toBeVisible();
|
||||
await expect(reviewButton).toHaveAttribute("aria-expanded", "true");
|
||||
await expect(alert.first()).toBeVisible();
|
||||
await expect(reviewForm).toBeVisible();
|
||||
await expect(reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.error"]')).toBeVisible();
|
||||
await expect(reviewButton).toHaveAttribute("aria-expanded", "true");
|
||||
await expect(approveButton).toBeEnabled();
|
||||
|
||||
await reviewButton.focus();
|
||||
await expect(reviewButton).toBeFocused();
|
||||
await page.keyboard.press("Enter");
|
||||
// Escape closes the modal (standard dialog semantics); the trigger reopens it.
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(reviewForm).toHaveCount(0);
|
||||
await expect(reviewButton).toHaveAttribute("aria-expanded", "false");
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(reviewButton).toHaveAttribute("aria-expanded", "true");
|
||||
await reviewButton.click();
|
||||
await expect(reviewForm).toBeVisible();
|
||||
});
|
||||
|
||||
@@ -252,7 +242,7 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
const initialState = await snapshotPluginCapabilityState(page, readinessPluginId, "audit");
|
||||
try {
|
||||
let pluginRow = await readinessPluginRow(page);
|
||||
await revokeCapabilityIfGranted(pluginRow, "audit");
|
||||
await revokeCapabilityIfGranted(page, pluginRow, "audit");
|
||||
await page.reload({ waitUntil: "domcontentloaded" });
|
||||
pluginRow = await readinessPluginRow(page);
|
||||
|
||||
@@ -265,10 +255,9 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
}
|
||||
|
||||
await reviewButton.click();
|
||||
const reviewRow = reviewButton.locator("xpath=ancestor::li[1]");
|
||||
const reviewForm = reviewRow.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
|
||||
const reviewForm = page.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
|
||||
await expect(reviewForm).toBeVisible();
|
||||
await expect(reviewForm.locator('input[name="capabilities[]"][value="audit"]')).toHaveCount(1);
|
||||
await expect(reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.checkbox"][data-capability="audit"]')).toHaveCount(1);
|
||||
|
||||
const approveButton = await firstExistingLocator(
|
||||
reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.button"]').first(),
|
||||
@@ -293,20 +282,19 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
// fetch, so the reloaded loader can read stale (pre-grant) state and the
|
||||
// revoke form never appears.
|
||||
pluginRow = await readinessPluginRow(page);
|
||||
await expect(capabilityRevokeForm(pluginRow, "audit")).toBeVisible();
|
||||
await expect(capabilityRevokeTrigger(pluginRow, "audit")).toBeVisible();
|
||||
|
||||
await page.reload({ waitUntil: "domcontentloaded" });
|
||||
pluginRow = await readinessPluginRow(page);
|
||||
const auditRevokeForm = capabilityRevokeForm(pluginRow, "audit");
|
||||
await expect(auditRevokeForm).toBeVisible();
|
||||
await expect(capabilityRevokeTrigger(pluginRow, "audit")).toBeVisible();
|
||||
|
||||
await auditRevokeForm.locator('[data-ui-id="ui.plugins.capability.revoke.button"]').click();
|
||||
// Same race on revoke: let the revalidation drop the revoke form before the
|
||||
// explicit reload re-asserts persistence.
|
||||
await expect(capabilityRevokeForm(await readinessPluginRow(page), "audit")).toHaveCount(0);
|
||||
await confirmCapabilityRevoke(page, pluginRow, "audit");
|
||||
// Same race on revoke: let the revalidation drop the revoke trigger before
|
||||
// the explicit reload re-asserts persistence.
|
||||
await expect(capabilityRevokeTrigger(await readinessPluginRow(page), "audit")).toHaveCount(0);
|
||||
await page.reload({ waitUntil: "domcontentloaded" });
|
||||
pluginRow = await readinessPluginRow(page);
|
||||
await expect(capabilityRevokeForm(pluginRow, "audit")).toHaveCount(0);
|
||||
await expect(capabilityRevokeTrigger(pluginRow, "audit")).toHaveCount(0);
|
||||
|
||||
const restoredReviewButton = await firstExistingLocator(
|
||||
pluginRow.locator('[data-ui-id="ui.plugins.capabilityReview.toggle"]').first(),
|
||||
@@ -343,7 +331,7 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
await expect(manifestButton).toHaveAttribute("aria-expanded", "false");
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(manifestButton).toHaveAttribute("aria-expanded", "true");
|
||||
const manifestRow = manifestButton.locator("xpath=ancestor::li[1]");
|
||||
const manifestRow = manifestButton.locator('xpath=ancestor::*[@data-ui-id="ui.plugins.item"][1]');
|
||||
const manifestPanel = await firstExistingLocator(manifestRow.locator('[data-ui-id="ui.plugins.manifest.panel"]').first(), pluginRow.locator(`[id="${manifestPanelId}"]`).first());
|
||||
await expect(manifestPanel).toBeVisible();
|
||||
await expect(manifestPanel).toContainText(readinessPluginId);
|
||||
@@ -360,33 +348,25 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
await skipIfUnavailable(page, response, "Plugin settings lifecycle path");
|
||||
|
||||
const pluginRow = await readinessPluginRow(page);
|
||||
const lifecycleForm = pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.form"]').first();
|
||||
if ((await lifecycleForm.count()) === 0 || !(await lifecycleForm.isVisible())) {
|
||||
const lifecycleControl = lifecycleButton(pluginRow);
|
||||
if ((await lifecycleControl.count()) === 0 || !(await lifecycleControl.isVisible())) {
|
||||
skipOrFailWhenE2eFixtureMissing("Plugin fixture has no manageable lifecycle controls");
|
||||
}
|
||||
|
||||
const lifecycleButton = lifecycleForm.locator('[data-ui-id="ui.plugins.lifecycle.button"]').first();
|
||||
const form = lifecycleForm;
|
||||
await expect(form).toHaveCount(1);
|
||||
await expect(form.locator('input[name="id"]')).toHaveValue(/.+/u);
|
||||
await expect(form.locator('input[name="op"]')).toHaveValue(/^(enable|disable)$/u);
|
||||
const csrf = form.locator('input[name="csrf"]');
|
||||
if ((await csrf.count()) > 0) {
|
||||
await expect(csrf).toHaveValue(/.+/u);
|
||||
}
|
||||
// AK-UI-05: there is no hidden-input form any more. The wire contract is now
|
||||
// only observable on the POST body — which is exactly what it always was.
|
||||
await expect(lifecycleControl).toHaveAttribute("data-op", /^(enable|disable)$/u);
|
||||
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
|
||||
const submittedPost = await capturePluginPost(page);
|
||||
await lifecycleButton.click();
|
||||
await lifecycleControl.click();
|
||||
await expect.poll(submittedPost, { message: "lifecycle POST payload was captured" }).not.toBeNull();
|
||||
const postData = submittedPost()?.postData ?? null;
|
||||
expect(postDataIncludesField(postData, "id", /.+/u)).toBe(true);
|
||||
expect(postDataIncludesField(postData, "op", /^(enable|disable)$/u)).toBe(true);
|
||||
if ((await csrf.count()) > 0) {
|
||||
expect(postDataIncludesField(postData, "csrf", /.+/u)).toBe(true);
|
||||
}
|
||||
expect(postDataIncludesField(postData, "csrf", /.+/u)).toBe(true);
|
||||
});
|
||||
|
||||
test("lifecycle errors stay announced and keep controls retryable", async ({ page }) => {
|
||||
@@ -396,13 +376,12 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
await skipIfUnavailable(page, response, "Plugin settings lifecycle error path");
|
||||
|
||||
const pluginRow = await readinessPluginRow(page);
|
||||
const lifecycleForm = pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.form"]').first();
|
||||
if ((await lifecycleForm.count()) === 0 || !(await lifecycleForm.isVisible())) {
|
||||
const lifecycleControl = lifecycleButton(pluginRow);
|
||||
if ((await lifecycleControl.count()) === 0 || !(await lifecycleControl.isVisible())) {
|
||||
skipOrFailWhenE2eFixtureMissing("Plugin fixture has no manageable lifecycle controls");
|
||||
}
|
||||
|
||||
const lifecycleButton = lifecycleForm.locator('[data-ui-id="ui.plugins.lifecycle.button"]').first();
|
||||
const initialOperation = await lifecycleForm.locator('input[name="op"]').inputValue();
|
||||
const initialOperation = await lifecycleControl.getAttribute("data-op");
|
||||
expect(initialOperation).toMatch(/^(enable|disable)$/u);
|
||||
|
||||
const expectedPathname = new URL(page.url()).pathname;
|
||||
@@ -424,17 +403,19 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
await route.continue();
|
||||
});
|
||||
|
||||
await lifecycleButton.focus();
|
||||
await expect(lifecycleButton).toBeFocused();
|
||||
await lifecycleControl.focus();
|
||||
await expect(lifecycleControl).toBeFocused();
|
||||
await page.keyboard.press("Enter");
|
||||
|
||||
const alert = page.getByRole("alert").filter({ hasText: /plugin lifecycle temporarily unavailable/i });
|
||||
await expect(alert).toBeVisible();
|
||||
await expect(alert.first()).toBeVisible();
|
||||
await expect.poll(() => attempts, { message: "lifecycle error POST was intercepted" }).toBe(1);
|
||||
await expect(lifecycleForm.locator('input[name="op"]')).toHaveValue(initialOperation);
|
||||
await expect(lifecycleButton).toBeEnabled();
|
||||
await lifecycleButton.focus();
|
||||
await expect(lifecycleButton).toBeFocused();
|
||||
// The rejected mutation left the plugin state untouched, so the control still
|
||||
// offers the same operation and stays retryable.
|
||||
await expect(lifecycleControl).toHaveAttribute("data-op", initialOperation!);
|
||||
await expect(lifecycleControl).toBeEnabled();
|
||||
await lifecycleControl.focus();
|
||||
await expect(lifecycleControl).toBeFocused();
|
||||
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
@@ -449,31 +430,30 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
await skipIfUnavailable(page, response, "Plugin settings persisted lifecycle path");
|
||||
|
||||
const pluginRow = await pluginRowById(page, lifecyclePluginId);
|
||||
const lifecycleForm = pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.form"]').first();
|
||||
if ((await lifecycleForm.count()) === 0 || !(await lifecycleForm.isVisible())) {
|
||||
const lifecycleControl = lifecycleButton(pluginRow);
|
||||
if ((await lifecycleControl.count()) === 0 || !(await lifecycleControl.isVisible())) {
|
||||
skipOrFailWhenE2eFixtureMissing("Lifecycle plugin fixture has no manageable lifecycle controls");
|
||||
}
|
||||
|
||||
const initialState = await snapshotPluginLifecycleState(page, lifecyclePluginId);
|
||||
try {
|
||||
await expect(lifecycleForm.locator('input[name="op"]')).toHaveValue("disable");
|
||||
await expect(lifecycleControl).toHaveAttribute("data-op", "disable");
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
|
||||
await lifecycleForm.locator('[data-ui-id="ui.plugins.lifecycle.button"]').click();
|
||||
await expect(pluginRow.locator('input[name="op"]').first()).toHaveValue("enable");
|
||||
await lifecycleControl.click();
|
||||
await expect(lifecycleButton(pluginRow)).toHaveAttribute("data-op", "enable");
|
||||
|
||||
await page.reload({ waitUntil: "domcontentloaded" });
|
||||
const disabledPluginRow = await pluginRowById(page, lifecyclePluginId);
|
||||
await expect(disabledPluginRow.locator('input[name="op"]').first()).toHaveValue("enable");
|
||||
await expect(lifecycleButton(disabledPluginRow)).toHaveAttribute("data-op", "enable");
|
||||
|
||||
const enableForm = disabledPluginRow.locator('[data-ui-id="ui.plugins.lifecycle.form"]').first();
|
||||
await enableForm.locator('[data-ui-id="ui.plugins.lifecycle.button"]').click();
|
||||
await expect(disabledPluginRow.locator('input[name="op"]').first()).toHaveValue("disable");
|
||||
await lifecycleButton(disabledPluginRow).click();
|
||||
await expect(lifecycleButton(disabledPluginRow)).toHaveAttribute("data-op", "disable");
|
||||
|
||||
await page.reload({ waitUntil: "domcontentloaded" });
|
||||
const enabledPluginRow = await pluginRowById(page, lifecyclePluginId);
|
||||
await expect(enabledPluginRow.locator('input[name="op"]').first()).toHaveValue("disable");
|
||||
await expect(lifecycleButton(enabledPluginRow)).toHaveAttribute("data-op", "disable");
|
||||
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
@@ -492,7 +472,7 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
const settingsLink = pluginRow.locator('[data-ui-id="ui.plugins.settings.open"]').first();
|
||||
if ((await settingsLink.count()) > 0 && (await settingsLink.isVisible())) {
|
||||
await settingsLink.click();
|
||||
await expect(page).toHaveURL(/\/settings\/plugins\/[^/?#]+(?:[?#].*)?$/u);
|
||||
await expect(page).toHaveURL(/\/settings\/integrations\/plugins\/[^/?#]+(?:[?#].*)?$/u);
|
||||
}
|
||||
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.settings.page"]').first()).toBeVisible();
|
||||
@@ -659,42 +639,39 @@ test.describe("plugin settings mobile a11y", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("capability revoke controls expose a non-mutating form contract", async ({ page }) => {
|
||||
test("capability revoke confirms in a dialog and keeps the revoke wire contract", async ({ page }) => {
|
||||
await loginAsTenantUser(page, credentials!);
|
||||
|
||||
const response = await page.goto(pluginSettingsPath!, { waitUntil: "domcontentloaded" });
|
||||
await skipIfUnavailable(page, response, "Plugin settings revoke path");
|
||||
|
||||
const pluginRow = await readinessPluginRow(page);
|
||||
const form = pluginRow.locator('[data-ui-id="ui.plugins.capability.revoke.form"]').first();
|
||||
if ((await form.count()) === 0 || !(await form.isVisible())) {
|
||||
const trigger = pluginRow.locator('[data-ui-id="ui.plugins.capability.revoke.button"]').first();
|
||||
if ((await trigger.count()) === 0 || !(await trigger.isVisible())) {
|
||||
skipOrFailWhenE2eFixtureMissing("Plugin fixture has no granted capability revoke controls");
|
||||
}
|
||||
|
||||
await expect(form.locator('input[name="id"]')).toHaveValue(/.+/u);
|
||||
await expect(form.locator('input[name="pluginId"]')).toHaveValue(readinessPluginId);
|
||||
await expect(form.locator('input[name="op"]')).toHaveValue("revoke");
|
||||
await expect(form.locator('input[name="capabilityNames[]"]')).toHaveValue(/.+/u);
|
||||
await expect(form.locator('[data-ui-id="ui.plugins.capability.revoke.button"]')).toBeVisible();
|
||||
const csrf = form.locator('input[name="csrf"]');
|
||||
if ((await csrf.count()) > 0) {
|
||||
await expect(csrf).toHaveValue(/.+/u);
|
||||
}
|
||||
await expect(trigger).toHaveAttribute("data-capability", /.+/u);
|
||||
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
|
||||
// AK-UI-05: revoking disables the plugin, so it is gated behind a destructive
|
||||
// confirm dialog. Opening it must not mutate anything.
|
||||
const submittedPost = await capturePluginPost(page);
|
||||
await form.locator('[data-ui-id="ui.plugins.capability.revoke.button"]').click();
|
||||
await trigger.click();
|
||||
const dialog = page.locator('[data-ui-id="ui.plugins.capability.revoke.form"]').first();
|
||||
await expect(dialog).toBeVisible();
|
||||
await expect.poll(submittedPost, { message: "opening the revoke dialog stays non-mutating", timeout: 500 }).toBeNull();
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
|
||||
await dialog.locator('[data-ui-id="ui.plugins.capability.revoke.confirm"]').click();
|
||||
await expect.poll(submittedPost, { message: "capability revoke POST payload was captured" }).not.toBeNull();
|
||||
const postData = submittedPost()?.postData ?? null;
|
||||
expect(postDataIncludesField(postData, "id", /.+/u)).toBe(true);
|
||||
expect(postDataIncludesField(postData, "pluginId", new RegExp(`^${escapeRegExp(readinessPluginId)}$`, "u"))).toBe(true);
|
||||
expect(postDataIncludesField(postData, "op", /^revoke$/u)).toBe(true);
|
||||
expect(postDataIncludesField(postData, "capabilityNames[]", /.+/u)).toBe(true);
|
||||
if ((await csrf.count()) > 0) {
|
||||
expect(postDataIncludesField(postData, "csrf", /.+/u)).toBe(true);
|
||||
}
|
||||
expect(postDataIncludesField(postData, "csrf", /.+/u)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -719,8 +696,8 @@ test.describe("plugin settings read-only permissions", () => {
|
||||
await expect(pluginRow).toBeVisible();
|
||||
await expect(pluginRow.locator('[data-ui-id="ui.plugins.manifest.toggle"]').first()).toBeVisible();
|
||||
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.lifecycle.form"]')).toHaveCount(0);
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.capability.revoke.form"]')).toHaveCount(0);
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.lifecycle.button"]')).toHaveCount(0);
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.capability.revoke.button"]')).toHaveCount(0);
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.capabilityReview.toggle"]')).toHaveCount(0);
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.capabilityReview.form"]')).toHaveCount(0);
|
||||
|
||||
@@ -755,7 +732,7 @@ test.describe("plugin settings read-only permissions", () => {
|
||||
|
||||
const manifestPanelId = await manifestButton.getAttribute("aria-controls");
|
||||
expect(manifestPanelId).toMatch(/.+/u);
|
||||
const manifestRow = manifestButton.locator("xpath=ancestor::li[1]");
|
||||
const manifestRow = manifestButton.locator('xpath=ancestor::*[@data-ui-id="ui.plugins.item"][1]');
|
||||
const manifestPanel = await firstExistingLocator(
|
||||
manifestRow.locator('[data-ui-id="ui.plugins.manifest.panel"]').first(),
|
||||
pluginRow.locator(`[id="${manifestPanelId}"]`).first()
|
||||
@@ -763,8 +740,8 @@ test.describe("plugin settings read-only permissions", () => {
|
||||
await expect(manifestPanel).toBeVisible();
|
||||
await expect(manifestPanel).toContainText(readinessPluginId);
|
||||
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.lifecycle.form"]')).toHaveCount(0);
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.capability.revoke.form"]')).toHaveCount(0);
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.lifecycle.button"]')).toHaveCount(0);
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.capability.revoke.button"]')).toHaveCount(0);
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.capabilityReview.toggle"]')).toHaveCount(0);
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.capabilityReview.form"]')).toHaveCount(0);
|
||||
await expect.poll(submittedPost, { message: "manifest disclosure stays non-mutating", timeout: 500 }).toBeNull();
|
||||
@@ -781,7 +758,7 @@ test.describe("plugin settings read-only permissions", () => {
|
||||
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.page"]').first()).toBeVisible();
|
||||
await expect(await readinessPluginRow(page)).toBeVisible();
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.lifecycle.form"]')).toHaveCount(0);
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.lifecycle.button"]')).toHaveCount(0);
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.capabilityReview.form"]')).toHaveCount(0);
|
||||
|
||||
const expectedRedirectPath = new URL(page.url()).pathname;
|
||||
@@ -896,7 +873,7 @@ async function openReadinessPluginSettingsFrame(page: Page, reason: string): Pro
|
||||
skipOrFailWhenE2eFixtureMissing(`${reason}: plugin fixture has no settings link`);
|
||||
}
|
||||
await settingsLink.click();
|
||||
await expect(page).toHaveURL(/\/settings\/plugins\/[^/?#]+(?:[?#].*)?$/u);
|
||||
await expect(page).toHaveURL(/\/settings\/integrations\/plugins\/[^/?#]+(?:[?#].*)?$/u);
|
||||
}
|
||||
|
||||
await expect(page.locator('[data-ui-id="ui.plugins.settings.page"]').first()).toBeVisible();
|
||||
@@ -1006,7 +983,7 @@ async function restorePluginCapabilityState(page: Page, state: PluginCapabilityS
|
||||
const row = await pluginRowById(page, state.pluginId);
|
||||
const granted = await isCapabilityGranted(row, state.capabilityName);
|
||||
if (granted && !state.granted) {
|
||||
await revokeCapabilityIfGranted(row, state.capabilityName);
|
||||
await revokeCapabilityIfGranted(page, row, state.capabilityName);
|
||||
await page.reload({ waitUntil: "domcontentloaded" });
|
||||
} else if (!granted && state.granted) {
|
||||
await grantMissingCapabilities(page, row);
|
||||
@@ -1049,39 +1026,53 @@ async function ensurePluginEnabledState(page: Page, pluginId: string, enabled: b
|
||||
throw new Error(`Unable to restore ${pluginId} lifecycle state because lifecycle controls are unavailable`);
|
||||
}
|
||||
|
||||
const form = row.locator('[data-ui-id="ui.plugins.lifecycle.form"]').first();
|
||||
await form.locator('[data-ui-id="ui.plugins.lifecycle.button"]').click();
|
||||
await expect(row.locator('input[name="op"]').first()).toHaveValue(enabled ? "disable" : "enable");
|
||||
// AK-UI-05: the lifecycle control is a ~/ui button carrying its op, not a
|
||||
// hidden form input. A plugin that is enabled offers "disable" and vice versa.
|
||||
await row.locator('[data-ui-id="ui.plugins.lifecycle.button"]').first().click();
|
||||
await expect(lifecycleButton(row)).toHaveAttribute("data-op", enabled ? "disable" : "enable");
|
||||
await page.reload({ waitUntil: "domcontentloaded" });
|
||||
await expect((await pluginRowById(page, pluginId)).locator('input[name="op"]').first()).toHaveValue(enabled ? "disable" : "enable");
|
||||
await expect(lifecycleButton(await pluginRowById(page, pluginId))).toHaveAttribute("data-op", enabled ? "disable" : "enable");
|
||||
}
|
||||
|
||||
function lifecycleButton(pluginRow: Locator): Locator {
|
||||
return pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.button"]').first();
|
||||
}
|
||||
|
||||
async function getPluginLifecycleOperation(pluginRow: Locator): Promise<"enable" | "disable" | null> {
|
||||
const op = pluginRow.locator('[data-ui-id="ui.plugins.lifecycle.form"] input[name="op"]').first();
|
||||
if ((await op.count()) === 0) return null;
|
||||
const value = await op.inputValue();
|
||||
const button = lifecycleButton(pluginRow);
|
||||
if ((await button.count()) === 0) return null;
|
||||
const value = await button.getAttribute("data-op");
|
||||
return value === "enable" || value === "disable" ? value : null;
|
||||
}
|
||||
|
||||
function capabilityRevokeForm(pluginRow: Locator, capabilityName: string): Locator {
|
||||
return pluginRow
|
||||
.locator(
|
||||
`[data-ui-id="ui.plugins.capability.revoke.form"]:has(input[name="capabilityNames[]"][value="${capabilityName}"])`
|
||||
)
|
||||
.first();
|
||||
/**
|
||||
* AK-UI-05: revoking is no longer an inline <Form> but a per-capability trigger
|
||||
* that opens a destructive confirm dialog. The trigger only exists while the
|
||||
* capability is granted, so its presence still IS the "granted" signal.
|
||||
*/
|
||||
function capabilityRevokeTrigger(pluginRow: Locator, capabilityName: string): Locator {
|
||||
return pluginRow.locator(`[data-ui-id="ui.plugins.capability.revoke.button"][data-capability="${capabilityName}"]`).first();
|
||||
}
|
||||
|
||||
async function revokeCapabilityIfGranted(pluginRow: Locator, capabilityName: string): Promise<void> {
|
||||
const form = capabilityRevokeForm(pluginRow, capabilityName);
|
||||
if ((await form.count()) === 0 || !(await form.isVisible())) {
|
||||
/** Clicks the revoke trigger and confirms in the ~/ui dialog it opens. */
|
||||
async function confirmCapabilityRevoke(page: Page, pluginRow: Locator, capabilityName: string): Promise<void> {
|
||||
await capabilityRevokeTrigger(pluginRow, capabilityName).click();
|
||||
const dialog = page.locator('[data-ui-id="ui.plugins.capability.revoke.form"]').first();
|
||||
await expect(dialog).toBeVisible();
|
||||
await dialog.locator('[data-ui-id="ui.plugins.capability.revoke.confirm"]').click();
|
||||
}
|
||||
|
||||
async function revokeCapabilityIfGranted(page: Page, pluginRow: Locator, capabilityName: string): Promise<void> {
|
||||
const trigger = capabilityRevokeTrigger(pluginRow, capabilityName);
|
||||
if ((await trigger.count()) === 0 || !(await trigger.isVisible())) {
|
||||
return;
|
||||
}
|
||||
await form.locator('[data-ui-id="ui.plugins.capability.revoke.button"]').click();
|
||||
await confirmCapabilityRevoke(page, pluginRow, capabilityName);
|
||||
}
|
||||
|
||||
async function isCapabilityGranted(pluginRow: Locator, capabilityName: string): Promise<boolean> {
|
||||
const form = capabilityRevokeForm(pluginRow, capabilityName);
|
||||
return (await form.count()) > 0 && (await form.isVisible());
|
||||
const trigger = capabilityRevokeTrigger(pluginRow, capabilityName);
|
||||
return (await trigger.count()) > 0 && (await trigger.isVisible());
|
||||
}
|
||||
|
||||
async function grantMissingCapabilities(page: Page, pluginRow: Locator): Promise<void> {
|
||||
@@ -1094,8 +1085,7 @@ async function grantMissingCapabilities(page: Page, pluginRow: Locator): Promise
|
||||
}
|
||||
|
||||
await reviewButton.click();
|
||||
const reviewRow = reviewButton.locator("xpath=ancestor::li[1]");
|
||||
const reviewForm = reviewRow.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
|
||||
const reviewForm = page.locator('[data-ui-id="ui.plugins.capabilityReview.form"]').first();
|
||||
await expect(reviewForm).toBeVisible();
|
||||
const checkboxes = reviewForm.locator('[data-ui-id="ui.plugins.capabilityReview.checkbox"]:not([disabled])');
|
||||
const checkboxCount = await checkboxes.count();
|
||||
|
||||
Reference in new issue
Block a user