diff --git a/apps/cli/tests/profiles/cua-mcp/cua-mcp.expected.e2e.ts b/apps/cli/tests/profiles/cua-mcp/cua-mcp.expected.e2e.ts index 201c4d6b7c..c1b88715c3 100644 --- a/apps/cli/tests/profiles/cua-mcp/cua-mcp.expected.e2e.ts +++ b/apps/cli/tests/profiles/cua-mcp/cua-mcp.expected.e2e.ts @@ -73,11 +73,13 @@ describe.skipIf(!existsSync(bin))('cua-mcp profile', { retry: 0 }, () => { } }) as CallResult expect(first.isError).toBeUndefined() expect(first.content.map(block => block.type)).toEqual(['text', 'image']) - const state = JSON.parse(textOf(first.content[0])) as { visits: number; window: number; pid: number; cwd: string } + const state = JSON.parse(textOf(first.content[0])) as { visits: number; window: string; pid: number; cwd: string } expect(state).toMatchObject({ visits: 1, window: '7' }) // Without DSH_CUA_WORKSPACE the profile creates its workspace inside the Harness home and starts programs there. - expect(state.cwd).toBe(await realpath(join(home, 'cua-mcp', 'workspace'))) - expect(state.cwd).not.toBe(await realpath(launch)) + // Both spellings are resolved: the temporary directory is a symlink on macOS and an 8.3 short name on Windows. + const programDirectory = await realpath(state.cwd) + expect(programDirectory).toBe(await realpath(join(home, 'cua-mcp', 'workspace'))) + expect(programDirectory).not.toBe(await realpath(launch)) const image = first.content[1] if (image?.type !== 'image') throw new Error('expected an image block') expect(image.mimeType).toMatch(/^image\//) diff --git a/packages/experimental/cua-mcp/tests/composition.spec.ts b/packages/experimental/cua-mcp/tests/composition.spec.ts index 1295e07817..054a7c0e97 100644 --- a/packages/experimental/cua-mcp/tests/composition.spec.ts +++ b/packages/experimental/cua-mcp/tests/composition.spec.ts @@ -214,11 +214,12 @@ describe('Computer Use MCP composition', () => { + 'inspect(JSON.stringify({ visits, window: win.windowId, pid: process.pid, cwd: process.cwd() }), await win.getScreenshot())', { description: 'Open the fixture' }) expect(first.isError).not.toBe(true) // A program result is the program's own output: the inspected text, then the screenshot the program observed. - const result = JSON.parse(texts(first)[0] ?? '') as { visits: number; window: number; pid: number; cwd: string } + const result = JSON.parse(texts(first)[0] ?? '') as { visits: number; window: string; pid: number; cwd: string } expect(result).toMatchObject({ visits: 1, window: '7' }) expect(result.pid).not.toBe(process.pid) - // Programs start in the directory the connection's Agent was created in. - expect(result.cwd).toBe(await realpath(directory)) + // Programs start in the directory the connection's Agent was created in. Both spellings are resolved: the + // temporary directory is a symlink on macOS and an 8.3 short name on Windows. + expect(await realpath(result.cwd)).toBe(await realpath(directory)) const image = first.content[1] if (image?.type !== 'image') throw new Error(`expected an image block, got ${JSON.stringify(image)}`) expect(image.mimeType).toMatch(/^image\//)