Skip to content

Commit ce09fc8

Browse files
chore: generate
1 parent 44a35c5 commit ce09fc8

3 files changed

Lines changed: 96 additions & 20 deletions

File tree

packages/app/e2e/smoke/session-timeline.fixture.ts

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,13 @@ function reasoningPart(index: number, partIndex: number, length: number): Messag
111111
}
112112
}
113113

114-
function toolPart(index: number, partIndex: number, tool: string, input: Record<string, unknown>, outputLength = 160): MessagePart {
114+
function toolPart(
115+
index: number,
116+
partIndex: number,
117+
tool: string,
118+
input: Record<string, unknown>,
119+
outputLength = 160,
120+
): MessagePart {
115121
const metadata =
116122
tool === "apply_patch"
117123
? { files: [patchFile(index, "update"), patchFile(index + 1, index % 2 === 0 ? "add" : "delete")] }
@@ -168,7 +174,9 @@ function patch(seed: number, length: number) {
168174
}
169175

170176
function code(seed: number, lines: number) {
171-
return Array.from({ length: lines }, (_, index) => `export const value${index} = "${lorem(seed + index, 32)}"`).join("\n")
177+
return Array.from({ length: lines }, (_, index) => `export const value${index} = "${lorem(seed + index, 32)}"`).join(
178+
"\n",
179+
)
172180
}
173181

174182
function turn(index: number): Message[] {
@@ -189,12 +197,14 @@ function turn(index: number): Message[] {
189197
...(index % 6 === 0
190198
? [toolPart(index, 7, "write", { filePath: `src/generated/write-${index}.ts`, content: code(index, 28) }, 560)]
191199
: []),
192-
...(index % 8 === 0 ? [toolPart(index, 8, "apply_patch", { files: [`src/generated/patch-${index}.ts`] }, 620)] : []),
193-
...(index % 7 === 0 ? [toolPart(index, 4, "bash", { command: "bun typecheck", description: "Verify generated output" }, 620)] : []),
194-
...(index % 10 === 0 ? [toolPart(index, 9, "webfetch", { url: "https://example.com/docs/sample" }, 120)] : []),
195-
...(index % 11 === 0
196-
? [toolPart(index, 10, "websearch", { query: "sample movement notes" }, 240)]
200+
...(index % 8 === 0
201+
? [toolPart(index, 8, "apply_patch", { files: [`src/generated/patch-${index}.ts`] }, 620)]
202+
: []),
203+
...(index % 7 === 0
204+
? [toolPart(index, 4, "bash", { command: "bun typecheck", description: "Verify generated output" }, 620)]
197205
: []),
206+
...(index % 10 === 0 ? [toolPart(index, 9, "webfetch", { url: "https://example.com/docs/sample" }, 120)] : []),
207+
...(index % 11 === 0 ? [toolPart(index, 10, "websearch", { query: "sample movement notes" }, 240)] : []),
198208
...(index % 13 === 0
199209
? [
200210
toolPart(
@@ -232,7 +242,14 @@ function orderedParts(message: Message) {
232242

233243
export const fixture = {
234244
directory,
235-
project: { id: projectID, worktree: directory, vcs: "git", name: "smoke-project", time: { created: 1700000000000, updated: 1700000000000 }, sandboxes: [] },
245+
project: {
246+
id: projectID,
247+
worktree: directory,
248+
vcs: "git",
249+
name: "smoke-project",
250+
time: { created: 1700000000000, updated: 1700000000000 },
251+
sandboxes: [],
252+
},
236253
provider: {
237254
all: [
238255
{
@@ -245,23 +262,50 @@ export const fixture = {
245262
default: { providerID: "opencode", modelID: "claude-opus-4-6" },
246263
},
247264
sessions: [
248-
{ id: sourceID, slug: "source", projectID, directory, title: "Uncommitted changes inquiry", version: "dev", time: { created: 1700000000000, updated: 1700000000000 } },
249-
{ id: targetID, slug: "target", projectID, directory, title: "Example Game: sample jump movement & sample physics analysis", version: "dev", time: { created: 1700000001000, updated: 1700000001000 } },
265+
{
266+
id: sourceID,
267+
slug: "source",
268+
projectID,
269+
directory,
270+
title: "Uncommitted changes inquiry",
271+
version: "dev",
272+
time: { created: 1700000000000, updated: 1700000000000 },
273+
},
274+
{
275+
id: targetID,
276+
slug: "target",
277+
projectID,
278+
directory,
279+
title: "Example Game: sample jump movement & sample physics analysis",
280+
version: "dev",
281+
time: { created: 1700000001000, updated: 1700000001000 },
282+
},
250283
],
251284
sourceID,
252285
targetID,
253286
messages: { [sourceID]: sourceMessages, [targetID]: targetMessages },
254287
expected: {
255288
sourceTitle: "Uncommitted changes inquiry",
256289
targetTitle: "Example Game: sample jump movement & sample physics analysis",
257-
targetMessageIDs: targetMessages.filter((message) => message.info.role === "user").map((message) => message.info.id),
258-
targetPartIDs: targetMessages.flatMap((message) => orderedParts(message).filter(renderable).map((part) => part.id)),
290+
targetMessageIDs: targetMessages
291+
.filter((message) => message.info.role === "user")
292+
.map((message) => message.info.id),
293+
targetPartIDs: targetMessages.flatMap((message) =>
294+
orderedParts(message)
295+
.filter(renderable)
296+
.map((part) => part.id),
297+
),
259298
},
260299
}
261300

262301
export function pageMessages(sessionID: string, limit: number, before?: string) {
263302
const messages = fixture.messages[sessionID as keyof typeof fixture.messages] ?? []
264-
const end = before ? Math.max(0, messages.findIndex((message) => message.info.id === before)) : messages.length
303+
const end = before
304+
? Math.max(
305+
0,
306+
messages.findIndex((message) => message.info.id === before),
307+
)
308+
: messages.length
265309
const start = Math.max(0, end - limit)
266310
return {
267311
items: messages.slice(start, end),

packages/app/e2e/smoke/session-timeline.spec.ts

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,12 @@ async function configureSmokePage(page: Page) {
172172
})
173173
}
174174

175-
async function expectCanScrollToStart(page: Page, expectedPartIDs: string[], expectedMessageIDs: string[], errors: string[]) {
175+
async function expectCanScrollToStart(
176+
page: Page,
177+
expectedPartIDs: string[],
178+
expectedMessageIDs: string[],
179+
errors: string[],
180+
) {
176181
await pointAtTimeline(page)
177182
const seenParts = new Set<string>()
178183
const seenMessages = new Set<string>()
@@ -189,7 +194,11 @@ async function expectCanScrollToStart(page: Page, expectedPartIDs: string[], exp
189194
expectOrderedIDs(expectedMessageIDs, unique(current.messageIds), "mounted message")
190195
expectOrderedIDs(expectedMessageIDs, unique(current.visibleMessageIds), "visible message")
191196

192-
if (current.scrollTop <= 1 && seenParts.size === expectedPartIDs.length && seenMessages.size === expectedMessageIDs.length) {
197+
if (
198+
current.scrollTop <= 1 &&
199+
seenParts.size === expectedPartIDs.length &&
200+
seenMessages.size === expectedMessageIDs.length
201+
) {
193202
expectCompleteScroll(current, expectedPartIDs, expectedMessageIDs, seenParts, seenMessages, samples)
194203
return
195204
}
@@ -345,7 +354,12 @@ async function waitForTimelineStable(page: Page) {
345354
)
346355
}
347356

348-
async function expectSessionTimelineReady(page: Page, expectedPartIDs: string[], expectedMessageIDs: string[], errors: string[]) {
357+
async function expectSessionTimelineReady(
358+
page: Page,
359+
expectedPartIDs: string[],
360+
expectedMessageIDs: string[],
361+
errors: string[],
362+
) {
349363
await waitForTimelineStable(page)
350364
for (const text of forbiddenText) await expect(page.getByText(text)).toHaveCount(0)
351365
const currentState = await timelineState(page)
@@ -365,8 +379,14 @@ function expectCompleteScroll(
365379
samples: TraversalSample[],
366380
) {
367381
expect(state.scrollTop, `timeline should reach the start\n${sampleSummary(samples)}`).toBeLessThanOrEqual(1)
368-
expect(expectedPartIDs.filter((id) => !seenParts.has(id)), `missing visible timeline parts\n${sampleSummary(samples)}`).toEqual([])
369-
expect(expectedMessageIDs.filter((id) => !seenMessages.has(id)), `missing visible messages\n${sampleSummary(samples)}`).toEqual([])
382+
expect(
383+
expectedPartIDs.filter((id) => !seenParts.has(id)),
384+
`missing visible timeline parts\n${sampleSummary(samples)}`,
385+
).toEqual([])
386+
expect(
387+
expectedMessageIDs.filter((id) => !seenMessages.has(id)),
388+
`missing visible messages\n${sampleSummary(samples)}`,
389+
).toEqual([])
370390
expect(new Set(expectedPartIDs).size).toBe(expectedPartIDs.length)
371391
expect(new Set(expectedMessageIDs).size).toBe(expectedMessageIDs.length)
372392
expect(expectedPartIDs.length).toBe(331)
@@ -379,7 +399,10 @@ async function openProject(page: Page, projectName: string) {
379399

380400
async function navigateToSession(page: Page, sessionId: string, expectedTitle: string) {
381401
// Use evaluate to click to avoid strict visibility/animation issues during rapid e2e navigation
382-
await page.locator(`a[href*="${sessionId}"]`).first().evaluate((el) => (el as HTMLElement).click())
402+
await page
403+
.locator(`a[href*="${sessionId}"]`)
404+
.first()
405+
.evaluate((el) => (el as HTMLElement).click())
383406
await expect(page.getByRole("heading", { name: expectedTitle })).toBeVisible()
384407
}
385408

packages/app/e2e/utils/mock-server.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
import type { Page, Route } from "@playwright/test"
22

3-
const emptyList = new Set(["/skill", "/command", "/lsp", "/formatter", "/permission", "/question", "/vcs/status", "/vcs/diff"])
3+
const emptyList = new Set([
4+
"/skill",
5+
"/command",
6+
"/lsp",
7+
"/formatter",
8+
"/permission",
9+
"/question",
10+
"/vcs/status",
11+
"/vcs/diff",
12+
])
413
const emptyObject = new Set(["/global/config", "/config", "/provider/auth", "/mcp", "/session/status"])
514

615
export interface MockServerConfig {

0 commit comments

Comments
 (0)