diff --git a/apps/smart-ssh-community/frontend/e2e/support/connecting.ts b/apps/smart-ssh-community/frontend/e2e/support/connecting.ts index df20c63d9..d7a3bd742 100644 --- a/apps/smart-ssh-community/frontend/e2e/support/connecting.ts +++ b/apps/smart-ssh-community/frontend/e2e/support/connecting.ts @@ -8,8 +8,9 @@ export function snapshotStep( status: ConnectStepSnapshot["status"], detail: ConnectStepSnapshot["detail"] = null, errorCode: string | null = null, + durationMs: number | null = null, ): ConnectStepSnapshot { - return { kind, hopIndex: 0, hop: "deploy@h.example.test:22", status, errorCode, detail }; + return { kind, hopIndex: 0, hop: "deploy@h.example.test:22", status, errorCode, detail, durationMs }; } /** The attempt id of the latest `connect` call, once it was made. */ diff --git a/apps/smart-ssh-community/frontend/e2e/tests/accessibility.spec.ts b/apps/smart-ssh-community/frontend/e2e/tests/accessibility.spec.ts index f87336d45..d3a62f582 100644 --- a/apps/smart-ssh-community/frontend/e2e/tests/accessibility.spec.ts +++ b/apps/smart-ssh-community/frontend/e2e/tests/accessibility.spec.ts @@ -58,6 +58,28 @@ const SCREENS: Record Promise> = { await app.page.getByRole("button", { name: /^alpha\b/ }).click(); await expect(app.page.getByRole("alertdialog")).toBeVisible(); }, + "auth prompt": async (app) => { + await app.launch({ settings: { ...ACKNOWLEDGED }, servers: [server({ id: "s-1", name: "alpha" })] }); + await app.emit("auth-prompt-needed", { + promptId: "p1", + connectId: "c1", + hop: "root@alpha:22", + kind: "keyboard_interactive", + name: "Two factor", + instructions: "Enter your token", + prompts: [{ text: "Verification code:", echo: true }], + }); + await expect(app.page.getByRole("dialog", { name: /root@alpha/ })).toBeVisible(); + }, + "feature locked dialog": async (app) => { + await app.launch({ + settings: { ...ACKNOWLEDGED }, + servers: [server({ id: "s-1", name: "alpha" })], + commands: { connect: { error: { message: "Locked", code: null, feature_locked: { feature: "document_export", tier: "free" } } } }, + }); + await app.page.getByRole("button", { name: /^alpha\b/ }).click(); + await expect(app.page.getByRole("dialog")).toBeVisible(); + }, "connecting tab": async (app) => { await app.launch({ settings: { ...ACKNOWLEDGED }, diff --git a/apps/smart-ssh-community/frontend/e2e/tests/connect-dialogs-screenshots.spec.ts b/apps/smart-ssh-community/frontend/e2e/tests/connect-dialogs-screenshots.spec.ts new file mode 100644 index 000000000..a4108dac1 --- /dev/null +++ b/apps/smart-ssh-community/frontend/e2e/tests/connect-dialogs-screenshots.spec.ts @@ -0,0 +1,84 @@ +// Review screenshots for the connect dialogs and panels (issue #1384): +// SCREENSHOT_LABEL=before|after, SCREENSHOT_SCHEME=dark for the dark theme. +import { expect, test, type AppDriver } from "../support/app"; +import { emitProgress, snapshotStep } from "../support/connecting"; +import { ACKNOWLEDGED, failingStepLog, populated, server } from "../support/data"; +import { captureCurrent } from "../support/screenshots"; + +const scheme = process.env.SCREENSHOT_SCHEME === "dark" ? "dark" : "light"; +const base = () => ({ settings: { ...ACKNOWLEDGED }, servers: [server({ id: "s-1", name: "alpha" })] }); +const connect = (app: AppDriver) => app.page.getByRole("button", { name: /^alpha\b/ }).click(); + +const SCREENS: Record Promise> = { + "hostkey-unknown": async (app) => { + await app.launch({ ...base(), hostKeys: { "s-1": { kind: "unknown", fingerprint: "SHA256:abc", keyType: "ssh-ed25519" } } }); + await connect(app); + await expect(app.page.getByRole("dialog")).toBeVisible(); + }, + "hostkey-mismatch": async (app) => { + await app.launch({ ...base(), hostKeys: { "s-1": { kind: "mismatch", fingerprint: "SHA256:new", expectedFingerprint: "SHA256:old", keyType: "ssh-ed25519" } } }); + await connect(app); + await expect(app.page.getByRole("alertdialog")).toBeVisible(); + }, + "auth-prompt": async (app) => { + await app.launch(base()); + await app.emit("auth-prompt-needed", { + promptId: "p1", connectId: "c1", hop: "root@alpha:22", kind: "keyboard_interactive", + name: "Two factor", instructions: "Enter your token", prompts: [{ text: "Verification code:", echo: true }], + }); + await expect(app.page.getByRole("dialog", { name: /root@alpha/ })).toBeVisible(); + }, + "feature-locked": async (app) => { + await app.launch({ ...base(), commands: { connect: { error: { message: "Locked", code: null, feature_locked: { feature: "document_export", tier: "free" } } } } }); + await connect(app); + await expect(app.page.getByRole("dialog")).toBeVisible(); + }, + "connecting-running": async (app) => { + await app.launch({ ...base(), commands: { connect: { hold: true } } }); + await connect(app); + await emitProgress(app, [ + snapshotStep("dnsResolution", "ok", null, null, 3), + snapshotStep("tcpConnect", "ok", null, null, 12), + snapshotStep("hostKeyCheck", "warning", null, null, 1), + snapshotStep("handshake", "running", { code: "waitingForResponse" }), + ]); + await expect(app.page.getByTestId("connect-progress-list")).toBeVisible(); + }, + "connect-failed": async (app) => { + await app.launch({ ...base(), commands: { connect: { hold: true } } }); + await connect(app); + await emitProgress(app, [snapshotStep("authentication", "failed", { code: "authMethod", method: "password" }, "SSH_AUTH_FAILED")]); + await app.release("connect", { error: { message: "Authentication failed", code: "SSH_AUTH_FAILED", connect_log: failingStepLog(2) } }); + const log = app.page.getByTestId("connect-step-log"); + if ((await log.getAttribute("open")) === null) await log.locator("summary").click(); + await expect(log.locator("[data-failed='true']")).toBeVisible(); + }, + "unusable-server": async (app) => { + await app.launch({ + ...populated(), + commands: { list_unusable_servers: { result: [{ id: "u-1", name: "legacy-box", host: "legacy.example.test", groupId: null, reason: "unknown_auth_method" }] } }, + }); + await app.page.getByRole("button", { name: "Manage", exact: true }).click(); + await app.page.getByRole("treeitem", { name: /legacy-box/ }).click(); + await expect(app.page.getByRole("button", { name: /Delete/ }).first()).toBeVisible(); + }, + toast: async (app) => { + await app.launch({ + ...base(), + hostKeys: { "s-1": { kind: "unknown", fingerprint: "SHA256:abc", keyType: "ssh-ed25519" } }, + commands: { confirm_host_key: { error: { message: "Could not save the key", code: null } } }, + }); + await connect(app); + await app.page.getByRole("button", { name: "Trust", exact: true }).click(); + await expect(app.page.getByText("Could not save the key")).toBeVisible(); + }, +}; + +for (const [name, open] of Object.entries(SCREENS)) { + test(`screenshot ${name} (${scheme})`, async ({ app }) => { + if (process.env.SCREENSHOT_LABEL === undefined) test.skip(true, "set SCREENSHOT_LABEL to capture"); + await app.page.emulateMedia({ colorScheme: scheme }); + await open(app); + await captureCurrent(app.page, `${name}-${scheme}`); + }); +} diff --git a/apps/smart-ssh-community/frontend/e2e/tests/connecting-tab.spec.ts b/apps/smart-ssh-community/frontend/e2e/tests/connecting-tab.spec.ts index 861e0a721..eb145d688 100644 --- a/apps/smart-ssh-community/frontend/e2e/tests/connecting-tab.spec.ts +++ b/apps/smart-ssh-community/frontend/e2e/tests/connecting-tab.spec.ts @@ -23,7 +23,7 @@ test("opens a focused connecting tab before connect resolves and lists the steps await emitProgress(app, [ snapshotStep("dnsResolution", "ok", { code: "contacting", target: "h.example.test:22" }), - snapshotStep("tcpConnect", "ok", { code: "contacting", target: "10.0.0.1:22" }), + snapshotStep("tcpConnect", "ok", { code: "contacting", target: "10.0.0.1:22" }, null, 1530), snapshotStep("hostKeyCheck", "running", { code: "waitingForDecision" }), ]); const rows = page.getByTestId("connect-progress-list").getByRole("listitem"); @@ -31,6 +31,11 @@ test("opens a focused connecting tab before connect resolves and lists the steps await expect(rows.nth(0)).toContainText("DNS resolution"); await expect(rows.nth(0)).toContainText("h.example.test:22"); await expect(rows.nth(2)).toContainText("waiting for your decision"); + // Finished steps show a mono duration, a running step none. + await expect(rows.nth(1).getByTestId("step-duration")).toHaveText("1.5 s"); + await expect(rows.nth(1).getByTestId("step-duration")).toHaveClass(/font-mono/); + await expect(rows.nth(2).getByTestId("step-duration")).toHaveCount(0); + await expect(rows.nth(1).locator('[data-icon="check"]')).toHaveCount(1); await expectNoSeriousA11yViolations(page, "connecting tab"); }); diff --git a/apps/smart-ssh-community/frontend/e2e/tests/host-key-prompt.spec.ts b/apps/smart-ssh-community/frontend/e2e/tests/host-key-prompt.spec.ts index 29e23e427..6b57c037c 100644 --- a/apps/smart-ssh-community/frontend/e2e/tests/host-key-prompt.spec.ts +++ b/apps/smart-ssh-community/frontend/e2e/tests/host-key-prompt.spec.ts @@ -22,6 +22,9 @@ test("host key prompt: shows the key, accepts nothing without a click, Reject le await expect(dialog).toContainText("fresh.example.test:2222"); await expect(dialog).toContainText(FINGERPRINT); await expect(dialog).toContainText("ssh-ed25519"); + // Unknown variant: plain "Offered" row, no danger band or ticks. + await expect(dialog.getByRole("term").filter({ hasText: /^Offered$/ })).toHaveCount(1); + await expect(dialog.getByTestId("host-key-header")).toHaveCount(0); // Nothing is decided while the dialog is open. expect(await app.calls("confirm_host_key")).toEqual([]); @@ -64,6 +67,11 @@ test("host key prompt: a changed key shows both fingerprints, accepts nothing wi await expect(dialog).toContainText(KNOWN); await expect(dialog).toContainText(FINGERPRINT); await expect(dialog).toContainText("ssh-ed25519"); + // Mismatch variant: danger header band with warn icon, ticks, label/value rows. + await expect(dialog.getByTestId("host-key-header")).toHaveClass(/bg-danger-subtle/); + await expect(dialog.getByTestId("host-key-header").locator('[data-icon="warn"]')).toHaveCount(1); + await expect(page.getByTestId("dialog-ticks")).toHaveCount(1); + await expect(dialog.getByRole("term")).toHaveText(["Known", "Offered Now", "Key type"]); expect(await app.calls("confirm_host_key")).toEqual([]); diff --git a/apps/smart-ssh-community/frontend/src/components/AuthPromptDialog.tsx b/apps/smart-ssh-community/frontend/src/components/AuthPromptDialog.tsx index 55d8cb6ca..423749735 100644 --- a/apps/smart-ssh-community/frontend/src/components/AuthPromptDialog.tsx +++ b/apps/smart-ssh-community/frontend/src/components/AuthPromptDialog.tsx @@ -2,7 +2,7 @@ import { useRef } from "react"; import { useTranslation } from "react-i18next"; import type { AuthPromptNeededEvent } from "../api/types"; import { TECHNICAL_INPUT_PROPS } from "../lib/technicalInputProps"; -import { Button, DialogFrame, Field, FIELD_CONTROL_CLASS } from "./ui"; +import { Button, DialogFrame, Field, FIELD_CONTROL_CLASS, Icon } from "./ui"; interface AuthPromptDialogProps { event: AuthPromptNeededEvent; @@ -55,6 +55,7 @@ export function AuthPromptDialog({ event, onSubmit, onCancel }: AuthPromptDialog } title={t("authPrompt.title", { hop: event.hop })} onClose={cancel} initialFocusRef={firstRef} diff --git a/apps/smart-ssh-community/frontend/src/components/AuthPromptHost.test.tsx b/apps/smart-ssh-community/frontend/src/components/AuthPromptHost.test.tsx index 95348ff16..f89b89cc4 100644 --- a/apps/smart-ssh-community/frontend/src/components/AuthPromptHost.test.tsx +++ b/apps/smart-ssh-community/frontend/src/components/AuthPromptHost.test.tsx @@ -48,6 +48,14 @@ beforeEach(() => { }); describe("AuthPromptHost", () => { + it("renders the foundation dialog with a lock icon in the header", async () => { + const { show } = renderHost(); + show(kbd); + const dialog = await screen.findByRole("dialog"); + expect(dialog.querySelector('[data-icon="lock"]')).not.toBeNull(); + expect(dialog).toHaveClass("bg-surface-raised"); + }); + it("masks echo-off prompts, shows echo-on prompts plain and focuses the first field", async () => { const { show } = renderHost(); show(kbd); diff --git a/apps/smart-ssh-community/frontend/src/components/ConnectProgressList.tsx b/apps/smart-ssh-community/frontend/src/components/ConnectProgressList.tsx index 75b0f26d7..5013fd6db 100644 --- a/apps/smart-ssh-community/frontend/src/components/ConnectProgressList.tsx +++ b/apps/smart-ssh-community/frontend/src/components/ConnectProgressList.tsx @@ -6,6 +6,7 @@ import { useTranslation } from "react-i18next"; import type { ConnectStepDetail, ConnectStepSnapshot } from "../api/types"; import { Spinner, Icon } from "./ui"; import type { TranslateFn } from "../i18nTypes"; +import { formatDuration } from "../lib/connectStepLog"; type T = TranslateFn; @@ -45,7 +46,7 @@ export function ConnectProgressList({ steps }: { steps: ConnectStepSnapshot[] })
    {steps.map((step, i) => { const failed = step.status === "failed"; @@ -57,8 +58,8 @@ export function ConnectProgressList({ steps }: { steps: ConnectStepSnapshot[] }) data-failed={failed ? "true" : undefined} className={ failed - ? "flex items-baseline gap-2 rounded border border-danger-border-strong bg-danger-subtle/40 px-2 py-1 text-danger-fg-soft" - : "flex items-baseline gap-2 px-2 py-1" + ? "flex items-baseline gap-2 border-t border-danger-border bg-danger-subtle px-3 py-2 text-danger-fg first:border-t-0" + : "flex items-baseline gap-2 border-t border-border px-3 py-2 first:border-t-0" } > {multiHop && {step.hop}} - {detail && {detail}} + {detail && {detail}} + {step.durationMs !== null && ( + + {formatDuration(step.durationMs)} + + )} ); })} diff --git a/apps/smart-ssh-community/frontend/src/components/ConnectStepLog.tsx b/apps/smart-ssh-community/frontend/src/components/ConnectStepLog.tsx index c854047d2..f298278b1 100644 --- a/apps/smart-ssh-community/frontend/src/components/ConnectStepLog.tsx +++ b/apps/smart-ssh-community/frontend/src/components/ConnectStepLog.tsx @@ -72,7 +72,7 @@ export function ConnectStepLog({ steps }: { steps: ConnectStepRecord[] }) { {stepLabel(t, record.step, record.status.state)} {stepStatusText(t, record)} - {formatDuration(record.durationMs)} + {formatDuration(record.durationMs)} {details &&
    {details}
    } diff --git a/apps/smart-ssh-community/frontend/src/components/ConnectingTabView.test.tsx b/apps/smart-ssh-community/frontend/src/components/ConnectingTabView.test.tsx index 5aef721e0..532311892 100644 --- a/apps/smart-ssh-community/frontend/src/components/ConnectingTabView.test.tsx +++ b/apps/smart-ssh-community/frontend/src/components/ConnectingTabView.test.tsx @@ -11,7 +11,7 @@ const snap = ( kind: ConnectStepSnapshot["kind"], status: ConnectStepSnapshot["status"], detail: ConnectStepSnapshot["detail"] = null, -): ConnectStepSnapshot => ({ kind, hopIndex: 0, hop: "u@h:22", status, errorCode: null, detail }); +): ConnectStepSnapshot => ({ kind, hopIndex: 0, hop: "u@h:22", status, errorCode: null, detail, durationMs: null }); function tab(overrides: Partial): SessionTab { return { @@ -40,6 +40,25 @@ function view(t: SessionTab, onRetry = vi.fn(), onClose = vi.fn()) { } describe("ConnectingTabView", () => { + it("shows status icons per step (incl. warning) and mono durations only for finished steps", () => { + view( + tab({ + progress: [ + { ...snap("dnsResolution", "ok"), durationMs: 42 }, + { ...snap("outdatedAlgorithms", "warning"), durationMs: 1530 }, + snap("hostKeyCheck", "running"), + ], + }), + ); + const items = screen.getAllByRole("listitem"); + expect(items[0].querySelector('[data-icon="check"]')).not.toBeNull(); + expect(items[1].querySelector('[data-icon="warn"]')).not.toBeNull(); + expect(items[0].querySelector('[data-testid="step-duration"]')).toHaveTextContent("42 ms"); + expect(items[0].querySelector('[data-testid="step-duration"]')).toHaveClass("font-mono"); + expect(items[1].querySelector('[data-testid="step-duration"]')).toHaveTextContent("1.5 s"); + expect(items[2].querySelector('[data-testid="step-duration"]')).toBeNull(); + }); + it("lists the steps with detail texts and offers Cancel while running", () => { const { onClose } = view( tab({ diff --git a/apps/smart-ssh-community/frontend/src/components/HostKeyDialog.test.tsx b/apps/smart-ssh-community/frontend/src/components/HostKeyDialog.test.tsx index 7695f1d39..c14e094f2 100644 --- a/apps/smart-ssh-community/frontend/src/components/HostKeyDialog.test.tsx +++ b/apps/smart-ssh-community/frontend/src/components/HostKeyDialog.test.tsx @@ -59,7 +59,31 @@ describe.each(branches)("HostKeyDialog ($name)", ({ event, role, rejectLabel, tr expect(description?.textContent?.length ?? 0).toBeGreaterThan(0); }); + it("renders label/value rows and the danger header band only for the mismatch", () => { + renderDialog(event); + expect(screen.getByTestId("host-key-address")).toHaveClass("font-mono"); + if (role === "alertdialog") { + expect(screen.getByTestId("host-key-header")).toHaveClass("bg-danger-subtle"); + expect(screen.getByText("Bekannt")).toBeInTheDocument(); + } else { + expect(screen.queryByTestId("host-key-header")).toBeNull(); + expect(screen.queryByTestId("dialog-ticks")).toBeNull(); + } + }); + + it("labels the fingerprint row 'Offered Now' for a mismatch and 'Offered' for an unknown host", () => { + renderDialog(event); + const labels = screen.getAllByRole("term").map((n) => n.textContent); + if (role === "alertdialog") { + expect(labels).toContain("Jetzt angeboten"); + } else { + expect(labels).toContain("Angeboten"); + expect(labels).not.toContain("Jetzt angeboten"); + } + }); + it("draws the danger corner ticks, hidden in the narrow layout, with an offset shadow", () => { + if (role !== "alertdialog") return; renderDialog(event); const wrapper = screen.getByTestId("dialog-ticks"); expect(wrapper).toHaveClass("narrow:hidden"); @@ -412,8 +436,9 @@ describe("HostKeyDialog — unbekannt und geändert bleiben unterscheidbar (Issu expect(unknown.className).toContain("border-border-strong"); expect(unknown.className).not.toContain("red"); - expect(mismatch.className).toContain("border-danger"); - expect(mismatch.className).toContain("bg-danger-subtle/95"); + expect(mismatch.className).toContain("border-danger-border"); + expect(unknown.className).not.toContain("border-danger-border"); + expect(mismatch.className).toContain("bg-surface-raised"); expect(unknown.buttons).toEqual(["Ablehnen", "Vertrauen"]); expect(mismatch.buttons).toEqual(["Verbindung abbrechen", "Trotzdem vertrauen"]); @@ -432,7 +457,8 @@ describe("HostKeyDialog — unbekannt und geändert bleiben unterscheidbar (Issu describe.each(branches)("HostKeyDialog key type ($name)", ({ event }) => { it("shows the key type of the offered key", () => { renderDialog({ ...event, keyType: "ssh-ed25519" }); - expect(screen.getByTestId("host-key-type")).toHaveTextContent("Schlüsseltyp: ssh-ed25519"); + expect(screen.getByTestId("host-key-type")).toHaveTextContent("Schlüsseltypssh-ed25519"); + expect(screen.getByText("ssh-ed25519")).toHaveClass("select-text"); expect(screen.getByText("example.com:22")).toBeInTheDocument(); expect(screen.getByText(event.fingerprint)).toBeInTheDocument(); }); diff --git a/apps/smart-ssh-community/frontend/src/components/HostKeyDialog.tsx b/apps/smart-ssh-community/frontend/src/components/HostKeyDialog.tsx index faa54e996..7b7c33807 100644 --- a/apps/smart-ssh-community/frontend/src/components/HostKeyDialog.tsx +++ b/apps/smart-ssh-community/frontend/src/components/HostKeyDialog.tsx @@ -1,7 +1,7 @@ import { useEffect, useId, useRef } from "react"; import { useTranslation } from "react-i18next"; import type { HostKeyInfo, HostKeyUserDecision } from "../api/types"; -import { Button, CornerTicks, DialogFrame } from "./ui"; +import { Button, DialogFrame, Icon } from "./ui"; interface HostKeyDialogProps { event: HostKeyInfo; @@ -60,6 +60,10 @@ export function HostKeyDialog({ event, onDecision }: HostKeyDialogProps) { // `ServerList`; das Portal bleibt trotzdem nötig — `ServerForm` zeigt // diesen Dialog für die Test-Verbindung aus seinem eigenen (ausblendbaren) // Teilbaum heraus. + const rejectLabel = isMismatch ? t("hostKeyDialog.cancelConnection") : t("hostKeyDialog.reject"); + const trustLabel = isMismatch ? t("hostKeyDialog.trustAnyway") : t("hostKeyDialog.trust"); + const rowClass = "grid grid-cols-[6rem_1fr] gap-3 border-t border-border px-3 py-2 first:border-t-0 narrow:grid-cols-1 narrow:gap-1"; + const labelClass = "label-condensed text-xs text-fg-subtle"; return ( decide("reject")} initialFocusRef={rejectButtonRef} resetKey={event} - panelClassName={`relative flex max-h-[85vh] w-full max-w-md flex-col border p-0 shadow-offset-lg narrow:max-h-none narrow:max-w-none narrow:border-0 narrow:shadow-none ${ - isMismatch ? "border-danger bg-danger-subtle/95" : "border-border-strong bg-surface-raised" - }`} + tone={isMismatch ? "danger" : undefined} + ticks={isMismatch ? "danger" : undefined} + panelClassName={`relative flex max-h-[85vh] w-full max-w-lg flex-col border ${isMismatch ? "" : "border-border-strong"} bg-surface-raised p-0 shadow-offset-lg narrow:max-h-none narrow:max-w-none narrow:border-0 narrow:shadow-none`} > -
    - + {isMismatch ? ( +
    + +
    {t("hostKeyDialog.mismatchLabel")}
    - {isMismatch ? ( - <> - {/* Gefahren-Warnstreifen — Design-Import, Abschnitt "HOST-KEY - * GEÄNDERT"-Dialog: diagonale Rot-Schwarz-Schraffur als - * unübersehbarer Alarm-Kopf. */} -
    -
    -
    -
    - {t("hostKeyDialog.mismatchLabel")} -
    -

    - {t("hostKeyDialog.mismatchHeading")} -

    -

    - {t("hostKeyDialog.mismatchBodyBeforeHost")} - {event.host}:{event.port} - {t("hostKeyDialog.mismatchBodyAfterHost")} -

    - {event.keyType ? ( -

    - {t("hostKeyDialog.keyType")}: {event.keyType} -

    - ) : null} -
    -
    - - {t("hostKeyDialog.known")} - - - {event.expectedFingerprint} - -
    -
    - - {t("hostKeyDialog.offeredNow")} - - - {event.fingerprint} - -
    -
    - -
    - -
    - - -
    -
    - - ) : ( -
    -

    - {t("hostKeyDialog.unknownHeading")} -

    -
    -

    - {t("hostKeyDialog.unknownBodyBeforeHost")} - {event.host}:{event.port} - {t("hostKeyDialog.unknownBodyAfterHost")} -

    - {event.keyType ? ( -

    - {t("hostKeyDialog.keyType")}: {event.keyType} -

    - ) : null} -
    - {event.fingerprint} -
    - -
    - -
    - - + ) : null} +
    +

    + {isMismatch ? t("hostKeyDialog.mismatchHeading") : t("hostKeyDialog.unknownHeading")} +

    +

    + {t(isMismatch ? "hostKeyDialog.mismatchBodyBeforeHost" : "hostKeyDialog.unknownBodyBeforeHost")} + + {event.host}:{event.port} + + {t(isMismatch ? "hostKeyDialog.mismatchBodyAfterHost" : "hostKeyDialog.unknownBodyAfterHost")} +

    +
    + {isMismatch ? ( +
    +
    {t("hostKeyDialog.known")}
    +
    {event.expectedFingerprint}
    + ) : null} +
    +
    + {t(isMismatch ? "hostKeyDialog.offeredNow" : "hostKeyDialog.offered")} +
    +
    {event.fingerprint}
    - )} + {event.keyType ? ( +
    +
    {t("hostKeyDialog.keyType")}
    +
    {event.keyType}
    +
    + ) : null} +
    +
    +
    + + +
    ); } diff --git a/apps/smart-ssh-community/frontend/src/components/ServerForm.testDialog.test.tsx b/apps/smart-ssh-community/frontend/src/components/ServerForm.testDialog.test.tsx index da5a2e1ae..745c2ac7c 100644 --- a/apps/smart-ssh-community/frontend/src/components/ServerForm.testDialog.test.tsx +++ b/apps/smart-ssh-community/frontend/src/components/ServerForm.testDialog.test.tsx @@ -86,6 +86,7 @@ const step = ( status, errorCode, detail: null, + durationMs: null, }); async function startTest(): Promise { diff --git a/apps/smart-ssh-community/frontend/src/components/ToastHost.test.tsx b/apps/smart-ssh-community/frontend/src/components/ToastHost.test.tsx index 1668e2ba3..59fa1c7e3 100644 --- a/apps/smart-ssh-community/frontend/src/components/ToastHost.test.tsx +++ b/apps/smart-ssh-community/frontend/src/components/ToastHost.test.tsx @@ -65,4 +65,21 @@ describe("ToastHost (Spec 0067, Teil B)", () => { expect(onClick).toHaveBeenCalled(); expect(screen.queryByText(/heruntergeladen/)).not.toBeInTheDocument(); }); + + it("renders a square toast with a status-tone rule, offset shadow, status icon and icon close button", () => { + renderHost(); + act(() => showToast({ kind: "error", message: "boom" })); + const toast = screen.getByText("boom").closest("[data-kind]") as HTMLElement; + expect(toast).toHaveAttribute("data-kind", "error"); + expect(toast).toHaveClass("border", "border-danger-border", "shadow-offset-sm"); + expect(toast.className).not.toMatch(/rounded/); + expect(toast.querySelector('[data-icon="warn"]')).not.toBeNull(); + const close = screen.getByRole("button", { name: "Meldung schließen" }); + expect(close.querySelector('[data-icon="x"]')).not.toBeNull(); + + act(() => showToast({ kind: "success", message: "fine" })); + const ok = screen.getByText("fine").closest("[data-kind]") as HTMLElement; + expect(ok).toHaveClass("border-success-border", "shadow-offset-sm"); + expect(ok.querySelector('[data-icon="check"]')).not.toBeNull(); + }); }); diff --git a/apps/smart-ssh-community/frontend/src/components/ToastHost.tsx b/apps/smart-ssh-community/frontend/src/components/ToastHost.tsx index b996e9617..36ba9e18d 100644 --- a/apps/smart-ssh-community/frontend/src/components/ToastHost.tsx +++ b/apps/smart-ssh-community/frontend/src/components/ToastHost.tsx @@ -41,14 +41,17 @@ export function ToastHost() { {toasts.map((toast) => (

    - + {toast.message}

    @@ -65,7 +68,8 @@ export function ToastHost() { )}