From c60559f2625568dd39c423cddea2f0b60b324496 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Tue, 17 Nov 2026 01:37:34 -0800 Subject: [PATCH] test: remove low-value dialog presentation assertions (#43556) Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com> --- .../AgentSessionContinuationDialog.test.tsx | 27 ---- .../wsl/AddWslHostDialogBody.test.tsx | 27 ---- .../DeleteWorktreeTargetPreview.test.tsx | 138 ------------------ .../ui/dialog-unified-layout.test.tsx | 20 --- 4 files changed, 212 deletions(-) delete mode 100644 src/renderer/src/components/sidebar/workspace-actions/deletion/DeleteWorktreeTargetPreview.test.tsx diff --git a/src/renderer/src/components/agent-session-continuation/AgentSessionContinuationDialog.test.tsx b/src/renderer/src/components/agent-session-continuation/AgentSessionContinuationDialog.test.tsx index 882288fcc60..d3e55b9742f 100644 --- a/src/renderer/src/components/agent-session-continuation/AgentSessionContinuationDialog.test.tsx +++ b/src/renderer/src/components/agent-session-continuation/AgentSessionContinuationDialog.test.tsx @@ -51,30 +51,3 @@ it('moves initial focus to the Agent trigger when detection finishes', async () await waitFor(() => expect(screen.getByRole('button', { name: 'Agent field' })).toHaveFocus()) await userEvent.click(screen.getByRole('button', { name: 'Cancel' })) }) - -it('focuses the Agent field and shows the cost helper only for the full transcript', async () => { - render( - {}} - request={{ - worktreeId: 'wt-1', - workspacePath: '/tmp/fix-login', - launchSource: 'sidebar', - source: { - sourceAgent: 'claude', - capturedText: 'Current task', - transcriptPath: '/tmp/session.jsonl' - } - }} - /> - ) - await waitFor(() => expect(screen.getByRole('button', { name: 'Agent field' })).toHaveFocus()) - expect(screen.queryByText('Slower, and uses more of your plan or API credits.')).toBeNull() - await userEvent.click(screen.getByRole('combobox', { name: 'Context' })) - await userEvent.click(screen.getByRole('option', { name: 'Full transcript' })) - expect(screen.getByText('Slower, and uses more of your plan or API credits.')).toBeVisible() - await userEvent.click(screen.getByRole('combobox', { name: 'Context' })) - await userEvent.click(screen.getByRole('option', { name: 'Latest status (recommended)' })) - expect(screen.queryByText('Slower, and uses more of your plan or API credits.')).toBeNull() -}) diff --git a/src/renderer/src/components/sidebar/host-admission/wsl/AddWslHostDialogBody.test.tsx b/src/renderer/src/components/sidebar/host-admission/wsl/AddWslHostDialogBody.test.tsx index c6e7199b536..0418d36ce68 100644 --- a/src/renderer/src/components/sidebar/host-admission/wsl/AddWslHostDialogBody.test.tsx +++ b/src/renderer/src/components/sidebar/host-admission/wsl/AddWslHostDialogBody.test.tsx @@ -49,33 +49,6 @@ describe('AddWslHostDialogBody', () => { progress = null }) - it('names the install lock an Add waits on instead of the generic setup hint', async () => { - render() - const add = await screen.findByRole('button', { name: 'Add host' }) - await waitFor(() => expect(add.hasAttribute('disabled')).toBe(false)) - fireEvent.click(add) - await waitFor(() => expect(progress).not.toBeNull()) - expect(screen.getByText(/Installing and starting the Orca server/)).toBeTruthy() - - const waiting = - 'Waiting for another Orca install in this distro to finish. If it doesn’t, Orca stops waiting in about 2 minutes.' - act(() => - progress?.({ - distro: 'Ubuntu', - detail: waiting, - detailCode: 'installLockWaitGivesUp', - detailParams: { count: 2 } - }) - ) - expect(screen.getByText(waiting)).toBeTruthy() - expect(screen.queryByText(/Installing and starting the Orca server/)).toBeNull() - - // Once the lock is taken, the setup hint returns. - act(() => progress?.({ distro: 'Ubuntu', detail: null })) - expect(screen.queryByText(waiting)).toBeNull() - expect(screen.getByText(/Installing and starting the Orca server/)).toBeTruthy() - }) - // Another window's Add broadcasts to every window; it must not touch this dialog's wait. it('ignores another distro’s Add progress and matches its own case-insensitively', async () => { const hosts = window.api.runtimeEnvironments?.wslHosts diff --git a/src/renderer/src/components/sidebar/workspace-actions/deletion/DeleteWorktreeTargetPreview.test.tsx b/src/renderer/src/components/sidebar/workspace-actions/deletion/DeleteWorktreeTargetPreview.test.tsx deleted file mode 100644 index 48d24ac1004..00000000000 --- a/src/renderer/src/components/sidebar/workspace-actions/deletion/DeleteWorktreeTargetPreview.test.tsx +++ /dev/null @@ -1,138 +0,0 @@ -// @vitest-environment happy-dom -import '@testing-library/jest-dom/vitest' -import { cleanup, render, screen } from '@testing-library/react' -import { afterEach, expect, it } from 'vitest' -import { makeWorktree } from '@/store/slices/worktrees/worktree.test-fixture' -import { getWorktreeHostIdentity } from '../../../../../../shared/worktree/host-qualified-identity' -import { DeleteWorktreeTargetPreview } from './DeleteWorktreeTargetPreview' - -afterEach(cleanup) - -it('does not present a partial numeric total when one workspace has uncounted dirty changes', () => { - const worktrees = [ - makeWorktree({ id: 'wt-1', repoId: 'repo-1' }), - makeWorktree({ id: 'wt-2', repoId: 'repo-1' }) - ] - const { container } = render( - - ) - expect(container.querySelector('[data-slot="dialog-warning"]')).toHaveTextContent( - 'Uncommitted changes will be lost' - ) -}) - -it.each([ - { - name: 'unsaved-only with incomplete scans', - changes: undefined, - unsaved: 2, - ignored: false, - incomplete: true, - warning: '2 unsaved files will be lost' - }, - { - name: 'uncommitted changes and ignored files', - changes: 13, - unsaved: 0, - ignored: true, - incomplete: false, - warning: '26 uncommitted changes and ignored files will be lost' - }, - { - name: 'all three known losses', - changes: 13, - unsaved: 2, - ignored: true, - incomplete: false, - warning: '26 uncommitted changes, 2 unsaved files and ignored files will be lost' - }, - { - name: 'clean workspaces with incomplete scans', - changes: undefined, - unsaved: 0, - ignored: false, - incomplete: true, - warning: null - }, - { - name: 'ignored files only', - changes: undefined, - unsaved: 0, - ignored: true, - incomplete: false, - warning: 'Ignored files will be lost' - } -])( - 'preserves the independent consequences for $name', - ({ changes, unsaved, ignored, incomplete, warning }) => { - const worktrees = [ - makeWorktree({ id: 'wt-1', repoId: 'repo-1', displayName: 'fix-login' }), - makeWorktree({ id: 'wt-2', repoId: 'repo-1', displayName: 'docs-refresh' }) - ] - const { container } = render( - [ - getWorktreeHostIdentity(item), - { - status: 'complete', - files: { - count: ignored ? 2 : 0, - samplePaths: ignored ? ['.env'] : [], - complete: !incomplete - } - } - ]) - ) - } - /> - ) - const warnings = container.querySelectorAll('[data-slot="dialog-warning"]') - expect(warnings).toHaveLength(warning ? 1 : 0) - if (warning) { - expect(warnings[0]).toHaveTextContent(warning) - } - expect(screen.queryByText('Some changes couldn’t be fully checked.')).toBe( - incomplete ? screen.getByText('Some changes couldn’t be fully checked.') : null - ) - } -) diff --git a/src/renderer/src/components/ui/dialog-unified-layout.test.tsx b/src/renderer/src/components/ui/dialog-unified-layout.test.tsx index b57d09b68f6..52bb773f468 100644 --- a/src/renderer/src/components/ui/dialog-unified-layout.test.tsx +++ b/src/renderer/src/components/ui/dialog-unified-layout.test.tsx @@ -43,31 +43,11 @@ function UnifiedDialog({ describe('unified dialog layout', () => { afterEach(cleanup) - it('drops the close X when the footer has Cancel, and keeps it on default dialogs', () => { - const { unmount } = render() - expect(screen.queryByRole('button', { name: 'Close' })).not.toBeInTheDocument() - unmount() - - render( - - - Settings - - - ) - expect(screen.getByRole('button', { name: 'Close' })).toBeInTheDocument() - }) - it('starts focus on Cancel when asked, ahead of earlier controls', async () => { render() await waitFor(() => expect(screen.getByRole('button', { name: 'Cancel' })).toHaveFocus()) }) - it('keeps focus inside a busy dialog whose Cancel button is disabled', async () => { - render() - await waitFor(() => expect(screen.getByRole('button', { name: 'Show changes' })).toHaveFocus()) - }) - it('blocks Esc and Cancel while busy, and closes on Esc otherwise', async () => { const onOpenChange = vi.fn() const { rerender } = render()