Skip to content

Commit 67304e5

Browse files
committed
test(es-desktop): refresh direct Queue smoke (anomalyco#148)
1 parent 86983d9 commit 67304e5

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

‎packages/es-desktop/test/smoke.mjs‎

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ try {
5050
const origin = new URL(page.url()).origin
5151
await page.goto(`${origin}/session/ses_a?directory=${encodeURIComponent(directory)}`)
5252
const active = page.locator(".float-editor").or(page.locator(".prompt-box:not([inert])"))
53-
await expect(active.getByRole("radio", { name: "Queue", exact: true })).toHaveAttribute("aria-checked", "true")
53+
const queue = active.getByRole("button", { name: "Queue", exact: true })
54+
const queueAgent = active.getByRole("combobox", { name: "Queue agent", exact: true })
55+
await expect(active.locator(".direct-composer")).toBeVisible()
56+
await expect(active.getByRole("button", { name: "Steer", exact: true })).toHaveAttribute("data-keyboard-target", "true")
57+
await expect(queue).toBeDisabled()
58+
await expect(queueAgent).toBeDisabled()
5459
expect(
5560
await app.evaluate(({ BrowserWindow }) => {
5661
const prefs = BrowserWindow.getAllWindows()[0].webContents.getLastWebPreferences()
@@ -70,17 +75,26 @@ try {
7075
])
7176
expect((await fetch(origin)).status).toBe(403)
7277
expect(await page.evaluate(() => fetch("/oc/pty", { method: "POST" }).then((res) => res.status))).toBe(403)
73-
await expect(active.getByRole("combobox", { name: "Queue agent", exact: true })).toBeEnabled()
74-
await active.getByRole("combobox", { name: "Queue agent", exact: true }).selectOption("plan")
78+
await active.locator("textarea").press("Meta+m")
79+
await expect(queue).toHaveAttribute("data-keyboard-target", "true")
80+
await expect(queueAgent).toBeEnabled()
81+
await queueAgent.selectOption("plan")
7582
await active.locator("textarea").fill("Electron fixture queue")
76-
await active.getByRole("button", { name: "Queue message", exact: true }).click()
83+
await expect(queue).toBeEnabled()
84+
await queue.click()
7785
await expect(page.locator(".input-receipts")).toContainText("Electron fixture queue")
7886
expect(fixture.receipts).toHaveLength(1)
7987
expect(fixture.receipts[0].agent).toBe("plan")
88+
expect(fixture.calls.filter((call) => call.method === "POST" && call.path.endsWith("/input"))).toMatchObject([
89+
{ directory, body: { delivery: "queue", agent: "plan", text: "Electron fixture queue" } },
90+
])
91+
expect(fixture.calls.filter((call) => call.method === "POST" && call.path.endsWith("/prompt_async"))).toEqual([])
8092
await page.screenshot({ path: path.join(artifacts, "native-session.png") })
8193
fixture.setStatus("idle")
82-
await expect(page.getByRole("button", { name: "Use normal Send", exact: true })).toBeVisible()
83-
expect(fixture.calls.find((call) => call.path.endsWith("/input") && call.method === "POST").directory).toBe(directory)
94+
await expect(active.getByRole("button", { name: "Send", exact: true })).toBeVisible()
95+
await expect(queue).toHaveCount(0)
96+
await expect(queueAgent).toBeDisabled()
97+
expect(fixture.receipts).toHaveLength(1)
8498

8599
await checkExternalLinks(app, page, origin)
86100
await page.evaluate(() => {
@@ -112,10 +126,13 @@ try {
112126
})
113127
await expect(active.locator("textarea")).toBeVisible()
114128
await page.screenshot({ path: path.join(artifacts, "native-rtl.png") })
129+
expect(
130+
fixture.calls.filter((call) => !["GET", "HEAD", "OPTIONS"].includes(call.method)).map((call) => [call.method, call.path]),
131+
).toEqual([["POST", "/session/ses_a/input"]])
115132
expect(errors).toEqual([])
116133
await page.evaluate(() => localStorage.setItem("es-app-left-open", "0"))
117134
console.info(
118-
"PASS native UI, sandbox, queue/API/SSE, protected loopback, navigation, safe links, denied permissions, WASM, RTL",
135+
"PASS native UI, sandbox, direct Queue/API/events, protected loopback, navigation, safe links, denied permissions, WASM, RTL",
119136
)
120137

121138
await fixture.close()

0 commit comments

Comments
 (0)