diff --git a/app/app.vue b/app/app.vue index 32129f5..0659198 100644 --- a/app/app.vue +++ b/app/app.vue @@ -1,5 +1,5 @@ +` + +test.beforeEach(async ({ page, baseURL }) => { + await keepRequestsLocal(page, baseURL) +}) + +test('Ask Agent to Fix reopens a closed Agent Chat and still reaches the agent', async ({ page }) => { + const dominic = dominicHooks(page) + const chat = appWindow(page, 'Agent Chat') + const broken = appWindow(page, 'Broken (Syntax Error)') + await openDesktop(page) + + await chat.getByRole('button', { name: 'Close' }).click() + await expect(chat).toHaveCount(0) + + await dominic.injectBrokenApp('compile') + await expect(broken.getByText('Component Compilation Error')).toBeVisible() + + const requests = await stubAgentReply(page, { + text: 'Found the bug; sending a fixed version.', + updateApp: { id: 'broken-app', vueSfcCode: REPAIRED_APP, summary: 'Fix the deliberate error' }, + }) + await broken.getByRole('button', { name: 'Ask Agent to Fix' }).click() + + await expect(chat).toBeVisible() + await expect(broken.getByRole('heading', { name: 'Repaired by the agent' })).toBeVisible() + expect(requests).toHaveLength(1) +})