Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ lerna-debug.log*
dist/
dist-ssr/
*.local
*.tsbuildinfo
/vite.config.d.ts
/vite.config.js

# Editor
.vscode/*
Expand Down
28 changes: 14 additions & 14 deletions frontend/e2e/accessibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ test.describe("Accessibility", () => {
});
});

// Navigate to targets, set active, return to chat so input is enabled
await page.getByTitle("Targets").click();
await expect(page.getByText("Target Configuration")).toBeVisible({ timeout: 10000 });
// Navigate to the registry, set active, return to chat so input is enabled
await page.getByTitle("Registry").click();
await expect(page.getByText("Target Registry")).toBeVisible({ timeout: 10000 });
const setActiveBtn = page.getByRole("button", { name: /set active/i });
await expect(setActiveBtn).toBeVisible({ timeout: 5000 });
await setActiveBtn.click();
Expand All @@ -146,8 +146,8 @@ test.describe("Accessibility", () => {
const chatBtn = page.getByTitle("Chat");
await expect(chatBtn).toBeVisible();

// Targets button
const configBtn = page.getByTitle("Targets");
// Registry button
const configBtn = page.getByTitle("Registry");
await expect(configBtn).toBeVisible();

// Theme toggle button (now a menu trigger with "Theme: <mode>" title)
Expand Down Expand Up @@ -219,9 +219,9 @@ test.describe("Accessibility", () => {
});
});

// Navigate to targets, set active, return to chat so input is enabled
await page.getByTitle("Targets").click();
await expect(page.getByText("Target Configuration")).toBeVisible({ timeout: 10000 });
// Navigate to the registry, set active, return to chat so input is enabled
await page.getByTitle("Registry").click();
await expect(page.getByText("Target Registry")).toBeVisible({ timeout: 10000 });
const setActiveBtn = page.getByRole("button", { name: /set active/i });
await expect(setActiveBtn).toBeVisible({ timeout: 5000 });
await setActiveBtn.click();
Expand Down Expand Up @@ -265,9 +265,9 @@ test.describe("Accessibility", () => {
});
});

// Navigate to targets
await page.getByTitle("Targets").click();
await expect(page.getByText("Target Configuration")).toBeVisible();
// Navigate to the registry
await page.getByTitle("Registry").click();
await expect(page.getByText("Target Registry")).toBeVisible();

// Table should exist
const table = page.getByRole("table");
Expand All @@ -289,7 +289,7 @@ test.describe("Accessibility", () => {

const views = [
{ button: "Attack History", heading: "Attack History" },
{ button: "Targets", heading: "Target Configuration" },
{ button: "Registry", heading: "Target Registry" },
{ button: "Chat", heading: "Chat" },
];

Expand Down Expand Up @@ -334,9 +334,9 @@ test.describe("Accessibility", () => {
});
});

await page.getByRole("button", { name: "Targets" }).click();
await page.getByRole("button", { name: "Registry" }).click();
await expect(
page.getByRole("heading", { level: 1, name: "Target Configuration" })
page.getByRole("heading", { level: 1, name: "Target Registry" })
).toBeVisible();
await expect(page.getByRole("button", { name: "Refresh" })).toBeEnabled();
await expectMinimumTouchTarget(page.getByRole("button", { name: "Refresh" }));
Expand Down
14 changes: 7 additions & 7 deletions frontend/e2e/chat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ async function mockBackendAPIs(page: Page) {
});
}

/** Navigate to targets, set the mock target as active, then return to chat. */
/** Navigate to the target registry, set the mock target as active, then return to chat. */
async function activateMockTarget(page: Page) {
// Click Targets button in sidebar
await page.getByTitle("Targets").click();
await expect(page.getByText("Target Configuration")).toBeVisible({ timeout: 10000 });
// Click the Registry button in the sidebar
await page.getByTitle("Registry").click();
await expect(page.getByText("Target Registry")).toBeVisible({ timeout: 10000 });

// Set the mock target active
const setActiveBtn = page.getByRole("button", { name: /set active/i });
Expand Down Expand Up @@ -853,8 +853,8 @@ test.describe("Target type scenarios", () => {
});

await page.goto("/");
await page.getByTitle("Targets").click();
await expect(page.getByText("Target Configuration")).toBeVisible({ timeout: 10000 });
await page.getByTitle("Registry").click();
await expect(page.getByText("Target Registry")).toBeVisible({ timeout: 10000 });

await expect(page.locator("table").getByText("OpenAIChatTarget")).toBeVisible();
await expect(page.locator("table").getByText("OpenAIImageTarget")).toBeVisible();
Expand All @@ -878,7 +878,7 @@ test.describe("Target type scenarios", () => {
});

await page.goto("/");
await page.getByTitle("Targets").click();
await page.getByTitle("Registry").click();
await expect(page.getByText("dall-e-3")).toBeVisible({ timeout: 10000 });

// Activate the DALL-E target (second row)
Expand Down
12 changes: 6 additions & 6 deletions frontend/e2e/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ async function expectWithin(
);
}

