feat: add one-turn situation graph update UI
This commit is contained in:
+43
-12
@@ -4,7 +4,7 @@ const BASE_URL = process.env.PLAYWRIGHT_BASE_URL || "http://localhost:3000";
|
||||
|
||||
test.setTimeout(300000);
|
||||
|
||||
test("graph-backed start flow smoke test", async ({ page }) => {
|
||||
test("graph-backed one-turn update smoke test", async ({ page }) => {
|
||||
await page.goto(BASE_URL);
|
||||
|
||||
// Page should load without error
|
||||
@@ -26,7 +26,11 @@ test("graph-backed start flow smoke test", async ({ page }) => {
|
||||
await page.getByRole("button", { name: /Analyse/i }).click();
|
||||
|
||||
await expect(
|
||||
page.getByRole("heading", { name: /Selected Question/i }),
|
||||
page
|
||||
.locator("section")
|
||||
.filter({ hasText: /Selected Question/i })
|
||||
.last()
|
||||
.getByRole("heading", { name: /Selected Question/i }),
|
||||
).toBeVisible({ timeout: 180000 });
|
||||
await expect(
|
||||
page.getByRole("heading", { name: /Situation Graph/i }),
|
||||
@@ -40,13 +44,43 @@ test("graph-backed start flow smoke test", async ({ page }) => {
|
||||
await rawJsonToggle.click();
|
||||
await expect(page.getByText(/centralStatement/i)).toBeVisible();
|
||||
|
||||
const selectedQuestionSections = page
|
||||
.locator("section")
|
||||
.filter({ hasText: "Selected Question" });
|
||||
await expect(selectedQuestionSections).toHaveCount(1);
|
||||
const questionText = await selectedQuestionSections.first().innerText();
|
||||
expect(questionText.length).toBeGreaterThan(25);
|
||||
|
||||
const answerTextarea = page.locator(
|
||||
"textarea[placeholder*='Enter the answer']",
|
||||
);
|
||||
await expect(answerTextarea).toBeVisible();
|
||||
await answerTextarea.fill(
|
||||
"The complaint rate fell from 2.0 complaints per 100 units to 1.9 complaints per 100 units.",
|
||||
);
|
||||
await page.getByRole("button", { name: /Update situation/i }).click();
|
||||
|
||||
await expect(page.getByText(/Graph update applied/i)).toBeVisible({
|
||||
timeout: 240000,
|
||||
});
|
||||
await expect(page.getByText(/Resolved unknowns/i)).toBeVisible();
|
||||
await expect(page.getByText(/Affected nodes/i)).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(/No next question selected yet\./i),
|
||||
).toBeVisible();
|
||||
await expect(page.getByText(/Error:/i)).toHaveCount(0);
|
||||
await expect(page.getByText(/Update error:/i)).toHaveCount(0);
|
||||
await expect(answerTextarea).toHaveValue("");
|
||||
|
||||
const proposalToggle = page.getByText(/Proposal details/i);
|
||||
await expect(proposalToggle).toBeVisible();
|
||||
|
||||
await rawJsonToggle.click();
|
||||
await expect(page.getByText(/resolvedNodeIds/i)).toBeVisible();
|
||||
|
||||
// Get full body text for verification
|
||||
const bodyText = await page.locator("body").innerText();
|
||||
|
||||
console.log("\n=== UI Smoke Test Results ===");
|
||||
console.log("Page title:", await page.title());
|
||||
console.log("Body content length:", bodyText.length);
|
||||
|
||||
// Check key content indicators
|
||||
const hasSelectedQuestion = bodyText.includes("Selected Question");
|
||||
const hasComplaints =
|
||||
@@ -59,12 +93,9 @@ test("graph-backed start flow smoke test", async ({ page }) => {
|
||||
bodyText.toLowerCase().includes("denominator") ||
|
||||
bodyText.toLowerCase().includes("per-unit");
|
||||
|
||||
console.log("Has selected question heading:", hasSelectedQuestion);
|
||||
console.log("Has complaints reference:", hasComplaints);
|
||||
console.log("Has production reference:", hasProduction);
|
||||
console.log("Has rate context (rate/unit/denominator):", hasRateContext);
|
||||
|
||||
// Basic structural checks
|
||||
expect(bodyText.length).toBeGreaterThan(200);
|
||||
expect(bodyText.length).toBeGreaterThan(400);
|
||||
expect(hasSelectedQuestion).toBe(true);
|
||||
expect(bodyText.includes("Resolved unknowns")).toBe(true);
|
||||
expect(bodyText.includes("Affected nodes")).toBe(true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user