Files
opencode-manager/frontend/src/components/ui/sandboxed-html-frame.test.tsx
T
Chris Scott 0b637cadf4 feat(walkthrough): build the change walkthrough in a spawned agent session
Replace the fixed, stop-based walkthrough with an agent-built one. Every
request (Generate, Update, Regenerate, /walkthrough, the multi-run button
and the agent's open_walkthrough) now spawns a separate walkthrough
session. That session reads the diff through a new walkthrough_changes
action, writes one self-contained HTML file into a Manager-owned
directory, and calls publish_walkthrough; the panel renders the file in a
sandboxed frame shared with the inline artifact card and the file browser
HTML preview.

Publication marks the walkthrough ready while execution is tracked
separately, so Stop, the 15-minute limit, polling, refine gating and
interruption when the target session is deleted follow the agent instead
of the first publish. One diff copy is reused per run. Regenerate
interrupts the previous session and removes its output directory.

Walkthrough sessions are kept and listed, with their completion and error
push notifications muted. The stop pipeline, its wire schemas and the
concurrency limiter it used are removed.
2026-10-16 03:58:31 +00:00

37 lines
1.5 KiB
TypeScript

import { render, screen } from '@testing-library/react'
import { describe, it, expect } from 'vitest'
import { SandboxedHtmlFrame } from './sandboxed-html-frame'
describe('SandboxedHtmlFrame', () => {
it('restricts the iframe to allow-scripts without same-origin access', () => {
render(<SandboxedHtmlFrame src="/artifact" title="Artifact" />)
const iframe = screen.getByTitle('Artifact')
expect(iframe).toHaveAttribute('sandbox', 'allow-scripts')
expect(iframe.getAttribute('sandbox')).not.toContain('allow-same-origin')
})
it('sets a no-referrer policy', () => {
const { container } = render(<SandboxedHtmlFrame src="/artifact" title="Artifact" />)
const iframe = container.querySelector('iframe')
expect(iframe).toHaveAttribute('referrerpolicy', 'no-referrer')
})
it('remounts the iframe when reloadKey changes', () => {
const { container, rerender } = render(
<SandboxedHtmlFrame src="/artifact" title="Artifact" reloadKey={1} />,
)
const first = container.querySelector('iframe')
rerender(<SandboxedHtmlFrame src="/artifact" title="Artifact" reloadKey={2} />)
const second = container.querySelector('iframe')
expect(second).not.toBe(first)
})
it('merges the className prop with the base classes', () => {
const { container } = render(
<SandboxedHtmlFrame src="/artifact" title="Artifact" className="h-[480px]" />,
)
const iframe = container.querySelector('iframe')
expect(iframe).toHaveClass('block', 'w-full', 'border-0', 'bg-white', 'h-[480px]')
})
})