Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions wework/src/components/layout/DesktopWorkbenchLayout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1161,8 +1161,10 @@ describe('DesktopWorkbenchLayout', () => {

expect(screen.getByTestId('project-create-dialog')).toBeInTheDocument()
expect(screen.getByRole('heading', { name: '选择项目文件夹' })).toBeInTheDocument()
expect(screen.getByTestId('project-device-tab-device-1')).toHaveTextContent('executor')
expect(screen.getByTestId('project-folder-select-button')).toBeInTheDocument()
expect(screen.getByTestId('project-folder-create-button')).toBeInTheDocument()
expect(screen.queryByTestId('project-name-input')).not.toBeInTheDocument()
expect(screen.queryByTestId('projects-create-button-menu')).not.toBeInTheDocument()
expect(screen.queryByTestId('project-start-from-scratch-button')).not.toBeInTheDocument()
expect(onRefreshDevices).toHaveBeenCalledTimes(1)
Expand Down Expand Up @@ -1202,6 +1204,7 @@ describe('DesktopWorkbenchLayout', () => {

expect(screen.getByText('选择项目文件夹')).toBeInTheDocument()
expect(screen.getByTestId('project-folder-select-button')).toBeInTheDocument()
expect(screen.queryByTestId('project-name-input')).not.toBeInTheDocument()
expect(onRefreshDevices).toHaveBeenCalledTimes(1)

resolveRefreshDevices?.()
Expand Down Expand Up @@ -1236,6 +1239,7 @@ describe('DesktopWorkbenchLayout', () => {
await userEvent.click(screen.getByTestId('projects-create-button'))

expect(screen.getByTestId('project-create-dialog')).toBeInTheDocument()
expect(screen.getByTestId('project-device-tab-old-device')).toHaveTextContent('需升级')
expect(screen.getByTestId('project-device-unavailable-old-device')).toHaveTextContent(
'当前 v1.8.4,需要 1.8.5 或以上'
)
Expand Down Expand Up @@ -1334,6 +1338,9 @@ describe('DesktopWorkbenchLayout', () => {
name: 'executor',
status: 'online',
is_default: true,
device_type: 'local',
bind_shell: 'claudecode',
executor_version: '1.8.5',
},
],
}}
Expand All @@ -1359,6 +1366,7 @@ describe('DesktopWorkbenchLayout', () => {
expect(screen.getByText('选择项目文件夹')).toBeInTheDocument()
expect(screen.getByTestId('project-folder-select-button')).toBeInTheDocument()
expect(screen.getByTestId('project-folder-create-button')).toBeInTheDocument()
expect(screen.queryByTestId('project-name-input')).not.toBeInTheDocument()
expect(screen.getByTestId('create-project-button')).toHaveTextContent('创建项目')
})

Expand Down Expand Up @@ -1468,6 +1476,7 @@ describe('DesktopWorkbenchLayout', () => {
expect(onListDeviceDirectories).toHaveBeenCalledWith('device-1', '/home/ubuntu')
)
expect(screen.queryByText('.cache')).not.toBeInTheDocument()
expect(screen.getByTestId('device-folder-path-input')).toHaveValue('/home/ubuntu')

const repoEntry = await screen.findByText('repo')
await userEvent.click(repoEntry)
Expand Down
2 changes: 1 addition & 1 deletion wework/src/components/layout/TaskForkDialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,11 @@ describe('TaskForkDialog', () => {

await userEvent.click(screen.getByTestId('task-fork-bind-device-local-3'))
expect(await screen.findByTestId('project-create-dialog')).toBeInTheDocument()
await userEvent.click(screen.getByTestId('project-workspace-kind-worktree'))
await userEvent.click(screen.getByTestId('project-folder-select-button'))
await waitFor(() =>
expect(screen.getByTestId('device-folder-path-input')).toHaveValue('/home/alice')
)
await userEvent.click(screen.getByTestId('project-workspace-kind-worktree'))
await userEvent.click(await screen.findByText('office-project'))
await userEvent.click(screen.getByTestId('confirm-device-folder-picker-button'))
await userEvent.click(screen.getByTestId('create-project-button'))
Expand Down
4 changes: 1 addition & 3 deletions wework/src/components/projects/ProjectCreateDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,7 @@ function ProjectCreateDialogContent({

const visibleDevices = allProjectDevices
const activeDevice =
visibleDevices.find(
device => device.device_id === activeDeviceId && canSelectDeviceTab(device)
) ??
visibleDevices.find(device => device.device_id === activeDeviceId) ??
visibleDevices.find(canSelectDeviceTab) ??
null
const pickerDevice = folderPickerState
Expand Down
Loading