test(e2e): repair investigation textarea selectors
This commit is contained in:
@@ -64,7 +64,7 @@ test("initial page renders idle state with textarea and Analyse button", async (
|
||||
|
||||
// Idle: textarea placeholder visible
|
||||
await expect(page.getByRole("textbox")).toBeVisible();
|
||||
await expect(page.getByRole("textbox").first()).toHaveAttribute("placeholder", /Describe/);
|
||||
await expect(page.locator('[data-testid="scenario-textarea"]')).toBeVisible();
|
||||
|
||||
// Analyse button present (disabled since no text)
|
||||
const analyseBtn = page.getByRole("button", { name: "Analyse" });
|
||||
@@ -85,7 +85,7 @@ test("selecting a scenario from dropdown auto-fills central statement and enable
|
||||
});
|
||||
|
||||
// Type the scenario text directly and verify Analyse is enabled
|
||||
const textarea = page.locator("textarea[placeholder*=Describe]");
|
||||
const textarea = page.locator('[data-testid="scenario-textarea"]');
|
||||
await textarea.fill(SCENARIO_LOOKUP["Happy path — complete investigation"].centralStatement);
|
||||
|
||||
// Analyse button should be enabled (scenario has content)
|
||||
@@ -116,7 +116,7 @@ test("multi-turn investigation: start → answer → start again with new questi
|
||||
});
|
||||
|
||||
// Type scenario text directly
|
||||
const textarea = page.locator("textarea[placeholder*=Describe]");
|
||||
const textarea = page.locator('[data-testid="scenario-textarea"]');
|
||||
await textarea.fill(MULTI_TURN.centralStatement);
|
||||
|
||||
// Click Analyse
|
||||
@@ -131,7 +131,7 @@ test("multi-turn investigation: start → answer → start again with new questi
|
||||
await expect(workspace).toBeVisible();
|
||||
|
||||
// ── Phase 2: Submit first answer ──
|
||||
const answerTextarea = page.locator('textarea[placeholder*=Answer]');
|
||||
const answerTextarea = page.locator('[data-testid="response-textarea"]');
|
||||
if (await answerTextarea.isVisible({ timeout: 3000 })) {
|
||||
await answerTextarea.fill(MULTI_TURN.answerSequence[0].text);
|
||||
await page.getByRole("button", { name: "Update situation" }).click();
|
||||
@@ -146,7 +146,7 @@ test("multi-turn investigation: start → answer → start again with new questi
|
||||
}
|
||||
|
||||
// ── Phase 3: Submit second answer ──
|
||||
const answerTextarea2 = page.locator('textarea[placeholder*=Answer]');
|
||||
const answerTextarea2 = page.locator('[data-testid="response-textarea"]');
|
||||
if (await answerTextarea2.isVisible({ timeout: 3000 })) {
|
||||
await answerTextarea2.fill(MULTI_TURN.answerSequence[1].text);
|
||||
await page.getByRole("button", { name: "Update situation" }).click();
|
||||
@@ -174,7 +174,7 @@ test("genuine completion: all unknowns resolved → CompletionCard visible", asy
|
||||
});
|
||||
|
||||
// Type and submit
|
||||
const textarea = page.locator("textarea[placeholder*=Describe]");
|
||||
const textarea = page.locator('[data-testid="scenario-textarea"]');
|
||||
await textarea.fill(COMPLETE.centralStatement);
|
||||
await page.getByRole("button", { name: "Analyse" }).click();
|
||||
|
||||
@@ -183,7 +183,7 @@ test("genuine completion: all unknowns resolved → CompletionCard visible", asy
|
||||
await waitForWorkspaceReady(page);
|
||||
|
||||
// If there's a question, submit it (complete scenario's turn 0 should eventually give terminal)
|
||||
const answerTextarea = page.locator('textarea[placeholder*=Answer]');
|
||||
const answerTextarea = page.locator('[data-testid="response-textarea"]');
|
||||
if (await answerTextarea.isVisible({ timeout: 3000 })) {
|
||||
await answerTextarea.fill(COMPLETE.answerSequence[0].text);
|
||||
await page.getByRole("button", { name: "Update situation" }).click();
|
||||
@@ -220,7 +220,7 @@ test("evidence-limit: unknowns remain but no next question → EvidenceLimitCard
|
||||
window.__MOCK_SCENARIO = "evidence-limit";
|
||||
});
|
||||
|
||||
const textarea = page.locator("textarea[placeholder*=Describe]");
|
||||
const textarea = page.locator('[data-testid="scenario-textarea"]');
|
||||
await textarea.fill(INVESTIGATION_SCENARIOS[2].centralStatement);
|
||||
await page.getByRole("button", { name: "Analyse" }).click();
|
||||
|
||||
@@ -260,7 +260,7 @@ test("reset clears all state and returns to idle", async ({ page }) => {
|
||||
});
|
||||
|
||||
// Start an investigation
|
||||
const textarea = page.locator("textarea[placeholder*=Describe]");
|
||||
const textarea = page.locator('[data-testid="scenario-textarea"]');
|
||||
await textarea.fill(COMPLETE.centralStatement);
|
||||
await page.getByRole("button", { name: "Analyse" }).click();
|
||||
|
||||
@@ -290,7 +290,7 @@ test("loading overlay appears on submit and disappears after response", async ({
|
||||
window.__MOCK_SCENARIO = "";
|
||||
});
|
||||
|
||||
const textarea = page.locator("textarea[placeholder*=Describe]");
|
||||
const textarea = page.locator('[data-testid="scenario-textarea"]');
|
||||
await textarea.fill(INVESTIGATION_SCENARIOS[0].centralStatement);
|
||||
|
||||
// Verify workspace is NOT visible before submitting
|
||||
@@ -319,7 +319,7 @@ test("update submission replaces response panel with loading card, preserves con
|
||||
});
|
||||
|
||||
// Start investigation
|
||||
const textarea = page.locator("textarea[placeholder*=Describe]");
|
||||
const textarea = page.locator('[data-testid="scenario-textarea"]');
|
||||
await textarea.fill(INVESTIGATION_SCENARIOS[0].centralStatement);
|
||||
await page.getByRole("button", { name: "Analyse" }).click();
|
||||
|
||||
@@ -330,7 +330,7 @@ test("update submission replaces response panel with loading card, preserves con
|
||||
await expect(workspace).toBeVisible();
|
||||
|
||||
// Submit an answer to trigger update loading
|
||||
const answerTextarea = page.locator('textarea[placeholder*=Answer]');
|
||||
const answerTextarea = page.locator('[data-testid="response-textarea"]');
|
||||
if (await answerTextarea.isVisible({ timeout: 3000 })) {
|
||||
// Current investigation visible before click
|
||||
await expect(page.getByRole("heading", { name: "Current investigation" })).toBeVisible();
|
||||
@@ -345,7 +345,7 @@ test("update submission replaces response panel with loading card, preserves con
|
||||
await expect(page.getByRole("heading", { name: "Current investigation" })).toBeVisible({ timeout: 5_000 });
|
||||
|
||||
// Response textarea hidden — replaced by loading overlay
|
||||
const rwTextarea = page.locator('#rw-answer');
|
||||
const rwTextarea = page.locator('[data-testid="response-textarea"]');
|
||||
await expect(rwTextarea).not.toBeVisible({ timeout: 3_000 });
|
||||
|
||||
// Loading overlay visible in response panel position
|
||||
@@ -380,7 +380,7 @@ test("investigation map preview: appears after start, topics evolve across mocke
|
||||
window.__MOCK_SCENARIO = "complete";
|
||||
});
|
||||
|
||||
const textarea = page.locator("textarea[placeholder*=Describe]");
|
||||
const textarea = page.locator('[data-testid="scenario-textarea"]');
|
||||
await textarea.fill(INVESTIGATION_SCENARIOS[0].centralStatement);
|
||||
await page.getByRole("button", { name: "Analyse" }).click();
|
||||
|
||||
@@ -405,7 +405,7 @@ test("investigation map preview: appears after start, topics evolve across mocke
|
||||
await expect(byStatus("current")).toHaveCount(1);
|
||||
|
||||
// Submit first answer → turn 1: one more established, next topic becomes current
|
||||
const answerTextarea = page.locator('textarea[placeholder*=Answer]');
|
||||
const answerTextarea = page.locator('[data-testid="response-textarea"]');
|
||||
if (await answerTextarea.isVisible({ timeout: 3000 })) {
|
||||
await answerTextarea.fill("The figures are comparable.");
|
||||
await page.getByRole("button", { name: "Update situation" }).click();
|
||||
@@ -421,7 +421,7 @@ test("investigation map preview: appears after start, topics evolve across mocke
|
||||
await expect(byStatus("current")).toHaveCount(1);
|
||||
|
||||
// Submit second answer → turn 2
|
||||
const answerTextarea2 = page.locator('textarea[placeholder*=Answer]');
|
||||
const answerTextarea2 = page.locator('[data-testid="response-textarea"]');
|
||||
if (await answerTextarea2.isVisible({ timeout: 3000 })) {
|
||||
await answerTextarea2.fill("Complaint rate fell from 2.0 to 1.9 per 100 units.");
|
||||
await page.getByRole("button", { name: "Update situation" }).click();
|
||||
|
||||
Reference in New Issue
Block a user