# Instructions

- Following Playwright test failed.
- Explain why, be concise, respect Playwright best practices.
- Provide a snippet of code with the fix, if possible.

# Test info

- Name: scripts/acceptance_e2e.ts >> console-v2-convergence-A acceptance >> ACCEPT-6 SSE-driven activity panel update
- Location: scripts/acceptance_e2e.ts:112:7

# Error details

```
Error: expect(locator).not.toHaveText(expected) failed

Locator:  locator('[data-testid="activity-in-flight-count"]')
Expected: not "0"
Received: "0"
Timeout:  5000ms

Call log:
  - Expect "not toHaveText" with timeout 5000ms
  - waiting for locator('[data-testid="activity-in-flight-count"]')
    14 × locator resolved to <span data-testid="activity-in-flight-count">0</span>
       - unexpected value "0"

```

```yaml
- text: "0"
```

# Test source

```ts
  24  |     await page.goto(BASE);
  25  |     const picker = page.locator('[data-testid="project-picker"]');
  26  |     await expect(picker).toBeVisible({ timeout: 5000 });
  27  |     await picker.click();
  28  |     const expected = ["tartarus", "driver-beware", "afterimage"];
  29  |     for (const id of expected) {
  30  |       await expect(page.getByText(id, { exact: true }).first()).toBeVisible();
  31  |     }
  32  |   });
  33  | 
  34  |   test("ACCEPT-2 hierarchy load against v2 paths", async ({ page }) => {
  35  |     await page.goto(BASE);
  36  |     await page.locator('[data-testid="project-picker"]').click();
  37  |     await page.getByText("tartarus", { exact: true }).first().click();
  38  |     const tree = page.locator('[data-testid="hierarchy-tree"]');
  39  |     await expect(tree).toBeVisible({ timeout: 3000 });
  40  |     const firstNode = tree.locator('[data-testid*="hierarchy"]').first();
  41  |     await expect(firstNode).toBeVisible();
  42  |     const text = (await firstNode.innerText()).trim();
  43  |     expect(text).toMatch(/^EP\d+/);
  44  |   });
  45  | 
  46  |   test("ACCEPT-3 wire-shape: zero canonical-absence fallbacks", async ({ page, request }) => {
  47  |     await page.goto(BASE);
  48  |     await page.locator('[data-testid="project-picker"]').click();
  49  |     await page.getByText("tartarus", { exact: true }).first().click();
  50  |     const firstEpisode = page.locator('[data-testid="hierarchy-tree"] [data-testid*="episode"]').first();
  51  |     await firstEpisode.click();
  52  |     await page.locator('[data-testid="hierarchy-shot-node"]').first().waitFor({ timeout: 5000 });
  53  | 
  54  |     const resp = await request.get(`${API}/api/events?scopePrefix=api/adapters/&limit=500`);
  55  |     expect(resp.ok()).toBeTruthy();
  56  |     const events = await resp.json();
  57  |     const fallbackHits = events
  58  |       .filter((e: any) => e.severity === "fallback")
  59  |       .map((e: any) => e.summary);
  60  |     for (const dead of DEAD_FALLBACKS) {
  61  |       expect(fallbackHits).not.toContain(dead);
  62  |     }
  63  |   });
  64  | 
  65  |   test("ACCEPT-4 media playback with Range support (206)", async ({ page }) => {
  66  |     await page.goto(BASE);
  67  |     await page.locator('[data-testid="project-picker"]').click();
  68  |     await page.getByText("tartarus", { exact: true }).first().click();
  69  |     const takeNode = page.locator('[data-testid*="take"]').first();
  70  |     await takeNode.click();
  71  |     const player = page.locator('[data-testid="take-video-player"]');
  72  |     await expect(player).toBeVisible({ timeout: 5000 });
  73  | 
  74  |     const mediaResponses: number[] = [];
  75  |     page.on("response", (r) => {
  76  |       if (r.url().includes("/api/media/")) mediaResponses.push(r.status());
  77  |     });
  78  | 
  79  |     await page.evaluate(() => {
  80  |       const v = document.querySelector('[data-testid="take-video-player"] video') as HTMLVideoElement | null;
  81  |       if (v && v.duration) v.currentTime = v.duration * 0.5;
  82  |     });
  83  |     await page.waitForTimeout(2000);
  84  |     expect(mediaResponses.some((s) => s === 206)).toBe(true);
  85  |   });
  86  | 
  87  |   test("ACCEPT-5 Lever->Action: Generate dry-run streams stdout", async ({ page }) => {
  88  |     await page.goto(BASE);
  89  |     await page.locator('[data-testid="project-picker"]').click();
  90  |     await page.getByText("tartarus", { exact: true }).first().click();
  91  | 
  92  |     const dryRun = page.locator('[data-testid="generate-dry-run-checkbox"]');
  93  |     if (!(await dryRun.isChecked())) await dryRun.check();
  94  | 
  95  |     const postPromise = page.waitForRequest((req) =>
  96  |       req.url().includes("/api/proposals/generate") && req.method() === "POST"
  97  |     );
  98  |     await page.locator('[data-testid="generate-button"]').click();
  99  |     const post = await postPromise;
  100 |     const postBody = JSON.parse(post.postData() ?? "{}");
  101 |     expect(postBody.dryRun).toBe(true);
  102 | 
  103 |     const drawer = page.locator('[data-testid="queue-monitor-drawer"]');
  104 |     await expect(drawer).toBeVisible({ timeout: 2000 });
  105 | 
  106 |     await page.waitForFunction(
  107 |       () => document.querySelectorAll('[data-testid="queue-monitor-drawer"] .qm-line').length >= 2,
  108 |       { timeout: 5000 }
  109 |     );
  110 |   });
  111 | 
  112 |   test("ACCEPT-6 SSE-driven activity panel update", async ({ page }) => {
  113 |     await page.goto(BASE);
  114 |     await page.locator('[data-testid="project-picker"]').click();
  115 |     await page.getByText("tartarus", { exact: true }).first().click();
  116 | 
  117 |     const counter = page.locator('[data-testid="activity-in-flight-count"]');
  118 |     const initial = parseInt((await counter.innerText()).trim() || "0", 10);
  119 | 
  120 |     const dryRun = page.locator('[data-testid="generate-dry-run-checkbox"]');
  121 |     if (!(await dryRun.isChecked())) await dryRun.check();
  122 |     await page.locator('[data-testid="generate-button"]').click();
  123 | 
> 124 |     await expect(counter).not.toHaveText(String(initial), { timeout: 5000 });
      |                               ^ Error: expect(locator).not.toHaveText(expected) failed
  125 |     await expect(counter).toHaveText(String(initial), { timeout: 30000 });
  126 |   });
  127 | 
  128 |   test("ACCEPT-7 cross-project bleed eliminated", async ({ page }) => {
  129 |     await page.goto(BASE);
  130 |     await page.locator('[data-testid="project-picker"]').click();
  131 |     await page.getByText("tartarus", { exact: true }).first().click();
  132 |     await page.locator('[data-testid="project-picker"]').click();
  133 |     await page.getByText("driver-beware", { exact: true }).first().click();
  134 | 
  135 |     const breadcrumb = page.locator('[data-testid="breadcrumb"]');
  136 |     await expect(breadcrumb).toContainText("driver-beware");
  137 | 
  138 |     const rightRail = page.locator('[data-testid="right-rail-selection"]');
  139 |     const txt = (await rightRail.innerText().catch(() => "")).trim();
  140 |     if (txt) expect(txt).toContain("driver-beware");
  141 | 
  142 |     const sources = await page.evaluate(() => {
  143 |       // @ts-expect-error custom diag hook installed in event_stream.ts
  144 |       const diag = window.__eventStreamDiag;
  145 |       return diag ? diag.openSources() : null;
  146 |     });
  147 |     if (sources !== null) {
  148 |       expect(sources.length).toBe(1);
  149 |       expect(sources[0]).toContain("scope=driver-beware");
  150 |     }
  151 |   });
  152 | 
  153 |   test("ACCEPT-8 no /api/config 404, no zombie ttyd", async ({ page }) => {
  154 |     const configHits: number[] = [];
  155 |     page.on("response", (r) => {
  156 |       if (r.url().endsWith("/api/config")) configHits.push(r.status());
  157 |     });
  158 |     await page.goto(BASE);
  159 |     await page.locator('[data-testid="project-picker"]').click();
  160 |     await page.getByText("tartarus", { exact: true }).first().click();
  161 |     await page.waitForTimeout(1500);
  162 | 
  163 |     expect(configHits.length).toBeLessThanOrEqual(1);
  164 |     if (configHits.length === 1) expect(configHits[0]).toBe(200);
  165 |     const wsCount = await page.evaluate(() => {
  166 |       // @ts-expect-error custom diag hook
  167 |       return window.__ttydDiag ? window.__ttydDiag.openWsCount() : 0;
  168 |     });
  169 |     expect(wsCount).toBeLessThanOrEqual(1);
  170 |   });
  171 | });
  172 | 
```