Skip to content
Merged
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
16 changes: 11 additions & 5 deletions web-ui/e2e/background-reopen.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* E2E: a reopened deck follows its chat's work, on each agent engine.
*
* A deck is made from New Deck in a slow turn (`[slow=<n>]`), and its tab is closed once the deck
* A deck is made from the home composer in a slow turn (`[slow=<n>]`), and its tab is closed once the deck
* opens. When the turn ended while no tab was open, opening the deck again shows the prompt once
* and the whole reply, with no Stop button; a reload shows the same (the server has nothing
* running, and the history comes from `.chat.json`). When the turn still runs, the reopened deck
Expand All @@ -23,12 +23,18 @@ async function useEngine(page: Page, baseURL: string, engine: "v2" | "v3") {
expect(switched.status()).toBe(200)
}

/** Send `message` from New Deck on a new page, and wait until its deck opens. */
/** The home composer, ready to type into: it takes the focus once the page has hydrated. */
async function homeComposer(page: Page) {
await page.goto("/decks")
const input = page.getByRole("textbox", { name: "Chat message input" })
await expect(input).toBeFocused({ timeout: 30_000 })
return input
}

/** Send `message` from the home composer on a new page, and wait until its deck opens. */
async function startDeck(context: BrowserContext, message: string, deckId: string): Promise<Page> {
const page = await context.newPage()
await page.goto("/decks")
await page.getByRole("button", { name: "New Deck" }).click()
await page.getByRole("textbox", { name: "Chat message input" }).fill(message)
await (await homeComposer(page)).fill(message)
await page.getByRole("button", { name: "Send message" }).click()
await expect(page.getByRole("log", { name: "Chat messages" })).toContainText("Creating your deck", { timeout: 15_000 })
await expect(page).toHaveURL((url) => url.hash === `#${deckId}`, { timeout: 15_000 })
Expand Down
13 changes: 10 additions & 3 deletions web-ui/e2e/compose-async.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,17 @@ async function send(page: Page, message: string) {
await page.getByRole("button", { name: "Send message" }).click()
}

/** New Deck, then a dispatching prompt; resolves once the deck's chat opened and the compose card shows. */
async function startCompose(page: Page, prompt: string, deckId: string) {
/** The home composer, ready to type into: it takes the focus once the page has hydrated. */
async function homeComposer(page: Page) {
await page.goto("/decks")
await page.getByRole("button", { name: "New Deck" }).click()
const input = page.getByRole("textbox", { name: "Chat message input" })
await expect(input).toBeFocused({ timeout: 30_000 })
return input
}

/** A dispatching prompt from the home composer; resolves once the deck's chat opened and the compose card shows. */
async function startCompose(page: Page, prompt: string, deckId: string) {
await homeComposer(page)
await send(page, prompt)
const chatLog = page.getByRole("log", { name: "Chat messages" })
await expect(chatLog).toContainText("The composers are on it.", { timeout: 20_000 })
Expand Down
10 changes: 8 additions & 2 deletions web-ui/e2e/compose-card.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@ async function useEngine(page: Page, baseURL: string, engine: "v2" | "v3") {
expect(switched.status()).toBe(200)
}

async function composeCard(page: Page, engine: "v2" | "v3") {
/** The home composer, ready to type into: it takes the focus once the page has hydrated. */
async function homeComposer(page: Page) {
await page.goto("/decks")
await page.getByRole("button", { name: "New Deck" }).click()
const input = page.getByRole("textbox", { name: "Chat message input" })
await expect(input).toBeFocused({ timeout: 30_000 })
return input
}

async function composeCard(page: Page, engine: "v2" | "v3") {
const input = await homeComposer(page)
await input.fill(`Compose a two-part deck on ${engine}`)
await page.getByRole("button", { name: "Send message" }).click()

Expand Down
13 changes: 10 additions & 3 deletions web-ui/e2e/continue-session.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@ async function useEngine(page: Page, baseURL: string, engine: "v2" | "v3") {
expect(switched.status()).toBe(200)
}

/** A new chat's picker, open. */
async function openPicker(page: Page) {
/** The home composer, ready to type into: it takes the focus once the page has hydrated. */
async function homeComposer(page: Page) {
await page.goto("/decks")
await page.getByRole("button", { name: "New Deck" }).click()
const input = page.getByRole("textbox", { name: "Chat message input" })
await expect(input).toBeFocused({ timeout: 30_000 })
return input
}

/** The home conversation's picker, open. */
async function openPicker(page: Page) {
await homeComposer(page)
await page.getByRole("button", { name: "Attach file or snippet" }).click()
await page.getByRole("button", { name: "Continue from a kiro session" }).click()
const dialog = page.getByRole("dialog", { name: "Continue from a kiro session" })
Expand Down
9 changes: 5 additions & 4 deletions web-ui/e2e/deck-creation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* E2E: deck creation happy path (roadmap 2-5b-4), on each agent engine.
*
* Deck list → New Deck → send a chat message → stub agent creates a deck
* Home screen → type into its composer and send → stub agent creates a deck
* and streams tool events → UI navigates to the workspace and shows the
* slide preview. Exercises the full Local-mode stack: React UI, Next.js
* API routes, ACP process manager and engine adapters, SSE bridge, and
Expand All @@ -21,10 +21,11 @@ async function createDeck(page: Page, engine: "v2" | "v3") {
await page.goto("/decks")
await expect(page.getByRole("heading", { name: "Decks" })).toBeVisible()

// Open the new-deck chat panel
await page.getByRole("button", { name: "New Deck" }).click()
// The home composer, at the stage of the home screen (no New Deck there); it takes the
// focus once the page has hydrated
await expect(page.getByRole("button", { name: "New Deck" })).toHaveCount(0)
const input = page.getByRole("textbox", { name: "Chat message input" })
await expect(input).toBeVisible()
await expect(input).toBeFocused({ timeout: 30_000 })

// Send a message
await input.fill(`Create a deck about end-to-end testing on ${engine}`)
Expand Down
14 changes: 10 additions & 4 deletions web-ui/e2e/deck-reload.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* E2E: a deck keeps its conversation on a reload and a direct link.
*
* The stub agent creates a deck through the chat. Opening it from the deck list shows that
* conversation in the deck's chat tab; so does reloading the page and opening `/decks/#<id>`
* conversation in the deck's chat sheet; so does reloading the page and opening `/decks/#<id>`
* in a new tab (the hash is read after mount, so the first render matches the prerendered
* page). Along the way it checks the Local wording: the search box searches decks by name,
* and the deck header has no private / internal visibility chip (a Cloud feature).
Expand All @@ -15,6 +15,14 @@ const DECK_ID = "e2e-v3-deck"
const DECK_NAME = "E2E Test Deck (v3)"
const PROMPT = "Create a deck that survives a reload"

/** The home composer, ready to type into: it takes the focus once the page has hydrated. */
async function homeComposer(page: Page) {
await page.goto("/decks")
const input = page.getByRole("textbox", { name: "Chat message input" })
await expect(input).toBeFocused({ timeout: 30_000 })
return input
}

/** The deck's chat shows the earlier conversation. */
async function expectConversation(page: Page) {
const chatLog = page.getByRole("log", { name: "Chat messages" })
Expand All @@ -27,9 +35,7 @@ test("a deck opened from the list keeps its conversation on reload and on a dire
expect(engine.status()).toBe(200)

// A deck with a saved conversation
await page.goto("/decks")
await page.getByRole("button", { name: "New Deck" }).click()
await page.getByRole("textbox", { name: "Chat message input" }).fill(PROMPT)
await (await homeComposer(page)).fill(PROMPT)
await page.getByRole("button", { name: "Send message" }).click()
await expect(page.getByRole("log", { name: "Chat messages" })).toContainText("Done! Your deck is ready.", { timeout: 30_000 })
await expect(page).toHaveURL(new RegExp(`#${DECK_ID}$`), { timeout: 15_000 })
Expand Down
9 changes: 5 additions & 4 deletions web-ui/e2e/mcp-deck-open.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* E2E: a deck an MCP client made, opened by its direct link (`sdpm open <deck>` opens
* `/decks/#<id>`), on each agent engine.
*
* The deck has deck.json and specs/ but no `.session`, as an MCP client leaves it. Its chat tab
* The deck has deck.json and specs/ but no `.session`, as an MCP client leaves it. Its chat sheet
* opens empty; the first turn runs in a new session whose first prompt names the deck
* (`Current deck: <dir>`, from the stub's trace) and shows no "no Kiro session" notice. The turn
* saves `.session`, and a reload shows the conversation (it continues from then on).
Expand Down Expand Up @@ -50,9 +50,10 @@ for (const engine of ["v3", "v2"] as const) {

await page.goto(`/decks/#${deckId}`)
const chatLog = page.getByRole("log", { name: "Chat messages" })
// The prerendered page shows the New chat's input until the hash is read after hydration;
// type only once the deck's own chat tab (labelled with the loaded deck's name) is there.
await expect(page.getByRole("button", { name: `MCP-made deck (${deckId})`, exact: true })).toBeVisible({ timeout: 30_000 })
// The prerendered page shows the home composer until the hash is read after hydration;
// type only once the deck is open (its bar shows the loaded deck's name; a name without a
// folder timestamp shows as it is) and its chat sheet is the only input.
await expect(page.getByRole("heading", { name: `MCP-made deck (${deckId})`, exact: true })).toBeVisible({ timeout: 30_000 })
await expect(page.getByRole("textbox", { name: "Chat message input" })).toBeVisible()
await expect(chatLog).not.toContainText("51")

Expand Down
13 changes: 10 additions & 3 deletions web-ui/e2e/model-picker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* E2E: the Local chat's model and effort, on each agent engine (stub-agent.mjs's models).
*
* New Deck → send → the pill shows the session's model once the turn ended → choose a model
* The home composer → send → the pill shows the session's model once the turn ended → choose a model
* (and on V3 an effort) → the next message runs on it (the stub says which in its reply) → a
* reload still shows it (the session keeps it). V2 offers no effort. Each test sets the engine
* first: the one an earlier spec left is not known. A cross-site PUT is refused.
Expand All @@ -26,9 +26,16 @@ const DECK_URL = { v2: /#e2e-v2-deck$/, v3: /#e2e-v3-deck$/ } as const

const pill = (page: Page) => page.getByRole("button", { name: /^Model:/ })

async function firstTurn(page: Page, engine: "v2" | "v3") {
/** The home composer, ready to type into: it takes the focus once the page has hydrated. */
async function homeComposer(page: Page) {
await page.goto("/decks")
await page.getByRole("button", { name: "New Deck" }).click()
const input = page.getByRole("textbox", { name: "Chat message input" })
await expect(input).toBeFocused({ timeout: 30_000 })
return input
}

async function firstTurn(page: Page, engine: "v2" | "v3") {
await homeComposer(page)
await send(page, `A deck about models on ${engine}`)
const chatLog = page.getByRole("log", { name: "Chat messages" })
await expect(chatLog).toContainText("Done! Your deck is ready.", { timeout: 30_000 })
Expand Down
Loading
Loading