@zyro-sec/session-ui 0.0.0-stage → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +25 -0
- package/bunfig.toml +2 -0
- package/component-tests/basic-tool.fixture.tsx +46 -0
- package/component-tests/basic-tool.spec.ts +63 -0
- package/component-tests/file-media.fixture.tsx +39 -0
- package/component-tests/file-media.spec.ts +13 -0
- package/component-tests/file-tool.spec.ts +62 -0
- package/component-tests/file-viewer.fixture.tsx +109 -0
- package/component-tests/file-viewer.spec.ts +134 -0
- package/component-tests/file.spec.ts +33 -0
- package/component-tests/line-comment-v2.spec.ts +15 -0
- package/component-tests/markdown-code-wrap.spec.ts +94 -0
- package/component-tests/markdown-readiness.spec.ts +95 -0
- package/component-tests/markdown.fixture.tsx +104 -0
- package/component-tests/markdown.spec.ts +1564 -0
- package/component-tests/mermaid-preview.spec.ts +43 -0
- package/component-tests/patch-group.spec.ts +79 -0
- package/component-tests/read-group.spec.ts +72 -0
- package/component-tests/read-image.fixture.tsx +66 -0
- package/component-tests/read-image.spec.ts +154 -0
- package/component-tests/session-compaction.spec.ts +254 -0
- package/component-tests/session-lifecycle.spec.ts +190 -0
- package/component-tests/session-message-projection.spec.ts +639 -0
- package/component-tests/session-notice-projection.spec.ts +20 -0
- package/component-tests/session-review-comments.spec.ts +179 -0
- package/component-tests/session-shell.spec.ts +93 -0
- package/component-tests/session-timeline-mobile.spec.ts +201 -0
- package/component-tests/session-timeline-notices.spec.ts +38 -0
- package/component-tests/session-timeline-reasoning.spec.ts +107 -0
- package/component-tests/session-timeline.spec.ts +157 -0
- package/component-tests/session-tool-projection.spec.ts +323 -0
- package/component-tests/text-lifecycle.fixture.tsx +26 -0
- package/component-tests/text-lifecycle.spec.ts +42 -0
- package/component-tests/timeline-subagent-rows.spec.ts +33 -0
- package/component-tests/tool-disclosure.spec.ts +48 -0
- package/component-tests/tool-group-sticky.spec.ts +37 -0
- package/component-tests/tool-group.spec.ts +290 -0
- package/component-tests/tool-status-title.fixture.tsx +22 -0
- package/component-tests/tool-status-title.spec.ts +30 -0
- package/component-tests/user-message-quotes.spec.ts +111 -0
- package/package.json +91 -4
- package/playwright.components.config.ts +4 -0
- package/playwright.local.config.ts +2 -0
- package/src/actions.ts +54 -0
- package/src/components/apply-patch-file.ts +122 -0
- package/src/components/basic-tool.css +487 -0
- package/src/components/basic-tool.tsx +258 -0
- package/src/components/copy-machine.ts +78 -0
- package/src/components/copy.ts +85 -0
- package/src/components/diagram-preview.tsx +28 -0
- package/src/components/disclosure-machine.ts +188 -0
- package/src/components/disclosure.ts +129 -0
- package/src/components/dock-prompt.stories.tsx +73 -0
- package/src/components/dock-prompt.tsx +29 -0
- package/src/components/file-comment-selection.tsx +146 -0
- package/src/components/file-media-machine.ts +165 -0
- package/src/components/file-media.stories.tsx +112 -0
- package/src/components/file-media.tsx +323 -0
- package/src/components/file-search.tsx +73 -0
- package/src/components/file.css +59 -0
- package/src/components/file.tsx +1300 -0
- package/src/components/image-preview.tsx +35 -0
- package/src/components/line-comment-annotations.tsx +580 -0
- package/src/components/line-comment-machine.ts +262 -0
- package/src/components/line-comment-styles.ts +293 -0
- package/src/components/line-comment.stories.tsx +152 -0
- package/src/components/line-comment.tsx +448 -0
- package/src/components/link-segments.ts +20 -0
- package/src/components/linked-text.tsx +21 -0
- package/src/components/markdown-cache-machine.ts +257 -0
- package/src/components/markdown-cache.tsx +556 -0
- package/src/components/markdown-clipboard.ts +101 -0
- package/src/components/markdown-code-machine.ts +200 -0
- package/src/components/markdown-code-state.ts +22 -0
- package/src/components/markdown-fragment-links.ts +74 -0
- package/src/components/markdown-github.svg +3 -0
- package/src/components/markdown-globe.svg +5 -0
- package/src/components/markdown-image-machine.ts +170 -0
- package/src/components/markdown-image.ts +156 -0
- package/src/components/markdown-inline-code-kind.ts +39 -0
- package/src/components/markdown-mermaid.ts +18 -0
- package/src/components/markdown-phase-machine.ts +102 -0
- package/src/components/markdown-projection.ts +13 -0
- package/src/components/markdown-session-links.ts +183 -0
- package/src/components/markdown-solid.test.tsx +92 -0
- package/src/components/markdown-solid.tsx +113 -0
- package/src/components/markdown-stream.ts +95 -0
- package/src/components/markdown-worker-machine.ts +516 -0
- package/src/components/markdown-worker-protocol.ts +73 -0
- package/src/components/markdown-worker.ts +250 -0
- package/src/components/markdown.css +672 -0
- package/src/components/markdown.stories.tsx +199 -0
- package/src/components/markdown.tsx +1612 -0
- package/src/components/markdown.worker.ts +188 -0
- package/src/components/message-file.ts +102 -0
- package/src/components/message-nav.css +134 -0
- package/src/components/message-nav.tsx +159 -0
- package/src/components/message-part.css +2109 -0
- package/src/components/message-part.tsx +3 -0
- package/src/components/question-prompt-experimental.css +576 -0
- package/src/components/question-prompt.css +527 -0
- package/src/components/quote-highlight.css +59 -0
- package/src/components/review-focus-driver.ts +142 -0
- package/src/components/review-focus-machine.ts +95 -0
- package/src/components/session-compaction.css +270 -0
- package/src/components/session-diff.ts +358 -0
- package/src/components/session-error.tsx +41 -0
- package/src/components/session-retry.tsx +92 -0
- package/src/components/session-review-machine.ts +241 -0
- package/src/components/session-review.css +264 -0
- package/src/components/session-review.stories.tsx +232 -0
- package/src/components/session-review.tsx +733 -0
- package/src/components/session-turn.css +282 -0
- package/src/components/shell-submessage.css +24 -0
- package/src/components/timeline-separator.tsx +69 -0
- package/src/components/tool-count-label.css +57 -0
- package/src/components/tool-count-label.tsx +76 -0
- package/src/components/tool-count-summary.css +102 -0
- package/src/components/tool-count-summary.stories.tsx +99 -0
- package/src/components/tool-count-summary.tsx +44 -0
- package/src/components/tool-error-card.css +178 -0
- package/src/components/tool-error-card.stories.tsx +113 -0
- package/src/components/tool-error-card.tsx +202 -0
- package/src/components/tool-status-title-machine.ts +128 -0
- package/src/components/tool-status-title.css +89 -0
- package/src/components/tool-status-title.tsx +163 -0
- package/src/context/data.tsx +107 -0
- package/src/context/index.ts +1 -0
- package/src/context/markdown.tsx +129 -0
- package/src/context/sources.tsx +34 -0
- package/src/document.ts +8 -0
- package/src/file-presentation.ts +34 -0
- package/src/message/action-machine.ts +72 -0
- package/src/message/agent-label.ts +3 -0
- package/src/message/attachment-card.css +119 -0
- package/src/message/attachment-card.tsx +40 -0
- package/src/message/attachment-media-machine.ts +213 -0
- package/src/message/comment-card.tsx +155 -0
- package/src/message/compaction-entrance-machine.ts +93 -0
- package/src/message/current-message.tsx +157 -0
- package/src/message/current-tool-state.ts +161 -0
- package/src/message/message-content.tsx +1391 -0
- package/src/message/paced-text-machine.ts +73 -0
- package/src/message/prompt-message.stories.tsx +149 -0
- package/src/message/relative-time.ts +45 -0
- package/src/message/user-message-quote-parts.ts +16 -0
- package/src/message/user-message-quotes.stories.tsx +797 -0
- package/src/message/user-message-quotes.tsx +135 -0
- package/src/pierre/comment-hover-machine.ts +53 -0
- package/src/pierre/comment-hover.ts +131 -0
- package/src/pierre/comment-selection-machine.ts +257 -0
- package/src/pierre/commented-lines.ts +106 -0
- package/src/pierre/diff-selection.ts +91 -0
- package/src/pierre/file-find-machine.ts +323 -0
- package/src/pierre/file-find.ts +537 -0
- package/src/pierre/file-runtime.ts +42 -0
- package/src/pierre/file-selection.ts +140 -0
- package/src/pierre/index.ts +344 -0
- package/src/pierre/media.ts +140 -0
- package/src/pierre/render-machine.ts +381 -0
- package/src/pierre/selection-bridge.ts +82 -0
- package/src/pierre/selection-machine.ts +198 -0
- package/src/pierre/virtualizer.ts +114 -0
- package/src/pierre/worker.ts +46 -0
- package/src/sources/experiment.ts +59 -0
- package/src/sources/site-icon.tsx +53 -0
- package/src/sources/sources-chip.tsx +57 -0
- package/src/sources/sources-expand-machine.ts +101 -0
- package/src/sources/sources-panel.tsx +249 -0
- package/src/sources/sources-title.tsx +21 -0
- package/src/sources/sources.css +266 -0
- package/src/sources/sources.ts +141 -0
- package/src/storybook/current-session-fixtures.ts +1492 -0
- package/src/storybook/current-session-scenarios.ts +76 -0
- package/src/storybook/current-session-story.tsx +154 -0
- package/src/storybook/index.ts +43 -0
- package/src/styles/index.css +19 -0
- package/src/timeline/__snapshots__/group-labels.test.ts.snap +110 -0
- package/src/timeline/__snapshots__/placement.test.ts.snap +1041 -0
- package/src/timeline/code-blocks.stories.tsx +105 -0
- package/src/timeline/commentary.stories.tsx +70 -0
- package/src/timeline/commentary.ts +38 -0
- package/src/timeline/detail.ts +111 -0
- package/src/timeline/error-card.stories.tsx +134 -0
- package/src/timeline/error-spacing.stories.tsx +71 -0
- package/src/timeline/facts.ts +493 -0
- package/src/timeline/file-changes.stories.tsx +436 -0
- package/src/timeline/group-label-fixtures.ts +97 -0
- package/src/timeline/mermaid.stories.tsx +131 -0
- package/src/timeline/place.ts +280 -0
- package/src/timeline/placement-fixtures.ts +365 -0
- package/src/timeline/placement-reactivity.ts +133 -0
- package/src/timeline/projection.ts +1261 -0
- package/src/timeline/research-and-agents.stories.tsx +461 -0
- package/src/timeline/session-timeline-row.tsx +1675 -0
- package/src/timeline/session-timeline.tsx +68 -0
- package/src/timeline/steer-arrival-machine.ts +134 -0
- package/src/timeline/terminal-work.stories.tsx +464 -0
- package/src/timeline/timeline-row.stories.tsx +1069 -0
- package/src/timeline/timeline-row.ts +238 -0
- package/src/timeline/turn-phase-machine.ts +112 -0
- package/src/timeline/user-message-fold.stories.tsx +194 -0
- package/src/timeline/user-runs.ts +87 -0
- package/src/timeline-next/__snapshots__/placement.test.ts.snap +990 -0
- package/src/timeline-next/compaction.tsx +236 -0
- package/src/timeline-next/errors.ts +101 -0
- package/src/timeline-next/event-row.tsx +168 -0
- package/src/timeline-next/events.ts +103 -0
- package/src/timeline-next/index.ts +10 -0
- package/src/timeline-next/nested-rail.ts +125 -0
- package/src/timeline-next/projection.ts +1028 -0
- package/src/timeline-next/row.tsx +1728 -0
- package/src/timeline-next/rules.ts +89 -0
- package/src/timeline-next/separator.tsx +73 -0
- package/src/timeline-next/spacing.ts +127 -0
- package/src/timeline-next/status-line.tsx +41 -0
- package/src/timeline-next/status.ts +33 -0
- package/src/timeline-next/stories/compare-renderer.stories.tsx +190 -0
- package/src/timeline-next/stories/compare-sessions/.gitignore +3 -0
- package/src/timeline-next/stories/compare.stories.tsx +486 -0
- package/src/timeline-next/stories/playground.stories.tsx +297 -0
- package/src/timeline-next/stories/session-replay.ts +1156 -0
- package/src/timeline-next/stories/session-timeline.tsx +50 -0
- package/src/timeline-next/stories/subagent-status.stories.tsx +132 -0
- package/src/timeline-next/timeline-next.css +649 -0
- package/src/timeline-next/tools/__snapshots__/activity-label.test.ts.snap +39 -0
- package/src/timeline-next/tools/activity-label.ts +166 -0
- package/src/timeline-next/tools/assistant-content.tsx +84 -0
- package/src/timeline-next/tools/context-group.tsx +619 -0
- package/src/timeline-next/tools/error-card.tsx +147 -0
- package/src/timeline-next/tools/explore.tsx +119 -0
- package/src/timeline-next/tools/file-group.tsx +128 -0
- package/src/timeline-next/tools/patch.tsx +174 -0
- package/src/timeline-next/tools/shell.tsx +186 -0
- package/src/timeline-next/tools/thought.tsx +87 -0
- package/src/timeline-next/tools/tool-display.tsx +119 -0
- package/src/tools/ansi.ts +8 -0
- package/src/tools/context-group-label.ts +123 -0
- package/src/tools/file-runs.ts +35 -0
- package/src/tools/project-path.ts +18 -0
- package/src/tools/read-group.stories.tsx +159 -0
- package/src/tools/run-machine.ts +185 -0
- package/src/tools/shell-output-machine.ts +233 -0
- package/src/tools/shell-output.ts +91 -0
- package/src/tools/subagent-row-variants.stories.tsx +129 -0
- package/src/tools/tool-group.stories.tsx +345 -0
- package/src/tools/tool-renderer.tsx +2876 -0
- package/src/v2/components/line-comment-annotations-v2.tsx +215 -0
- package/src/v2/components/session-file-panel-v2.tsx +149 -0
- package/src/v2/components/session-progress-indicator-v2.css +5 -0
- package/src/v2/components/session-progress-indicator-v2.stories.tsx +86 -0
- package/src/v2/components/session-progress-indicator-v2.tsx +16 -0
- package/src/v2/components/session-review-empty-changes-v2.tsx +17 -0
- package/src/v2/components/session-review-empty-no-git-v2.tsx +28 -0
- package/src/v2/components/session-review-file-preview-v2-virtualize.ts +5 -0
- package/src/v2/components/session-review-file-preview-v2.tsx +266 -0
- package/src/v2/components/session-review-v2.css +653 -0
- package/src/v2/components/session-review-v2.tsx +422 -0
- package/src/v2/components/sidebar-presence-machine.ts +69 -0
- package/tsconfig.json +20 -0
- package/README.md +0 -3
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { expect, story } from "../../stories/playwright/story"
|
|
2
|
+
|
|
3
|
+
// Selecting text to copy it used to open the comment editor and move focus into it.
|
|
4
|
+
story("selected code offers Add comment instead of opening the editor", async ({ mount, page }) => {
|
|
5
|
+
const root = await mount("components-session-review--interactive-comments")
|
|
6
|
+
const review = root.locator('[data-component="session-review"]')
|
|
7
|
+
const code = review.locator('[data-line-type="change-addition"] [data-diff-span]')
|
|
8
|
+
const add = page.getByRole("toolbar", { name: "Selection actions" }).getByRole("button", { name: "Add comment" })
|
|
9
|
+
|
|
10
|
+
await code.click()
|
|
11
|
+
const box = await code.boundingBox()
|
|
12
|
+
|
|
13
|
+
if (!box) throw new Error("the added line has no layout")
|
|
14
|
+
await page.mouse.move(box.x + 1, box.y + box.height / 2)
|
|
15
|
+
await page.mouse.down()
|
|
16
|
+
await page.mouse.move(box.x + box.width - 1, box.y + box.height / 2, { steps: 4 })
|
|
17
|
+
await page.mouse.up()
|
|
18
|
+
await expect(add).toBeVisible()
|
|
19
|
+
await expect(review.getByRole("textbox")).toHaveCount(0)
|
|
20
|
+
await expect(review.locator("[data-selected-line]")).toHaveCount(0)
|
|
21
|
+
|
|
22
|
+
await add.click()
|
|
23
|
+
await expect(add).toHaveCount(0)
|
|
24
|
+
await expect(review.getByRole("textbox")).toBeVisible()
|
|
25
|
+
await expect(review.locator('[data-slot="line-comment-editor-label"]')).toHaveText("Commenting on line 2")
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
// Moved from packages/app/e2e/regression/review-line-comment.spec.ts
|
|
29
|
+
story("opens the comment editor when a line number is clicked", async ({ mount }) => {
|
|
30
|
+
const root = await mount("components-session-review--interactive-comments")
|
|
31
|
+
const review = root.locator('[data-component="session-review"]')
|
|
32
|
+
await expect(review.getByText("export const first = 1", { exact: true })).toBeVisible()
|
|
33
|
+
const number = review.locator('[data-column-number="1"]')
|
|
34
|
+
await expect(number).toHaveCount(1)
|
|
35
|
+
await number.click()
|
|
36
|
+
await expect(review.getByRole("textbox")).toBeVisible()
|
|
37
|
+
await expect(review.locator('[data-slot="line-comment-editor-label"]')).toHaveText("Commenting on line 1")
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
// Moved from packages/app/e2e/regression/review-line-comment.spec.ts
|
|
41
|
+
story("opens the comment editor for a line number range", async ({ mount }) => {
|
|
42
|
+
const root = await mount("components-session-review--interactive-comments")
|
|
43
|
+
const review = root.locator('[data-component="session-review"]')
|
|
44
|
+
const first = review.locator('[data-column-number="1"]')
|
|
45
|
+
const last = review.locator('[data-column-number="3"]')
|
|
46
|
+
await expect(first).toHaveCount(1)
|
|
47
|
+
await expect(last).toHaveCount(1)
|
|
48
|
+
await first.dragTo(last)
|
|
49
|
+
await expect(review.getByRole("textbox")).toBeVisible()
|
|
50
|
+
await expect(review.locator('[data-slot="line-comment-editor-label"]')).toHaveText("Commenting on lines 1-3")
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
// Moved from packages/app/e2e/regression/review-line-comment.spec.ts
|
|
54
|
+
story("shows a comment button when a diff line is hovered", async ({ mount }) => {
|
|
55
|
+
const root = await mount("components-session-review--interactive-comments")
|
|
56
|
+
const review = root.locator('[data-component="session-review"]')
|
|
57
|
+
const line = review.getByText("export const first = 1", { exact: true })
|
|
58
|
+
const comment = review.getByRole("button", { name: "Comment", exact: true, includeHidden: true })
|
|
59
|
+
await expect(comment).toHaveCount(1)
|
|
60
|
+
await line.hover()
|
|
61
|
+
await expect(comment).toBeVisible()
|
|
62
|
+
await expect(comment).toHaveCSS("pointer-events", "auto")
|
|
63
|
+
await comment.dispatchEvent("click")
|
|
64
|
+
await expect(review.getByRole("textbox")).toBeVisible()
|
|
65
|
+
await expect(review.locator('[data-slot="line-comment-editor-label"]')).toHaveText("Commenting on line 1")
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
story("dragging the comment button down the gutter comments on every line it covers", async ({ mount, page }) => {
|
|
69
|
+
const root = await mount("components-session-review--interactive-comments")
|
|
70
|
+
const review = root.locator('[data-component="session-review"]')
|
|
71
|
+
const comment = review.getByRole("button", { name: "Comment", exact: true, includeHidden: true })
|
|
72
|
+
|
|
73
|
+
await review.getByText("export const first = 1", { exact: true }).hover()
|
|
74
|
+
await expect(comment).toBeVisible()
|
|
75
|
+
const from = await comment.boundingBox()
|
|
76
|
+
const to = await review.locator('[data-column-number="3"]').boundingBox()
|
|
77
|
+
|
|
78
|
+
if (!from || !to) throw new Error("the comment button or line 3 has no layout")
|
|
79
|
+
await page.mouse.move(from.x + from.width / 2, from.y + from.height / 2)
|
|
80
|
+
await page.mouse.down()
|
|
81
|
+
await page.mouse.move(to.x + to.width / 2, to.y + to.height / 2, { steps: 4 })
|
|
82
|
+
await page.mouse.up()
|
|
83
|
+
await expect(review.locator('[data-slot="line-comment-editor-label"]')).toHaveText("Commenting on lines 1-3")
|
|
84
|
+
|
|
85
|
+
// The button sits on the range's last line; a click on it used to start a new selection from that line alone.
|
|
86
|
+
await review.locator('[data-column-number="3"]').hover()
|
|
87
|
+
const button = await review.locator('button[aria-label="Comment"]').boundingBox()
|
|
88
|
+
|
|
89
|
+
if (!button) throw new Error("the comment button has no layout")
|
|
90
|
+
await page.mouse.click(button.x + button.width / 2, button.y + button.height / 2)
|
|
91
|
+
await page.evaluate(() => new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve))))
|
|
92
|
+
await expect(review.locator('[data-slot="line-comment-editor-label"]')).toHaveText("Commenting on lines 1-3")
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
story("keeps typed comment text while other lines and comments are used", async ({ mount, page }) => {
|
|
96
|
+
const root = await mount("components-session-review--interactive-comments")
|
|
97
|
+
const review = root.locator('[data-component="session-review"]')
|
|
98
|
+
const textbox = review.getByRole("textbox")
|
|
99
|
+
const firstLine = review.getByText("export const first = 1", { exact: true })
|
|
100
|
+
|
|
101
|
+
await review.locator('[data-line-type="change-addition"][data-column-number="2"]').click()
|
|
102
|
+
await textbox.fill("first comment")
|
|
103
|
+
await textbox.press("Enter")
|
|
104
|
+
await expect(review.getByText("first comment", { exact: true })).toBeVisible()
|
|
105
|
+
|
|
106
|
+
// The gutter button on another line used to replace the open edit with an empty draft.
|
|
107
|
+
await review.getByRole("button", { name: "More options" }).click()
|
|
108
|
+
await page.getByRole("menuitem", { name: "Edit" }).click()
|
|
109
|
+
await expect(textbox).toHaveValue("first comment")
|
|
110
|
+
await textbox.fill("edited comment")
|
|
111
|
+
// A click on another line keeps the edit, and the highlight returns to the edited line.
|
|
112
|
+
await review.locator('[data-column-number="1"]').click()
|
|
113
|
+
await expect(textbox).toHaveValue("edited comment")
|
|
114
|
+
await expect(review.locator('[data-column-number="1"]')).not.toHaveAttribute("data-selected-line")
|
|
115
|
+
await firstLine.hover()
|
|
116
|
+
await review.getByRole("button", { name: "Comment", exact: true, includeHidden: true }).dispatchEvent("click")
|
|
117
|
+
await expect(textbox).toHaveCount(1)
|
|
118
|
+
await expect(textbox).toHaveValue("edited comment")
|
|
119
|
+
await textbox.press("Enter")
|
|
120
|
+
await expect(review.getByText("edited comment", { exact: true })).toBeVisible()
|
|
121
|
+
|
|
122
|
+
// Deleting a comment used to discard the draft on another line.
|
|
123
|
+
await review.locator('[data-column-number="1"]').click()
|
|
124
|
+
await expect(review.locator('[data-slot="line-comment-editor-label"]')).toHaveText("Commenting on line 1")
|
|
125
|
+
await textbox.fill("draft text")
|
|
126
|
+
await review.getByRole("button", { name: "More options" }).click()
|
|
127
|
+
await page.getByRole("menuitem", { name: "Delete" }).click()
|
|
128
|
+
await expect(review.getByText("edited comment", { exact: true })).toHaveCount(0)
|
|
129
|
+
await expect(textbox).toHaveValue("draft text")
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
story("mentions in a diff comment pick a path, and Escape without a list cancels", async ({ mount }) => {
|
|
133
|
+
const root = await mount("components-session-review--interactive-comments")
|
|
134
|
+
const review = root.locator('[data-component="session-review"]')
|
|
135
|
+
const textbox = review.getByRole("textbox")
|
|
136
|
+
const items = review.locator('[data-slot="line-comment-mention-item"]')
|
|
137
|
+
|
|
138
|
+
await review.locator('[data-line-type="change-addition"][data-column-number="2"]').click()
|
|
139
|
+
await textbox.pressSequentially("see @rev")
|
|
140
|
+
await expect(items).toHaveCount(2)
|
|
141
|
+
await textbox.press("ArrowDown")
|
|
142
|
+
await expect(items.nth(1)).toHaveAttribute("data-active", "")
|
|
143
|
+
await textbox.press("Enter")
|
|
144
|
+
await expect(textbox).toHaveValue("see @src/review.test.ts ")
|
|
145
|
+
await expect(items).toHaveCount(0)
|
|
146
|
+
|
|
147
|
+
// A bare `@` shows no list, yet used to swallow the first Escape as if one were open.
|
|
148
|
+
await textbox.pressSequentially("@")
|
|
149
|
+
await textbox.press("Escape")
|
|
150
|
+
await expect(textbox).toHaveCount(0)
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
story("a focus request opens the comment and clears once the comment shows", async ({ mount }) => {
|
|
154
|
+
const root = await mount("components-session-review--focused-comment")
|
|
155
|
+
const comment = root.locator('[data-comment-id="comment-1"]')
|
|
156
|
+
const request = root.locator("output")
|
|
157
|
+
|
|
158
|
+
await expect(comment).toBeVisible()
|
|
159
|
+
await expect(comment).not.toHaveAttribute("data-open")
|
|
160
|
+
await root.getByRole("button", { name: "Focus comment", exact: true }).click()
|
|
161
|
+
await expect(comment).toHaveAttribute("data-open", "")
|
|
162
|
+
await expect(request).toHaveText("none")
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
story("a focus request for a comment that never renders clears after the reveal times out", async ({ mount, page }) => {
|
|
166
|
+
const root = await mount("components-session-review--focused-comment")
|
|
167
|
+
const request = root.locator("output")
|
|
168
|
+
|
|
169
|
+
await expect(root.locator('[data-comment-id="comment-1"]')).toBeVisible()
|
|
170
|
+
await page.clock.install()
|
|
171
|
+
await root.getByRole("button", { name: "Focus missing comment", exact: true }).click()
|
|
172
|
+
|
|
173
|
+
// The request used to clear on the next frame, before the comment could render.
|
|
174
|
+
await page.clock.runFor(1000)
|
|
175
|
+
await expect(request).toHaveText("missing")
|
|
176
|
+
|
|
177
|
+
await page.clock.runFor(1100)
|
|
178
|
+
await expect(request).toHaveText("none")
|
|
179
|
+
})
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { expect, story } from "../../stories/playwright/story"
|
|
2
|
+
|
|
3
|
+
story("requests live output only when the shell is expanded", async ({ mount }) => {
|
|
4
|
+
const root = await mount("current-session-terminal-work--live-user-command", { args: { expanded: false } })
|
|
5
|
+
const shell = root.locator('[data-component="session-shell-message"]')
|
|
6
|
+
const trigger = shell.locator('[data-slot="collapsible-trigger"]')
|
|
7
|
+
await expect(trigger).toHaveAttribute("aria-expanded", "false")
|
|
8
|
+
await expect(root.getByLabel("Output requests")).toHaveText("0")
|
|
9
|
+
await root.getByRole("button", { name: "Update output", exact: true }).click()
|
|
10
|
+
await expect(root.getByLabel("Output requests")).toHaveText("0")
|
|
11
|
+
await trigger.click()
|
|
12
|
+
await expect(shell.locator('[data-slot="bash-result"]')).toHaveText("ready\nnext line\n")
|
|
13
|
+
await expect(root.getByLabel("Output requests")).toHaveText(/^[1-9]\d*$/)
|
|
14
|
+
await trigger.click()
|
|
15
|
+
await expect(shell.locator('[data-component="bash-output"]')).toHaveCount(0)
|
|
16
|
+
await root.getByRole("button", { name: "Update output", exact: true }).click()
|
|
17
|
+
await trigger.click()
|
|
18
|
+
await expect(shell.locator('[data-slot="bash-result"]')).toHaveText("ready\nnext line\nnext line\n")
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
story("streams user shell output and retains the saved completion", async ({ mount }) => {
|
|
22
|
+
const root = await mount("current-session-terminal-work--live-user-command")
|
|
23
|
+
const shell = root.locator('[data-component="session-shell-message"]')
|
|
24
|
+
const output = shell.locator('[data-slot="bash-result"]')
|
|
25
|
+
await expect(shell.locator('[data-slot="bash-command"]')).toHaveText("printf ready")
|
|
26
|
+
await expect(output).toHaveText("ready\n")
|
|
27
|
+
await root.getByRole("button", { name: "Update output", exact: true }).click()
|
|
28
|
+
await expect(output).toHaveText("ready\nnext line\n")
|
|
29
|
+
await root.getByRole("button", { name: "Complete command", exact: true }).click()
|
|
30
|
+
await expect(output).toHaveText("ready\nnext line\nfinished\n")
|
|
31
|
+
await expect(shell.locator('[data-kind="tool-error-card"]')).toHaveCount(0)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
for (const [outcome, error] of [
|
|
35
|
+
["nonzero", "Command exited with code 1"],
|
|
36
|
+
["timeout", "Command timed out"],
|
|
37
|
+
["killed", "Command cancelled"],
|
|
38
|
+
]) {
|
|
39
|
+
story(`shows a direct shell ${outcome} outcome even without output`, async ({ mount }) => {
|
|
40
|
+
const root = await mount("current-session-terminal-work--live-user-command", { args: { outcome, output: false } })
|
|
41
|
+
const shell = root.locator('[data-component="session-shell-message"]')
|
|
42
|
+
await root.getByRole("button", { name: "Complete command", exact: true }).click()
|
|
43
|
+
await expect(shell.locator('[data-kind="tool-error-card"]')).toContainText(error)
|
|
44
|
+
await expect(shell.locator('[data-slot="bash-command"]')).toHaveText("printf ready")
|
|
45
|
+
await expect(shell.locator('[data-slot="bash-result"]')).toHaveCount(0)
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
for (const [id, output] of [
|
|
50
|
+
["running-a-user-command", "Starting Storybook manager...\nBuilding preview..."],
|
|
51
|
+
["user-command-completed", " M packages/session-ui/src/timeline/session-timeline.tsx"],
|
|
52
|
+
]) {
|
|
53
|
+
story(`keeps captured output without a live reader: ${id}`, async ({ mount }) => {
|
|
54
|
+
const root = await mount(`current-session-terminal-work--${id}`)
|
|
55
|
+
await expect(root.locator('[data-component="session-shell-message"] [data-slot="bash-result"]')).toHaveText(output)
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
story("copies the shell command and its output separately", async ({ mount, page }) => {
|
|
60
|
+
const root = await mount("current-session-terminal-work--expanded-shell")
|
|
61
|
+
const shell = root.locator('[data-component="bash-output"]')
|
|
62
|
+
const command = (await shell.locator('[data-slot="bash-command"]').textContent())!
|
|
63
|
+
const output = (await shell.locator('[data-slot="bash-result"]').textContent())!
|
|
64
|
+
const clipboard = async () => (await page.evaluate(() => navigator.clipboard.readText())).replaceAll("\r\n", "\n")
|
|
65
|
+
await page.context().grantPermissions(["clipboard-read", "clipboard-write"])
|
|
66
|
+
await shell.hover()
|
|
67
|
+
await shell.locator('[data-slot="bash-result"]').getByRole("button", { name: "Copy output", exact: true }).click()
|
|
68
|
+
await expect(shell.locator('[data-slot="bash-result"]').getByRole("button", { name: "Copied" })).toBeVisible()
|
|
69
|
+
expect(await clipboard()).toBe(output)
|
|
70
|
+
await shell.locator('[data-slot="bash-command"]').getByRole("button", { name: "Copy", exact: true }).click()
|
|
71
|
+
expect(await clipboard()).toBe(command)
|
|
72
|
+
expect(command).toContain("opencode api get /openapi.json")
|
|
73
|
+
expect(output).toContain('"name":"OpenCode"')
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
story("keeps Copied for two seconds after the latest click", async ({ mount, page }) => {
|
|
77
|
+
await page.clock.install()
|
|
78
|
+
const root = await mount("current-session-terminal-work--expanded-shell")
|
|
79
|
+
const result = root.locator('[data-component="bash-output"] [data-slot="bash-result"]')
|
|
80
|
+
await page.context().grantPermissions(["clipboard-read", "clipboard-write"])
|
|
81
|
+
await result.hover()
|
|
82
|
+
await result.getByRole("button", { name: "Copy output", exact: true }).click()
|
|
83
|
+
await expect(result.getByRole("button", { name: "Copied" })).toBeVisible()
|
|
84
|
+
await page.clock.runFor(1_500)
|
|
85
|
+
await result.getByRole("button", { name: "Copied" }).click()
|
|
86
|
+
// The first click's reset falls due here, while the second click's feedback still runs.
|
|
87
|
+
await page.clock.runFor(900)
|
|
88
|
+
await expect(result.getByRole("button", { name: "Copied" })).toBeVisible()
|
|
89
|
+
await expect(page.getByRole("tooltip", { name: "Copied" })).toBeVisible()
|
|
90
|
+
await page.clock.runFor(1_200)
|
|
91
|
+
await expect(result.getByRole("button", { name: "Copy output", exact: true })).toBeVisible()
|
|
92
|
+
await expect(page.getByRole("tooltip")).toBeHidden()
|
|
93
|
+
})
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { expect, story } from "../../stories/playwright/story"
|
|
2
|
+
|
|
3
|
+
story.describe("touch timeline", () => {
|
|
4
|
+
story.use({ hasTouch: true, isMobile: true, viewport: { width: 390, height: 844 } })
|
|
5
|
+
|
|
6
|
+
story("keeps message actions and metadata visible without hover", async ({ mount, page }) => {
|
|
7
|
+
const timeline = await mount("current-session-timeline-rows--response-speed")
|
|
8
|
+
expect(await page.evaluate(() => matchMedia("(hover: none)").matches)).toBe(true)
|
|
9
|
+
|
|
10
|
+
for (const action of [
|
|
11
|
+
{ slot: "user-message-menu", name: "More actions" },
|
|
12
|
+
{ slot: "text-part-copy-wrapper", name: "Copy response" },
|
|
13
|
+
]) {
|
|
14
|
+
const actions = timeline.locator(`[data-slot="${action.slot}"]`)
|
|
15
|
+
await expect(actions).toHaveCount(1)
|
|
16
|
+
await expect(actions).toHaveCSS("opacity", "1")
|
|
17
|
+
await expect(actions).toHaveCSS("pointer-events", "auto")
|
|
18
|
+
await expect(actions.getByRole("button", { name: action.name, exact: true })).toBeVisible()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Agent and model are omitted on mobile, leaving only the response duration.
|
|
22
|
+
await expect(timeline.locator('[data-slot="user-message-meta-item"]')).toHaveCount(0)
|
|
23
|
+
await expect(timeline.locator('[data-slot="user-message-pending"]')).toBeHidden()
|
|
24
|
+
const responseMeta = timeline.locator('[data-slot="text-part-meta"]')
|
|
25
|
+
await expect(responseMeta).not.toBeEmpty()
|
|
26
|
+
await expect(responseMeta).not.toContainText("Build")
|
|
27
|
+
await expect(responseMeta).not.toContainText("Sonnet")
|
|
28
|
+
await expect(responseMeta.locator('[data-slot="text-part-meta-speed"]')).toHaveText("·60.0 tok/s")
|
|
29
|
+
await expect(responseMeta.locator('[data-slot="text-part-meta-speed"]')).toBeHidden()
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
story("keeps the always-shown chevron clear of the prompt's text", async ({ mount }) => {
|
|
33
|
+
const timeline = await mount("current-prompt-message--pending")
|
|
34
|
+
await timeline.getByLabel("Delivery state").selectOption("delivered")
|
|
35
|
+
const bubble = timeline.locator('[data-slot="user-message-text"]')
|
|
36
|
+
await expect(bubble.getByRole("button", { name: "More actions", exact: true })).toBeVisible()
|
|
37
|
+
|
|
38
|
+
// Every rendered line box of the prompt, against the chevron's box: none may overlap.
|
|
39
|
+
const overlaps = await bubble.evaluate((element) => {
|
|
40
|
+
const menu = element.querySelector('[data-slot="user-message-menu"]')
|
|
41
|
+
const chevron = menu?.querySelector("button")?.getBoundingClientRect()
|
|
42
|
+
|
|
43
|
+
if (!menu || !chevron) throw new Error("The chevron is not rendered")
|
|
44
|
+
|
|
45
|
+
const walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT, {
|
|
46
|
+
acceptNode: (node) => (menu.contains(node) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT),
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
const lines: DOMRect[] = []
|
|
50
|
+
|
|
51
|
+
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
|
|
52
|
+
const range = document.createRange()
|
|
53
|
+
range.selectNodeContents(node)
|
|
54
|
+
lines.push(...range.getClientRects())
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (lines.length === 0) throw new Error("The prompt has no text")
|
|
58
|
+
|
|
59
|
+
return lines.filter(
|
|
60
|
+
(line) =>
|
|
61
|
+
line.width > 0 &&
|
|
62
|
+
line.left < chevron.right &&
|
|
63
|
+
line.right > chevron.left &&
|
|
64
|
+
line.top < chevron.bottom &&
|
|
65
|
+
line.bottom > chevron.top,
|
|
66
|
+
).length
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
expect(overlaps).toBe(0)
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
story("keeps shell copy visible without hover", async ({ mount }) => {
|
|
73
|
+
const timeline = await mount("current-session-terminal-work--expanded-shell")
|
|
74
|
+
const copy = timeline.locator('[data-slot="bash-copy"]')
|
|
75
|
+
await expect(copy).toHaveCount(2)
|
|
76
|
+
|
|
77
|
+
for (const button of await copy.all()) {
|
|
78
|
+
await expect(button).toHaveCSS("opacity", "1")
|
|
79
|
+
await expect(button).toHaveCSS("pointer-events", "auto")
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
story("keeps error copy visible without hover", async ({ mount, page }) => {
|
|
84
|
+
const errors = await mount("components-tool-error-card--all")
|
|
85
|
+
const patch = errors.locator('[data-kind="tool-error-card"]').filter({ hasText: "Patch" })
|
|
86
|
+
await patch.getByRole("button", { name: /Patch.*Verification failed/ }).tap()
|
|
87
|
+
await page.touchscreen.tap(385, 800)
|
|
88
|
+
const copy = patch.locator('[data-slot="tool-error-card-copy"]')
|
|
89
|
+
await expect(copy).toHaveCSS("opacity", "1")
|
|
90
|
+
await expect(copy).toHaveCSS("pointer-events", "auto")
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
story("keeps fenced code copy visible without hover", async ({ mount }) => {
|
|
94
|
+
const markdown = await mount("components-markdown--complete-response")
|
|
95
|
+
const code = markdown.locator('[data-component="markdown-code"]').filter({ hasText: "export const value = 42" })
|
|
96
|
+
await expect(code).toHaveCount(1)
|
|
97
|
+
const footer = code.locator('[data-slot="markdown-code-toolbar"]')
|
|
98
|
+
await expect(footer.getByRole("button", { name: "Copy", exact: true })).toBeVisible()
|
|
99
|
+
await expect(footer).toHaveCSS("opacity", "1")
|
|
100
|
+
await expect(footer).toHaveCSS("pointer-events", "auto")
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
story("stops lighting a compaction divider once a tap closes it", async ({ mount }) => {
|
|
104
|
+
const timeline = await mount("current-session-timeline-rows--compaction-and-continuation")
|
|
105
|
+
const divider = timeline.locator('[data-slot="session-compaction-divider"]')
|
|
106
|
+
const label = divider.locator('[data-slot="session-compaction-label"]')
|
|
107
|
+
const rest = await label.evaluate((element) => getComputedStyle(element).color)
|
|
108
|
+
|
|
109
|
+
await divider.tap()
|
|
110
|
+
await expect(divider).toHaveAttribute("aria-expanded", "true")
|
|
111
|
+
await expect(label).not.toHaveCSS("color", rest)
|
|
112
|
+
|
|
113
|
+
// The tap leaves :hover on the divider, which must not keep the open colour.
|
|
114
|
+
await divider.tap()
|
|
115
|
+
await expect(divider).toHaveAttribute("aria-expanded", "false")
|
|
116
|
+
await expect(label).toHaveCSS("color", rest)
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
story("desktop user message actions still appear on hover and keyboard focus", async ({ mount, page }) => {
|
|
121
|
+
const timeline = await mount("current-session-timeline-rows--conversation", { args: { scenario: "interruption" } })
|
|
122
|
+
expect(await page.evaluate(() => matchMedia("(hover: hover)").matches)).toBe(true)
|
|
123
|
+
|
|
124
|
+
const actions = timeline.locator('[data-slot="user-message-menu"]')
|
|
125
|
+
await expect(actions).toHaveCount(1)
|
|
126
|
+
await expect(actions).toHaveCSS("opacity", "0")
|
|
127
|
+
await expect(actions).toHaveCSS("pointer-events", "none")
|
|
128
|
+
await actions.locator("..").hover()
|
|
129
|
+
await expect(actions).toHaveCSS("opacity", "1")
|
|
130
|
+
await expect(actions).toHaveCSS("pointer-events", "auto")
|
|
131
|
+
await page.mouse.move(0, 0)
|
|
132
|
+
await expect(actions).toHaveCSS("opacity", "0")
|
|
133
|
+
await actions.getByRole("button", { name: "More actions", exact: true }).focus()
|
|
134
|
+
await expect(actions).toHaveCSS("opacity", "1")
|
|
135
|
+
await expect(actions).toHaveCSS("pointer-events", "auto")
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
story("desktop keeps only the latest response copy visible at rest", async ({ mount, page }) => {
|
|
139
|
+
const timeline = await mount("current-session-timeline-rows--response-speed", { args: { steered: true } })
|
|
140
|
+
expect(await page.evaluate(() => matchMedia("(hover: hover)").matches)).toBe(true)
|
|
141
|
+
|
|
142
|
+
const latest = timeline.locator('[data-component="text-part"]').filter({ hasText: "The timeline checks passed." })
|
|
143
|
+
|
|
144
|
+
const latestActions = latest.locator('[data-slot="text-part-copy-wrapper"]')
|
|
145
|
+
|
|
146
|
+
const latestMeta = latestActions.locator('[data-slot="text-part-meta"]')
|
|
147
|
+
|
|
148
|
+
await expect(latestActions).toHaveCSS("opacity", "1")
|
|
149
|
+
await expect(latestActions.getByRole("button", { name: "Copy response", exact: true })).toBeVisible()
|
|
150
|
+
await expect(latestMeta).toHaveCSS("opacity", "0")
|
|
151
|
+
await latest.locator('[data-slot="text-part-body"]').hover()
|
|
152
|
+
await expect(latestMeta).toHaveCSS("opacity", "1")
|
|
153
|
+
|
|
154
|
+
const earlier = timeline.locator('[data-component="text-part"]').filter({ hasText: "I'll inspect the timeline" })
|
|
155
|
+
|
|
156
|
+
const actions = earlier.locator('[data-slot="text-part-copy-wrapper"]')
|
|
157
|
+
await expect(actions).toHaveCount(1)
|
|
158
|
+
await expect(actions).toHaveCSS("height", "20px")
|
|
159
|
+
await expect(actions).toHaveCSS("margin-top", "8px")
|
|
160
|
+
await expect(actions).toHaveCSS("gap", "4px")
|
|
161
|
+
await expect(actions).toHaveCSS("opacity", "0")
|
|
162
|
+
await expect(actions).toHaveCSS("pointer-events", "none")
|
|
163
|
+
|
|
164
|
+
const copy = actions.getByRole("button", { name: "Copy response", exact: true })
|
|
165
|
+
|
|
166
|
+
await expect(copy).toHaveCSS("width", "20px")
|
|
167
|
+
await expect(copy).toHaveCSS("height", "20px")
|
|
168
|
+
await expect(copy.locator('[data-slot="icon-svg"]')).toHaveCSS("width", "14px")
|
|
169
|
+
const rest = await copy.boundingBox()
|
|
170
|
+
|
|
171
|
+
const meta = actions.locator('[data-slot="text-part-meta"]')
|
|
172
|
+
|
|
173
|
+
await expect(meta).toHaveCSS("font-size", "12px")
|
|
174
|
+
await expect(meta).toHaveCSS("line-height", "18px")
|
|
175
|
+
await expect(meta).toHaveCSS("gap", "4px")
|
|
176
|
+
await expect(meta.locator('[data-slot="text-part-meta-item"]')).toHaveText([
|
|
177
|
+
"Build",
|
|
178
|
+
"Claude Sonnet 4",
|
|
179
|
+
"Balanced",
|
|
180
|
+
"4m 50s",
|
|
181
|
+
])
|
|
182
|
+
const separators = meta.locator('[data-slot="text-part-meta-separator"]')
|
|
183
|
+
await expect(separators).toHaveCount(2)
|
|
184
|
+
|
|
185
|
+
for (const separator of await separators.all()) {
|
|
186
|
+
await expect(separator).toHaveText("\u00B7")
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
await earlier.locator('[data-slot="text-part-body"]').hover()
|
|
190
|
+
await expect(actions).toHaveCSS("opacity", "1")
|
|
191
|
+
await expect(actions).toHaveCSS("pointer-events", "auto")
|
|
192
|
+
expect(await copy.boundingBox()).toEqual(rest)
|
|
193
|
+
await copy.hover()
|
|
194
|
+
await expect(actions).toHaveCSS("opacity", "1")
|
|
195
|
+
|
|
196
|
+
await page.mouse.move(0, 0)
|
|
197
|
+
await expect(actions).toHaveCSS("opacity", "0")
|
|
198
|
+
await copy.focus()
|
|
199
|
+
await expect(actions).toHaveCSS("opacity", "1")
|
|
200
|
+
await expect(actions).toHaveCSS("pointer-events", "auto")
|
|
201
|
+
})
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { expect, story } from "../../stories/playwright/story"
|
|
2
|
+
|
|
3
|
+
// Moved from packages/app/e2e/regression/session-timeline-notices.spec.ts
|
|
4
|
+
story("renders the moved location notice as a timeline divider", async ({ mount, page }) => {
|
|
5
|
+
const directory = `/Users/usrnk1/Developer/opencode/${"nested-directory/".repeat(24)}session`
|
|
6
|
+
await page.setViewportSize({ width: 480, height: 720 })
|
|
7
|
+
const timeline = await mount("current-session-timeline-rows--conversation", { args: { scenario: "location" } })
|
|
8
|
+
const notice = timeline.locator('[data-slot="session-timeline-notice"][data-type="location-switched"]')
|
|
9
|
+
const label = notice.locator('[data-slot="session-timeline-notice-label"]')
|
|
10
|
+
const value = notice.locator('[data-slot="session-timeline-notice-value"]')
|
|
11
|
+
const tooltipTrigger = notice.locator('[data-component="tooltip-v2-trigger"]')
|
|
12
|
+
|
|
13
|
+
await expect(label).toHaveText("Moved to")
|
|
14
|
+
await expect(value).toHaveText(directory)
|
|
15
|
+
await expect(notice).not.toContainText("·")
|
|
16
|
+
await expect(notice.locator("svg")).toHaveCount(0)
|
|
17
|
+
await expect(notice).toHaveCSS("padding-top", "8px")
|
|
18
|
+
await expect(notice).toHaveCSS("padding-bottom", "8px")
|
|
19
|
+
await expect(label).toHaveCSS("font-size", "13px")
|
|
20
|
+
await expect(label).toHaveCSS("font-weight", "440")
|
|
21
|
+
await expect(label).toHaveCSS("line-height", "16px")
|
|
22
|
+
await expect(value).toHaveCSS("font-size", "13px")
|
|
23
|
+
await expect(value).toHaveCSS("font-weight", "440")
|
|
24
|
+
await expect(value).toHaveCSS("line-height", "16px")
|
|
25
|
+
await expect(value).toHaveCSS("text-overflow", "ellipsis")
|
|
26
|
+
await expect(value).toHaveCSS("white-space", "nowrap")
|
|
27
|
+
await expect(value).toHaveAttribute("dir", "ltr")
|
|
28
|
+
await expect.poll(() => value.evaluate((element) => element.scrollWidth > element.clientWidth)).toBe(true)
|
|
29
|
+
|
|
30
|
+
const tooltip = page.getByText("Session working directory changed", { exact: true })
|
|
31
|
+
await label.hover()
|
|
32
|
+
await expect(tooltip).toBeVisible()
|
|
33
|
+
await page.mouse.move(0, 0)
|
|
34
|
+
await expect(tooltip).toBeHidden()
|
|
35
|
+
await tooltipTrigger.focus()
|
|
36
|
+
await expect(tooltipTrigger).toBeFocused()
|
|
37
|
+
await expect(tooltip).toBeVisible()
|
|
38
|
+
})
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { expect, story } from "../../stories/playwright/story"
|
|
2
|
+
|
|
3
|
+
for (const mode of ["hidden", "compact", "full"] as const) {
|
|
4
|
+
for (const reasoning of ["blank", "heading"] as const) {
|
|
5
|
+
story(`projects ${mode} mode with ${reasoning} active reasoning`, async ({ mount }) => {
|
|
6
|
+
const timeline = await mount("current-session-timeline-rows--conversation", {
|
|
7
|
+
args: { scenario: "reasoning", mode, reasoning },
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
await expect(timeline.locator('[data-timeline-row="UserMessage"]')).toContainText(
|
|
11
|
+
"Find why the Session header shifts after the first streamed response.",
|
|
12
|
+
)
|
|
13
|
+
const active = mode !== "hidden"
|
|
14
|
+
const part = timeline.locator('[data-timeline-part-id="msg_projection_assistant:reasoning:0"]')
|
|
15
|
+
await expect(timeline.locator('[data-timeline-row="Thinking"]')).toHaveCount(active ? 1 : 0)
|
|
16
|
+
await expect(part).toHaveCount(active ? 1 : 0)
|
|
17
|
+
|
|
18
|
+
if (!active || reasoning !== "heading") {
|
|
19
|
+
await expect(timeline.getByText("Inspecting stability", { exact: true })).toHaveCount(0)
|
|
20
|
+
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const trigger = part.getByRole("button")
|
|
25
|
+
const body = part.getByText("I will inspect the timeline before changing its state.", { exact: true })
|
|
26
|
+
await expect(trigger).toHaveAttribute("aria-expanded", String(mode === "full"))
|
|
27
|
+
await expect(part.locator('[data-component="text-shimmer"]')).toHaveAttribute("data-active", "true")
|
|
28
|
+
|
|
29
|
+
if (mode === "compact") {
|
|
30
|
+
await expect(trigger).toContainText("Inspecting stability")
|
|
31
|
+
await expect(body).toBeHidden()
|
|
32
|
+
await trigger.click()
|
|
33
|
+
await expect(trigger).toHaveAttribute("aria-expanded", "true")
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
await expect(body).toBeVisible()
|
|
37
|
+
await trigger.click()
|
|
38
|
+
await expect(trigger).toHaveAttribute("aria-expanded", "false")
|
|
39
|
+
await expect(body).toBeHidden()
|
|
40
|
+
await expect(trigger).toContainText("Inspecting stability")
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
for (const following of ["tool", "text"] as const) {
|
|
45
|
+
story(`stops Thinking before ${following} in ${mode} mode`, async ({ mount }) => {
|
|
46
|
+
const timeline = await mount("current-session-timeline-rows--conversation", {
|
|
47
|
+
args: {
|
|
48
|
+
scenario: "reasoning",
|
|
49
|
+
mode,
|
|
50
|
+
reasoning: "heading",
|
|
51
|
+
tool: following === "tool",
|
|
52
|
+
text: following === "text" ? "The timeline is stable" : "",
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const part = timeline.locator('[data-timeline-part-id="msg_projection_assistant:reasoning:0"]')
|
|
57
|
+
|
|
58
|
+
if (following === "tool") {
|
|
59
|
+
const group = timeline.locator('[data-component="collapsed-tool-group"]')
|
|
60
|
+
const trigger = group.locator(':scope > [data-component="collapsible"] > [data-slot="collapsible-trigger"]')
|
|
61
|
+
await expect(trigger).toHaveText(/^Used\s*1\s*Skill$/)
|
|
62
|
+
await expect(trigger).toHaveAttribute("aria-expanded", "false")
|
|
63
|
+
await expect(group.locator('[data-component="context-tool-group-trigger"]')).toHaveAttribute(
|
|
64
|
+
"aria-label",
|
|
65
|
+
"Used 1 Skill",
|
|
66
|
+
)
|
|
67
|
+
await expect(timeline.getByText("Inspecting stability", { exact: true })).toBeHidden()
|
|
68
|
+
await trigger.click()
|
|
69
|
+
await expect(trigger).toHaveAttribute("aria-expanded", "true")
|
|
70
|
+
await expect(group.locator('[data-timeline-part-id="tool_reasoning_projection_skill"]')).toBeVisible()
|
|
71
|
+
await expect(group.locator('[data-component="reasoning-part"]')).toHaveCount(mode === "hidden" ? 0 : 1)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (following === "text")
|
|
75
|
+
await expect(timeline.getByText("The timeline is stable", { exact: true })).toBeVisible()
|
|
76
|
+
await expect(timeline.locator('[data-timeline-row="Thinking"]')).toHaveCount(0)
|
|
77
|
+
await expect(part).toHaveCount(mode === "hidden" ? 0 : 1)
|
|
78
|
+
|
|
79
|
+
if (mode === "hidden") return
|
|
80
|
+
const thought = part.locator('[data-slot="collapsible-trigger"]')
|
|
81
|
+
const thoughtTitle = thought.locator('[data-slot="basic-tool-tool-title"]')
|
|
82
|
+
await expect(thoughtTitle).toContainText("Thought")
|
|
83
|
+
await expect(thoughtTitle).toHaveCSS("font-size", "13px")
|
|
84
|
+
await expect(thoughtTitle).toHaveCSS("line-height", "16px")
|
|
85
|
+
await expect(thought.locator('[data-slot="basic-tool-tool-subtitle"]')).toHaveText("7s")
|
|
86
|
+
await expect(thought).toHaveAttribute("aria-expanded", String(mode === "full"))
|
|
87
|
+
await expect(thought).not.toContainText("Inspecting stability")
|
|
88
|
+
await expect(part.locator('[data-component="text-shimmer"]')).toHaveAttribute("data-active", "false")
|
|
89
|
+
|
|
90
|
+
if (mode === "compact") await thought.click()
|
|
91
|
+
await expect(
|
|
92
|
+
part.getByText("I will inspect the timeline before changing its state.", { exact: true }),
|
|
93
|
+
).toBeVisible()
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Moved from packages/app/e2e/regression/session-timeline-reasoning-projection.spec.ts
|
|
99
|
+
story("does not infer reasoning visibility from provider identity", async ({ mount }) => {
|
|
100
|
+
const timeline = await mount("current-session-timeline-rows--conversation", {
|
|
101
|
+
args: { scenario: "reasoning", reasoning: "none", text: "No reasoning payload" },
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
await expect(timeline.locator('[data-timeline-row="Thinking"]')).toHaveCount(0)
|
|
105
|
+
await expect(timeline.locator('[data-timeline-part-id*="reasoning"]')).toHaveCount(0)
|
|
106
|
+
await expect(timeline.getByText("No reasoning payload", { exact: true })).toBeVisible()
|
|
107
|
+
})
|