fix: reopen preserved coding projects when selecting their folder
This commit is contained in:
@@ -25,6 +25,39 @@ async function selectProgrammingProjectFolder(
|
||||
}
|
||||
|
||||
test.describe('Coding project identity UX', () => {
|
||||
test('reopens the same folder after removing its project from Makelore', async ({ launchElectronApp }) => {
|
||||
const projectPath = await mkdtemp(path.join(tmpdir(), 'makelore-readd-e2e-'));
|
||||
const app = await launchElectronApp({ skipSetup: true });
|
||||
|
||||
try {
|
||||
const page = await selectProgrammingProjectFolder(app, projectPath);
|
||||
const createDialog = page.getByRole('dialog', { name: '新建项目' });
|
||||
await page.getByTestId('sidebar-create-project').click();
|
||||
await createDialog.getByRole('button', { name: '选择路径' }).click();
|
||||
await createDialog.getByRole('button', { name: '确认创建' }).click();
|
||||
await expect(page.getByTestId('coding-chat-empty-agent')).toBeVisible();
|
||||
const originalConfig = await readProjectConfig(projectPath);
|
||||
await writeFile(path.join(projectPath, 'knowledge', 'notes.md'), 'Keep my notes');
|
||||
|
||||
await page.getByRole('button', { name: '创建项目智能体' }).click();
|
||||
await expect(page.getByTestId('project-configuration-page')).toBeVisible();
|
||||
await page.getByRole('button', { name: '删除项目', exact: true }).click();
|
||||
await page.getByRole('button', { name: '确认删除项目', exact: true }).click();
|
||||
await expect(page.getByTestId('project-configuration-page')).toHaveCount(0);
|
||||
|
||||
await page.getByTestId('sidebar-create-project').click();
|
||||
await createDialog.getByRole('button', { name: '选择路径' }).click();
|
||||
await createDialog.getByRole('button', { name: '确认创建' }).click();
|
||||
await expect(createDialog).toBeHidden();
|
||||
await expect(page.getByTestId('coding-chat-empty-agent')).toBeVisible();
|
||||
expect(await readProjectConfig(projectPath)).toEqual(originalConfig);
|
||||
expect(await readFile(path.join(projectPath, 'knowledge', 'notes.md'), 'utf8')).toBe('Keep my notes');
|
||||
} finally {
|
||||
await closeElectronApp(app);
|
||||
await rm(projectPath, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test('keeps the service identity automatic and invisible to young users', async ({ launchElectronApp }) => {
|
||||
const projectPath = await mkdtemp(path.join(tmpdir(), 'makelore-identity-e2e-'));
|
||||
const app = await launchElectronApp({ skipSetup: true });
|
||||
|
||||
Reference in New Issue
Block a user