Files
paseo/packages/app/e2e/permission-prompt.spec.ts
T
Mohamed Boudra d964415eba feat(server): improve task CLI with steering, execution order, and planner guidance
- Fix steering notes to check scope task instead of leaf task
- Fix NOT_DONE replan to use scope for bird's eye view
- Pass reason to planner prompt ("Why you were called" section)
- Add execution-order.ts with reusable computeExecutionOrder and buildSortedChildrenMap
- Make 'tree' an alias for 'plan' command
- Add comprehensive help text for run command and acceptance criteria
- Add planner guidance for propagating requirements to subtasks
2026-01-17 11:46:38 +07:00

78 lines
2.4 KiB
TypeScript

import { existsSync } from 'node:fs';
import path from 'node:path';
import { test, expect } from './fixtures';
import {
createAgentWithConfig,
waitForPermissionPrompt,
allowPermission,
denyPermission,
waitForAgentIdle,
getToolCallCount,
} from './helpers/app';
import { createTempGitRepo } from './helpers/workspace';
const FILE_CONTENT = 'Hello from permission test';
test.describe('permission prompts', () => {
test('allow permission creates the file', async ({ page }) => {
const repo = await createTempGitRepo();
const uniqueFilename = `test-allow-${Date.now()}.txt`;
const filePath = path.join(repo.path, uniqueFilename);
const prompt = `Create a file named "${uniqueFilename}" with the content "${FILE_CONTENT}". Do not add any extra content.`;
try {
await createAgentWithConfig(page, {
directory: repo.path,
model: 'haiku',
mode: 'Always Ask',
prompt,
});
await waitForPermissionPrompt(page, 30000);
await allowPermission(page);
// Wait for file to be created
await expect
.poll(() => existsSync(filePath), {
message: `File ${filePath} should exist after allowing permission`,
timeout: 10000,
})
.toBe(true);
// Verify exactly one tool call is visible (no duplicate permission badge)
const toolCallCount = await getToolCallCount(page);
expect(toolCallCount).toBe(1);
} finally {
await repo.cleanup();
}
});
test('deny permission does not create the file', async ({ page }) => {
const repo = await createTempGitRepo();
const uniqueFilename = `test-deny-${Date.now()}.txt`;
const filePath = path.join(repo.path, uniqueFilename);
const prompt = `Create a file named "${uniqueFilename}" with the content "${FILE_CONTENT}". Do not add any extra content.`;
try {
await createAgentWithConfig(page, {
directory: repo.path,
model: 'haiku',
mode: 'Always Ask',
prompt,
});
await waitForPermissionPrompt(page, 30000);
await denyPermission(page);
await waitForAgentIdle(page);
expect(existsSync(filePath)).toBe(false);
// Verify exactly one tool call is visible (no duplicate permission badge)
const toolCallCount = await getToolCallCount(page);
expect(toolCallCount).toBe(1);
} finally {
await repo.cleanup();
}
});
});