9dfa06ffee
Docker image / Build (linux/amd64) (push) Has been cancelled
Docker image / Build (linux/arm64) (push) Has been cancelled
Docker image / Merge release multi-arch manifest (push) Has been cancelled
Docker image / Merge debug multi-arch manifest (push) Has been cancelled
Docker image / Build public push gateway (linux/amd64) (push) Has been cancelled
Docker image / Build public push gateway (linux/arm64) (push) Has been cancelled
Docker image / Publish public push gateway image (push) Has been cancelled
Sprig image / Build (linux/amd64) (push) Has been cancelled
Sprig image / Build (linux/arm64) (push) Has been cancelled
Sprig image / Merge multi-arch manifest (push) Has been cancelled
Harbor Buzz Orchestra / Python tests and lint (push) Has been cancelled
CI / Detect Changed Paths (push) Has been cancelled
CI / Rust Lint (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Desktop Core (push) Has been cancelled
CI / Desktop Smoke E2E (1) (push) Has been cancelled
CI / Desktop Smoke E2E (2) (push) Has been cancelled
CI / Desktop Smoke E2E (3) (push) Has been cancelled
CI / Desktop Smoke E2E (4) (push) Has been cancelled
CI / Desktop (push) Has been cancelled
CI / Desktop E2E Relay (push) Has been cancelled
CI / Desktop E2E Integration (1/2) (push) Has been cancelled
CI / Desktop E2E Integration (2/2) (push) Has been cancelled
CI / Desktop E2E Integration (push) Has been cancelled
CI / Backend Integration (relay e2e) (push) Has been cancelled
CI / Relay E2E (push) Has been cancelled
CI / Web (push) Has been cancelled
CI / Mobile (push) Has been cancelled
CI / Security (push) Has been cancelled
CI / Dead Token Reference Guard (push) Has been cancelled
CI / Server Cross-Compile (aarch64-unknown-linux-musl) (push) Has been cancelled
CI / Server Cross-Compile (x86_64-unknown-linux-musl) (push) Has been cancelled
CI / Windows Rust (x86_64-pc-windows-msvc) (push) Has been cancelled
CI / Desktop Build (macOS) (push) Has been cancelled
helm chart / lint + unittest + render matrix (push) Has been cancelled
helm chart / install on kind (gated) (push) Has been cancelled
helm chart / publish chart to GHCR (push) Has been cancelled
Mesh Lifecycle / Relay-Driven Mesh Lifecycle Smoke (push) Has been cancelled
Sprig / Build (aarch64-unknown-linux-musl) (push) Has been cancelled
Sprig / Build (x86_64-unknown-linux-musl) (push) Has been cancelled
Sprig / Publish rolling release (push) Has been cancelled
Sprig / Publish tagged release (push) Has been cancelled
Signed-off-by: cls_宁波本机 <908705107@qq.com>
213 lines
6.6 KiB
TypeScript
213 lines
6.6 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
import { waitForAnimations } from "../helpers/animations";
|
|
import { installMockBridge, TEST_IDENTITIES } from "../helpers/bridge";
|
|
|
|
const SHOTS = "test-results/edit-agent-run-on";
|
|
|
|
/**
|
|
* The exact persisted shape of a real kubernetes agent created through the
|
|
* app ("Loni" in managed-agents.json, traced by Sami in review): eight keys,
|
|
* `inactivity_seconds` a JSON number, everything else strings, and the
|
|
* optional `service_account` ABSENT — no schema default means the create
|
|
* flow never seeds it, so honest fixtures omit it too.
|
|
*/
|
|
const KUBERNETES_CONFIG = {
|
|
context: "docker-desktop",
|
|
cpu_limit: "1",
|
|
cpu_request: "1",
|
|
image:
|
|
"ghcr.io/block/buzz-sprig:sha-6530b58@sha256:17facfc7608d8ddb33bc056c9aaba1098f4ef6abe5655702fbfd7584d1f74d76",
|
|
inactivity_seconds: 7200,
|
|
memory_limit: "1Gi",
|
|
memory_request: "1Gi",
|
|
namespace: "buzz-agents-gfq7aq",
|
|
};
|
|
|
|
async function openEditDialog(
|
|
page: import("@playwright/test").Page,
|
|
agentName: string,
|
|
) {
|
|
await page.goto("/");
|
|
await page.getByTestId("open-agents-view").click();
|
|
await page
|
|
.getByRole("button", { name: `${agentName} agent profile` })
|
|
.click();
|
|
await page.getByTestId("user-profile-edit-agent").click();
|
|
await expect(page.getByTestId("edit-agent-dialog")).toBeVisible();
|
|
}
|
|
|
|
test("editing a kubernetes agent shows its saved run-on settings", async ({
|
|
page,
|
|
}) => {
|
|
const agent = TEST_IDENTITIES.charlie;
|
|
await installMockBridge(page, {
|
|
managedAgents: [
|
|
{
|
|
pubkey: agent.pubkey,
|
|
name: "Remote Helper",
|
|
status: "running",
|
|
channelNames: ["general"],
|
|
respondTo: "owner-only",
|
|
backend: {
|
|
type: "provider",
|
|
id: "kubernetes",
|
|
config: KUBERNETES_CONFIG,
|
|
},
|
|
},
|
|
],
|
|
});
|
|
await openEditDialog(page, "Remote Helper");
|
|
|
|
const runOn = page.getByTestId("edit-agent-run-on");
|
|
await expect(runOn).toBeVisible();
|
|
await expect(runOn.getByTestId("edit-agent-run-on-location")).toHaveText(
|
|
"kubernetes",
|
|
);
|
|
|
|
// Every saved field renders as a labeled row with its stored value.
|
|
await expect(runOn.getByTestId("edit-agent-run-on-namespace")).toContainText(
|
|
"buzz-agents-gfq7aq",
|
|
);
|
|
await expect(runOn.getByTestId("edit-agent-run-on-context")).toContainText(
|
|
"docker-desktop",
|
|
);
|
|
await expect(runOn.getByTestId("edit-agent-run-on-image")).toContainText(
|
|
"ghcr.io/block/buzz-sprig",
|
|
);
|
|
await expect(
|
|
runOn.getByTestId("edit-agent-run-on-cpu_request"),
|
|
).toContainText("CPU request");
|
|
await expect(
|
|
runOn.getByTestId("edit-agent-run-on-inactivity_seconds"),
|
|
).toContainText("7200");
|
|
// Real records omit the optional service_account (no schema default): the
|
|
// section must show only what was saved, never synthesize a row for it.
|
|
await expect(
|
|
runOn.getByTestId("edit-agent-run-on-service_account"),
|
|
).toHaveCount(0);
|
|
|
|
// The section explains immutability instead of pretending to be a form.
|
|
await expect(runOn).toContainText("can't be changed afterwards");
|
|
|
|
await runOn.scrollIntoViewIfNeeded();
|
|
await waitForAnimations(page);
|
|
await page
|
|
.getByTestId("edit-agent-dialog")
|
|
.screenshot({ path: `${SHOTS}/kubernetes-run-on.png` });
|
|
});
|
|
|
|
test("editing a local agent names this computer, with no config rows", async ({
|
|
page,
|
|
}) => {
|
|
const agent = TEST_IDENTITIES.tyler;
|
|
await installMockBridge(page, {
|
|
managedAgents: [
|
|
{
|
|
pubkey: agent.pubkey,
|
|
name: "Local Helper",
|
|
status: "stopped",
|
|
channelNames: ["general"],
|
|
respondTo: "owner-only",
|
|
backend: { type: "local" },
|
|
},
|
|
],
|
|
});
|
|
await openEditDialog(page, "Local Helper");
|
|
|
|
const runOn = page.getByTestId("edit-agent-run-on");
|
|
await expect(runOn.getByTestId("edit-agent-run-on-location")).toHaveText(
|
|
"This computer",
|
|
);
|
|
await expect(runOn.getByTestId("edit-agent-run-on-namespace")).toHaveCount(0);
|
|
|
|
await runOn.scrollIntoViewIfNeeded();
|
|
await waitForAnimations(page);
|
|
await page
|
|
.getByTestId("edit-agent-dialog")
|
|
.screenshot({ path: `${SHOTS}/local-run-on.png` });
|
|
});
|
|
|
|
test("a blox agent's single saved field renders with a humanized label", async ({
|
|
page,
|
|
}) => {
|
|
// The other real provider shape on developer machines: blox records
|
|
// persist exactly one key, exercising provider-generic humanization.
|
|
const agent = TEST_IDENTITIES.bob;
|
|
await installMockBridge(page, {
|
|
managedAgents: [
|
|
{
|
|
pubkey: agent.pubkey,
|
|
name: "Blox Helper",
|
|
status: "running",
|
|
channelNames: ["general"],
|
|
respondTo: "owner-only",
|
|
backend: {
|
|
type: "provider",
|
|
id: "blox",
|
|
config: { workstation_name: "tlongwell-sprout-home" },
|
|
},
|
|
},
|
|
],
|
|
});
|
|
await openEditDialog(page, "Blox Helper");
|
|
|
|
const runOn = page.getByTestId("edit-agent-run-on");
|
|
await expect(runOn.getByTestId("edit-agent-run-on-location")).toHaveText(
|
|
"blox",
|
|
);
|
|
const row = runOn.getByTestId("edit-agent-run-on-workstation_name");
|
|
await expect(row).toContainText("Workstation name");
|
|
await expect(row).toContainText("tlongwell-sprout-home");
|
|
|
|
await runOn.scrollIntoViewIfNeeded();
|
|
await waitForAnimations(page);
|
|
await page
|
|
.getByTestId("edit-agent-dialog")
|
|
.screenshot({ path: `${SHOTS}/blox-run-on.png` });
|
|
});
|
|
|
|
test("secret-shaped keys from an untrusted provider render redacted", async ({
|
|
page,
|
|
}) => {
|
|
const agent = TEST_IDENTITIES.charlie;
|
|
await installMockBridge(page, {
|
|
managedAgents: [
|
|
{
|
|
pubkey: agent.pubkey,
|
|
name: "Future Provider Agent",
|
|
status: "running",
|
|
channelNames: ["general"],
|
|
respondTo: "owner-only",
|
|
backend: {
|
|
type: "provider",
|
|
id: "some-future-provider",
|
|
config: {
|
|
endpoint: "https://provider.example",
|
|
api_token: "tok-do-not-show",
|
|
},
|
|
},
|
|
},
|
|
],
|
|
});
|
|
await openEditDialog(page, "Future Provider Agent");
|
|
|
|
const runOn = page.getByTestId("edit-agent-run-on");
|
|
await expect(runOn.getByTestId("edit-agent-run-on-endpoint")).toContainText(
|
|
"https://provider.example",
|
|
);
|
|
const tokenRow = runOn.getByTestId("edit-agent-run-on-api_token");
|
|
await expect(tokenRow).toContainText("••••••••");
|
|
await expect(tokenRow).not.toContainText("tok-do-not-show");
|
|
// The raw secret must not appear anywhere in the dialog.
|
|
await expect(page.getByTestId("edit-agent-dialog")).not.toContainText(
|
|
"tok-do-not-show",
|
|
);
|
|
|
|
await runOn.scrollIntoViewIfNeeded();
|
|
await waitForAnimations(page);
|
|
await page
|
|
.getByTestId("edit-agent-dialog")
|
|
.screenshot({ path: `${SHOTS}/redacted-run-on.png` });
|
|
});
|