/** Navigate to the targets view. */
/** Navigate to the target registry. */
async function goToTargets(page: Page) {
await page.goto("/");
await page.getByTitle("Targets").click();
await expect(page.getByText("Target Configuration")).toBeVisible({ timeout: 10000 });
await page.getByTitle("Registry").click();
await expect(page.getByText("Target Registry")).toBeVisible({ timeout: 10000 });
}

async function selectTargetType(
Expand All @@ -177,7 +177,7 @@ async function selectTargetType(
// Tests
// ---------------------------------------------------------------------------

test.describe("Target Configuration Page", () => {
test.describe("Target Registry Page", () => {
test("should show loading state then target list", async ({ page }) => {
await page.route(/\/api\/targets/, async (route) => {
// Small delay to see spinner
Expand Down Expand Up @@ -422,7 +422,7 @@ test.describe("Create Target Dialog", () => {
});
});

test.describe("Responsive Target Configuration", () => {
test.describe("Responsive Target Registry", () => {
for (const viewport of RESPONSIVE_VIEWPORTS) {
test(`should contain configuration actions at ${viewport.name} width`, async ({
page,
Expand Down Expand Up @@ -552,7 +552,7 @@ test.describe("Target Config ↔ Chat Navigation", () => {
await expect(page.getByTestId("no-target-banner")).toBeVisible();

// Go to targets, set a target
await page.getByTitle("Targets").click();
await page.getByTitle("Registry").click();
await expect(page.getByText("gpt-4o")).toBeVisible({ timeout: 10000 });
await page.getByRole("button", { name: /set active/i }).first().click();

Expand Down
6 changes: 3 additions & 3 deletions frontend/e2e/converters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,10 @@ async function mockBackendAPIs(page: Page) {
});
}

/** Navigate to targets, set the mock target as active, then return to chat. */
/** Navigate to the target registry, set the mock target as active, then return to chat. */
async function activateMockTarget(page: Page) {
await page.getByTitle("Targets").click();
await expect(page.getByText("Target Configuration")).toBeVisible({ timeout: 10000 });
await page.getByTitle("Registry").click();
await expect(page.getByText("Target Registry")).toBeVisible({ timeout: 10000 });

const setActiveBtn = page.getByRole("button", { name: /set active/i });
await expect(setActiveBtn).toBeVisible({ timeout: 5000 });
Expand Down
6 changes: 3 additions & 3 deletions frontend/e2e/errors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ async function mockAllAPIs(
});
}

/** Navigate to targets, set mock target active, return to chat. */
/** Navigate to the target registry, set mock target active, return to chat. */
async function activateMockTarget(page: Page) {
await page.getByTitle("Targets").click();
await expect(page.getByText("Target Configuration")).toBeVisible({
await page.getByTitle("Registry").click();
await expect(page.getByText("Target Registry")).toBeVisible({
timeout: 10000,
});
const setActiveBtn = page.getByRole("button", { name: /set active/i });
Expand Down
6 changes: 3 additions & 3 deletions frontend/e2e/flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,13 @@ async function createConversation(
return body.conversation_id;
}

/** Activate an exact target instance via the Targets view. */
/** Activate an exact target instance through the target registry. */
async function activateTarget(
page: Page,
targetRegistryName: string,
): Promise<void> {
await page.getByTitle("Targets").click();
await expect(page.getByText("Target Configuration")).toBeVisible({ timeout: 10_000 });
await page.getByTitle("Registry").click();
await expect(page.getByText("Target Registry")).toBeVisible({ timeout: 10_000 });
const row = page.getByTestId(`target-row-${targetRegistryName}`);
await expect(row).toBeVisible({ timeout: 10_000 });
const setActiveButton = row.getByRole("button", { name: /set active/i });
Expand Down
4 changes: 2 additions & 2 deletions frontend/e2e/history.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,8 @@ test.describe("Attack History empty state", () => {
await expect(configureTargetButton).toBeFocused();
await configureTargetButton.press("Enter");

await expect(page).toHaveURL(/\/targets$/);
await expect(page.getByRole("heading", { level: 1, name: "Target Configuration" })).toBeVisible();
await expect(page).toHaveURL(/\/registry\/targets$/);
await expect(page.getByRole("heading", { level: 1, name: "Target Registry" })).toBeVisible();

await page.goBack();
await expect(page).toHaveURL(/\/history$/);
Expand Down
22 changes: 11 additions & 11 deletions frontend/e2e/onboarding-tour.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test.describe("Onboarding tour", () => {
await dialog.getByRole("button", { name: "Next", exact: true }).click();

await expect(dialog).toContainText(
"target selection happens in Targets"
"target selection happens in the Target Registry"
);
await expect(dialog).toContainText("choose Configure a target");
await expect(dialog).toContainText("use Set Active there");
Expand All @@ -23,13 +23,13 @@ test.describe("Onboarding tour", () => {
await page
.getByRole("button", { name: "Configure a target", exact: true })
.click();
await expect(page).toHaveURL(/\/targets$/);
await expect(page).toHaveURL(/\/registry\/targets$/);
await expect(
page.getByRole("heading", { name: "Target Configuration" })
page.getByRole("heading", { name: "Target Registry" })
).toBeVisible();
await expect(dialog).toBeVisible();
await expect(dialog).toContainText(
"target selection happens in Targets"
"target selection happens in the Target Registry"
);

await dialog.getByRole("button", { name: "Back", exact: true }).click();
Expand All @@ -42,7 +42,7 @@ test.describe("Onboarding tour", () => {
await page
.getByRole("button", { name: "Configure a target", exact: true })
.click();
await expect(page).toHaveURL(/\/targets$/);
await expect(page).toHaveURL(/\/registry\/targets$/);
await expect(dialog).toBeVisible();

await dialog.getByRole("button", { name: "Next", exact: true }).click();
Expand Down Expand Up @@ -91,10 +91,10 @@ test.describe("Onboarding tour", () => {

await page.goto("/");
await page
.getByRole("button", { name: "Targets", exact: true })
.getByRole("button", { name: "Registry", exact: true })
.click();
await expect(
page.getByRole("heading", { name: "Target Configuration" })
page.getByRole("heading", { name: "Target Registry" })
).toBeVisible();
await page.getByRole("button", { name: "Set Active", exact: true }).click();
await page.getByRole("button", { name: "Home", exact: true }).click();
Expand All @@ -106,15 +106,15 @@ test.describe("Onboarding tour", () => {
await dialog.getByRole("button", { name: "Next", exact: true }).click();

await expect(dialog).toContainText("target currently active for Chat");
await expect(dialog).toContainText("use Set Active in Targets");
await expect(dialog).toContainText("use Set Active in the Target Registry");
await expect(page.locator('[data-tour="target-card"]')).toBeVisible();

await page
.getByRole("button", { name: "Manage targets", exact: true })
.click();
await expect(page).toHaveURL(/\/targets$/);
await expect(page).toHaveURL(/\/registry\/targets$/);
await expect(
page.getByRole("heading", { name: "Target Configuration" })
page.getByRole("heading", { name: "Target Registry" })
).toBeVisible();
await expect(dialog).toBeVisible();
await expect(dialog).toContainText("target currently active for Chat");
Expand Down Expand Up @@ -168,7 +168,7 @@ test.describe("Onboarding tour", () => {
.getByRole("button", { name: "Configure a target", exact: true })
.click();

await expect(page).toHaveURL(/\/targets$/);
await expect(page).toHaveURL(/\/registry\/targets$/);
await expect(dialog).toBeVisible();
await page.getByRole("button", { name: "Set Active", exact: true }).click();
await expect(page.getByText("Active", { exact: true }).first()).toBeVisible();
Expand Down
Loading