diff options
| author | Shoubhit Dash <[email protected]> | 2026-03-17 19:54:20 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-17 19:54:20 +0530 |
| commit | ba2297656877f26c50d28977b0e7164868d6868c (patch) | |
| tree | 5bd14a7421723275d84617ff9f91ff0d20895926 /packages/app | |
| parent | 0afeaea21fdd85716f843b7688e0fdab712e52bb (diff) | |
| download | opencode-ba2297656877f26c50d28977b0e7164868d6868c.tar.gz opencode-ba2297656877f26c50d28977b0e7164868d6868c.zip | |
fix: inline review comment submit and layout (#17948)
Diffstat (limited to 'packages/app')
| -rw-r--r-- | packages/app/e2e/session/session-review.spec.ts | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/packages/app/e2e/session/session-review.spec.ts b/packages/app/e2e/session/session-review.spec.ts index 28c85edb0..c0421f028 100644 --- a/packages/app/e2e/session/session-review.spec.ts +++ b/packages/app/e2e/session/session-review.spec.ts @@ -123,6 +123,101 @@ async function spot(page: Parameters<typeof test>[0]["page"], file: string) { }, file) } +async function comment(page: Parameters<typeof test>[0]["page"], file: string, note: string) { + const row = page.locator(`[data-file="${file}"]`).first() + await expect(row).toBeVisible() + + const line = row.locator('diffs-container [data-line="2"]').first() + await expect(line).toBeVisible() + await line.hover() + + const add = row.getByRole("button", { name: /^Comment$/ }).first() + await expect(add).toBeVisible() + await add.click() + + const area = row.locator('[data-slot="line-comment-textarea"]').first() + await expect(area).toBeVisible() + await area.fill(note) + + const submit = row.locator('[data-slot="line-comment-action"][data-variant="primary"]').first() + await expect(submit).toBeEnabled() + await submit.click() + + await expect(row.locator('[data-slot="line-comment-content"]').filter({ hasText: note }).first()).toBeVisible() + await expect(row.locator('[data-slot="line-comment-tools"]').first()).toBeVisible() +} + +async function overflow(page: Parameters<typeof test>[0]["page"], file: string) { + const row = page.locator(`[data-file="${file}"]`).first() + const view = page.locator('[data-slot="session-review-scroll"] .scroll-view__viewport').first() + const pop = row.locator('[data-slot="line-comment-popover"][data-inline-body]').first() + const tools = row.locator('[data-slot="line-comment-tools"]').first() + + const [width, viewBox, popBox, toolsBox] = await Promise.all([ + view.evaluate((el) => el.scrollWidth - el.clientWidth), + view.boundingBox(), + pop.boundingBox(), + tools.boundingBox(), + ]) + + if (!viewBox || !popBox || !toolsBox) return null + + return { + width, + pop: popBox.x + popBox.width - (viewBox.x + viewBox.width), + tools: toolsBox.x + toolsBox.width - (viewBox.x + viewBox.width), + } +} + +test("review applies inline comment clicks without horizontal overflow", async ({ page, withProject }) => { + test.setTimeout(180_000) + + const tag = `review-comment-${Date.now()}` + const file = `review-comment-${tag}.txt` + const note = `comment ${tag}` + + await page.setViewportSize({ width: 1280, height: 900 }) + + await withProject(async (project) => { + const sdk = createSdk(project.directory) + + await withSession(sdk, `e2e review comment ${tag}`, async (session) => { + await patch(sdk, session.id, seed([{ file, mark: tag }])) + + await expect + .poll( + async () => { + const diff = await sdk.session.diff({ sessionID: session.id }).then((res) => res.data ?? []) + return diff.length + }, + { timeout: 60_000 }, + ) + .toBe(1) + + await project.gotoSession(session.id) + await show(page) + + const tab = page.getByRole("tab", { name: /Review/i }).first() + await expect(tab).toBeVisible() + await tab.click() + + await expand(page) + await waitMark(page, file, tag) + await comment(page, file, note) + + await expect + .poll(async () => (await overflow(page, file))?.width ?? Number.POSITIVE_INFINITY, { timeout: 10_000 }) + .toBeLessThanOrEqual(1) + await expect + .poll(async () => (await overflow(page, file))?.pop ?? Number.POSITIVE_INFINITY, { timeout: 10_000 }) + .toBeLessThanOrEqual(1) + await expect + .poll(async () => (await overflow(page, file))?.tools ?? Number.POSITIVE_INFINITY, { timeout: 10_000 }) + .toBeLessThanOrEqual(1) + }) + }) +}) + test("review keeps scroll position after a live diff update", async ({ page, withProject }) => { test.skip(Boolean(process.env.CI), "Flaky in CI for now.") test.setTimeout(180_000) |
