fix(web): make the web console work end-to-end
- Pair through the public POST /api/v1/pair and persist the device scopes; keep the allow-listed next deep link. Rename the manual field to pairing code. - Authenticate the WebSocket with the raw device token (strip Bearer) and recover from a 401 by clearing the connection once. - Fix chat payloads: setModel/setThinking, attention/diff responses, subagent dispatch items, queue ids/mode, task output and WS resume since. - Render exactly one assistant message per turn: one-to-one snapshot/history merge plus a stale-delta guard after message_end (fixes PONGONG). - Fix dialogs (content above the overlay), unknown-session deep links (error + retry, no silent fallback), device list/revoke, status identity and live pairing code, reconnect banner and Playwright selectors.
This commit is contained in:
1 parent
5572ac0d84
commit
0ef019f58d
57 files changed
+3549
-684
No files matched your search
@@ -1,9 +1,12 @@
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardSub, CardTitle } from "@/components/ui/card";
|
||||
import { Modal } from "@/components/ui/dialog";
|
||||
import { StatusDot } from "@/components/ui/status-dot";
|
||||
|
||||
describe("Button", () => {
|
||||
@@ -74,3 +77,50 @@ describe("Badge", () => {
|
||||
expect(container.firstElementChild).toHaveClass("badge", "badge--warn");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Modal", () => {
|
||||
function renderModal(onClick = vi.fn()) {
|
||||
render(
|
||||
<Modal
|
||||
open
|
||||
onOpenChange={() => undefined}
|
||||
title="Confirm connection"
|
||||
description="Pairing details"
|
||||
footer={
|
||||
<Button variant="primary" onClick={onClick}>
|
||||
Connect now
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
<p>host:port</p>
|
||||
</Modal>,
|
||||
);
|
||||
return onClick;
|
||||
}
|
||||
|
||||
it("nests the panel inside the backdrop so the scrim cannot intercept clicks", () => {
|
||||
renderModal();
|
||||
const dialog = screen.getByRole("dialog");
|
||||
expect(dialog).toHaveClass("modal", "modal-content");
|
||||
// Sibling content kept painting under `.modal-backdrop` (z-index 60) and
|
||||
// Playwright reported "modal-backdrop intercepts pointer events".
|
||||
expect(dialog.parentElement).toHaveClass("modal-backdrop");
|
||||
});
|
||||
|
||||
it("keeps footer buttons clickable", () => {
|
||||
const onClick = renderModal();
|
||||
const footerButton = screen.getByRole("button", { name: "Connect now" });
|
||||
expect(onClick).not.toHaveBeenCalled();
|
||||
fireEvent.click(footerButton);
|
||||
expect(onClick).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("stacks the panel above the backdrop in app.css", () => {
|
||||
const css = readFileSync(resolve(process.cwd(), "src/styles/app.css"), "utf8");
|
||||
const backdrop = /\.modal-backdrop\s*{[^}]*}/.exec(css)?.[0] ?? "";
|
||||
const modal = /\.modal\s*{[^}]*}/.exec(css)?.[0] ?? "";
|
||||
expect(backdrop).toContain("z-index: 60");
|
||||
expect(modal).toContain("position: relative");
|
||||
expect(modal).toContain("z-index: 61");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user