diff --git a/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.test.tsx b/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.test.tsx index 6fa362ff9bf..bab415abcf3 100644 --- a/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.test.tsx +++ b/src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.test.tsx @@ -197,96 +197,6 @@ describe('ClientHostedBrowserPagePane', () => { expect(screen.getByText('Client-hosted browser unavailable')).not.toBeNull() expect(document.querySelector('webview')).toBeNull() }) - - it('requests the one-time intro tour on the first active client-hosted page', async () => { - vi.useFakeTimers() - const { useAppStore } = await import('@/store') - const prior = { - persistedUIReady: useAppStore.getState().persistedUIReady, - contextualToursSeenIds: useAppStore.getState().contextualToursSeenIds, - activeContextualTourId: useAppStore.getState().activeContextualTourId - } - useAppStore.setState({ - persistedUIReady: true, - contextualToursSeenIds: [], - activeContextualTourId: null - }) - const { webview } = createWebview() - mocks.attach.mockReturnValue(retainedAttachment(webview)) - try { - render( - - ) - // Why: happy-dom rects are zero-sized and the tour gate requires a measurable target. - const target = document.querySelector( - '[data-contextual-tour-target="client-hosted-browser-controls"]' - ) - expect(target).not.toBeNull() - target!.getBoundingClientRect = () => new DOMRect(0, 0, 400, 32) - await act(async () => { - await vi.advanceTimersByTimeAsync(0) - }) - expect(useAppStore.getState().activeContextualTourId).toBe('client-hosted-browser') - } finally { - useAppStore.setState(prior) - vi.useRealTimers() - } - }) - - it('never re-requests the intro tour once it has been seen', async () => { - vi.useFakeTimers() - const { useAppStore } = await import('@/store') - const prior = { - persistedUIReady: useAppStore.getState().persistedUIReady, - contextualToursSeenIds: useAppStore.getState().contextualToursSeenIds, - activeContextualTourId: useAppStore.getState().activeContextualTourId - } - useAppStore.setState({ - persistedUIReady: true, - contextualToursSeenIds: ['client-hosted-browser'], - activeContextualTourId: null - }) - const { webview } = createWebview() - mocks.attach.mockReturnValue(retainedAttachment(webview)) - try { - render( - - ) - // Why: same measurable target as the positive case — only seenIds differs. - const target = document.querySelector( - '[data-contextual-tour-target="client-hosted-browser-controls"]' - ) - expect(target).not.toBeNull() - target!.getBoundingClientRect = () => new DOMRect(0, 0, 400, 32) - await act(async () => { - await vi.advanceTimersByTimeAsync(0) - }) - expect(useAppStore.getState().activeContextualTourId).toBeNull() - } finally { - useAppStore.setState(prior) - vi.useRealTimers() - } - }) }) describe('ClientHostedBrowserPagePane address bar parity', () => { diff --git a/src/renderer/src/components/browser-pane/annotate/browser-annotation-output.test.ts b/src/renderer/src/components/browser-pane/annotate/browser-annotation-output.test.ts index c2b5fdb82f7..b0079dabb8e 100644 --- a/src/renderer/src/components/browser-pane/annotate/browser-annotation-output.test.ts +++ b/src/renderer/src/components/browser-pane/annotate/browser-annotation-output.test.ts @@ -103,18 +103,6 @@ describe('formatBrowserAnnotationsAsMarkdown', () => { expect(markdown).not.toContain('\n## injected') }) - it('heads document preview annotations with the Windows file path', () => { - const annotation = makeAnnotation() - const sanitizedUrl = 'C:\\repo\\docs\\report.html' - const markdown = formatBrowserAnnotationsAsMarkdown([ - makeAnnotation({ - payload: { ...annotation.payload, page: { ...annotation.payload.page, sanitizedUrl } } - }) - ]) - - expect(markdown).toContain(`## Design Feedback: ${sanitizedUrl}`) - }) - it('does not split surrogate pairs at the inline annotation cap', () => { const annotation = makeAnnotation() const selectedText = `${'x'.repeat(BROWSER_ANNOTATION_INLINE_TEXT_MAX_LENGTH - 1)}😀tail` diff --git a/src/renderer/src/components/browser-pane/annotate/browser-grab-toast-owner-cleanup.test.tsx b/src/renderer/src/components/browser-pane/annotate/browser-grab-toast-owner-cleanup.test.tsx index dc279e30bd6..75877305444 100644 --- a/src/renderer/src/components/browser-pane/annotate/browser-grab-toast-owner-cleanup.test.tsx +++ b/src/renderer/src/components/browser-pane/annotate/browser-grab-toast-owner-cleanup.test.tsx @@ -287,27 +287,6 @@ describe('browser grab toast owner', () => { expect(next.view.result.current.grabToast).toBeNull() expect(vi.getTimerCount()).toBe(0) }) - it.each(['clipboard', 'interaction'] as const)( - 'honors reentrant cleanup during %s delivery', - async (point) => { - const payload = makePayload() - extract.mockResolvedValue({ ok: true, payload }) - const { view, bounds } = mount() - if (point === 'clipboard') { - writes.mockImplementationOnce(() => view.unmount()) - } else { - state.recordFeatureInteraction.mockImplementationOnce(() => view.unmount()) - } - await act(async () => { - view.result.current.handleGrabActionShortcut('c') - await Promise.resolve() - }) - expect(writes.mock.calls).toEqual([[formatGrabPayloadAsText(payload)]]) - expect(state.recordFeatureInteraction.mock.calls).toEqual([['browser-grab']]) - expect(bounds).not.toHaveBeenCalled() - expect(vi.getTimerCount()).toBe(0) - } - ) it('preserves latest target reads and screenshot completion after cleanup', async () => { const extraction = deferred() const image = deferred<{ ok: true; screenshot: typeof screenshot }>() diff --git a/src/renderer/src/components/browser-pane/browser-reopen-on-server.test.ts b/src/renderer/src/components/browser-pane/browser-reopen-on-server.test.ts deleted file mode 100644 index ea8e840138c..00000000000 --- a/src/renderer/src/components/browser-pane/browser-reopen-on-server.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' -import { ORCA_BROWSER_BLANK_URL } from '../../../../shared/constants' - -const mocks = vi.hoisted(() => ({ - createWebRuntimeSessionBrowserTab: vi.fn(async (_args: Record) => true) -})) - -vi.mock('@/runtime/browser/creation/web-runtime-browser-creation', () => ({ - createWebRuntimeSessionBrowserTab: mocks.createWebRuntimeSessionBrowserTab -})) - -import { resolveBrowserReopenOnServerUrl } from './browser-reopen-on-server' - -describe('resolveBrowserReopenOnServerUrl', () => { - it('reopens blank rather than replaying something the new engine cannot restore', () => { - expect(resolveBrowserReopenOnServerUrl(ORCA_BROWSER_BLANK_URL)).toBeUndefined() - expect(resolveBrowserReopenOnServerUrl('about:blank')).toBeUndefined() - expect(resolveBrowserReopenOnServerUrl('file:///etc/hosts')).toBeUndefined() - expect(resolveBrowserReopenOnServerUrl('')).toBeUndefined() - expect(resolveBrowserReopenOnServerUrl(null)).toBeUndefined() - expect(resolveBrowserReopenOnServerUrl(undefined)).toBeUndefined() - }) -}) diff --git a/src/renderer/src/components/browser-pane/workspace-doc/doc-preview-webview-attach.test.ts b/src/renderer/src/components/browser-pane/workspace-doc/doc-preview-webview-attach.test.ts deleted file mode 100644 index 243b075427a..00000000000 --- a/src/renderer/src/components/browser-pane/workspace-doc/doc-preview-webview-attach.test.ts +++ /dev/null @@ -1,51 +0,0 @@ -// @vitest-environment happy-dom -import { expect, it, vi } from 'vitest' -import { publishNativeChatVisualGuestTheme } from '@/components/native-chat/media/visuals/NativeChatVisualGuestThemePublisher' - -vi.mock('@/components/native-chat/media/visuals/NativeChatVisualGuestThemePublisher', () => ({ - publishNativeChatVisualGuestTheme: vi.fn() -})) -import { acquireWebviewsDragPassthrough } from '../host-guest/webview-drag-passthrough' -import { webviewRegistry } from '../host-guest/webview-registry' -import { attachDocPreviewWebview } from './doc-preview-webview-attach' - -function attach(previewId: string, container: HTMLDivElement) { - return attachDocPreviewWebview({ - previewId, - container, - url: 'orca-preview://grant/index.html', - ariaLabel: 'HTML preview', - onLoadStarted: vi.fn(), - onLoadStopped: vi.fn(), - onLoadFailed: vi.fn(), - onNavigated: vi.fn(), - onTitleUpdated: vi.fn(), - onViewportMessage: vi.fn() - }) -} - -it('restores pointer input when a drag ends after attaching a document preview', () => { - const container = document.createElement('div') - document.body.appendChild(container) - const append = vi.spyOn(container, 'appendChild') - append.mockImplementation((node) => { - expect(publishNativeChatVisualGuestTheme).toHaveBeenCalledTimes(1) - expect((node as HTMLElement).style.pointerEvents).toBe('none') - return Node.prototype.appendChild.call(container, node) - }) - const release = acquireWebviewsDragPassthrough() - const attached = attach('preview-drag', container) - - try { - expect(webviewRegistry.get('preview-drag')).toBe(attached.webview) - expect(attached.webview.style.pointerEvents).toBe('none') - release() - expect(attached.webview.style.pointerEvents).toBe('') - } finally { - release() - attached.detach() - container.remove() - append.mockRestore() - } - expect(webviewRegistry.has('preview-drag')).toBe(false) -})