diff --git a/tests/e2e/runner-task-creation.spec.ts b/tests/e2e/runner-task-creation.spec.ts index 14ecad24e9..30082dd1a8 100644 --- a/tests/e2e/runner-task-creation.spec.ts +++ b/tests/e2e/runner-task-creation.spec.ts @@ -17,14 +17,23 @@ for (const workMode of ["standard", "planning", "ask"] as const) { const projectResponse = await request.post(`/api/companies/${company.id}/projects`, { data: { name: "Composer project" } }); expect(projectResponse.ok()).toBe(true); const project = await projectResponse.json(); - const prompt = `Preserve this exact prompt for ${workMode}.`; - const created = await createTaskThroughUi({ page, issuePrefix: company.issuePrefix, agentName: agent.name, - title: "Fixture label distinct from the generated title", prompt, workMode, projectName: project.name }); - const issue = await (await request.get(`/api/issues/${created.issueId}`)).json(); - expect(issue).toMatchObject({ id: created.issueId, companyId: company.id, assigneeAgentId: agent.id, - projectId: project.id, description: prompt, workMode }); - expect(issue.title).not.toBe("Fixture label distinct from the generated title"); - expect(created.submittedAtMs).toBeGreaterThan(0); + const nextProjectResponse = await request.post(`/api/companies/${company.id}/projects`, { data: { name: "Next composer project" } }); + expect(nextProjectResponse.ok()).toBe(true); + const nextProject = await nextProjectResponse.json(); + const createdIds = new Set(); + // Reopen with a remembered project, then change that remembered selection. + for (const selectedProject of [project, project, nextProject]) { + const prompt = `Preserve this exact prompt for ${workMode} task ${createdIds.size + 1}.`; + const created = await createTaskThroughUi({ page, issuePrefix: company.issuePrefix, agentName: agent.name, + title: "Fixture label distinct from the generated title", prompt, workMode, projectName: selectedProject.name }); + const issue = await (await request.get(`/api/issues/${created.issueId}`)).json(); + expect(issue).toMatchObject({ id: created.issueId, companyId: company.id, assigneeAgentId: agent.id, + projectId: selectedProject.id, description: prompt, workMode }); + expect(issue.title).not.toBe("Fixture label distinct from the generated title"); + expect(created.submittedAtMs).toBeGreaterThan(0); + expect(createdIds.has(created.issueId)).toBe(false); + createdIds.add(created.issueId); + } expect(await (await request.get(`/api/companies/${company.id}/heartbeat-runs`)).json()).toEqual([]); }); } diff --git a/tests/runner-e2e/user-actions.ts b/tests/runner-e2e/user-actions.ts index 812d24cce0..bff706cc90 100644 --- a/tests/runner-e2e/user-actions.ts +++ b/tests/runner-e2e/user-actions.ts @@ -52,7 +52,8 @@ export async function createTaskThroughUi(input: { await input.page.getByRole("option").filter({ has: input.page.getByText(input.agentName, { exact: true }) }).click(); await expect(input.page.getByRole("searchbox", { name: "Search assignees", exact: true })).toBeHidden(); if (input.projectName) { - await dialog.getByRole("button", { name: "Project", exact: true }).click(); + // The selector remembers the previous project, so its visible label changes. + await dialog.locator('button[data-slot="new-issue-compact-control"]').click(); await input.page.getByPlaceholder("Search projects...").fill(input.projectName); await input.page.getByText(input.projectName, { exact: true }).last().click(); }