# 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: tests/ui/district-delegates.spec.ts >> GU delegate district index link serves the graph-current page
- Location: tests/ui/district-delegates.spec.ts:7:7

# Error details

```
Error: expect(locator).toContainText(expected) failed

Locator: locator('.entity-search-result')
Timeout: 5000ms
- Expected substring  - 1
+ Received string     + 5

- At-Large Delegate District
+
+           GU-00 · Congressional
+           Guam
+           
+         

Call log:
  - Expect "toContainText" locator('.entity-search-result') with timeout 5000ms
  - waiting for locator('.entity-search-result')
    14 × locator resolved to <a href="/districts/gu-00/" class="entity-search-result">…</a>
       - unexpected value "
          GU-00 · Congressional
          Guam
          
        "

```

```yaml
- link "GU-00 · Congressional Guam":
  - /url: /districts/gu-00/
```

# Test source

```ts
  1  | import { test, expect } from '@playwright/test';
  2  | 
  3  | // sites#459: Census 98 rows have current graph IDs while their slug aliases
  4  | // may be retired (410) and the replacement 00 alias can be stale (#462).
  5  | // Keep this in the deployed suite: a fixture-only test cannot detect alias skew.
  6  | for (const state of ['AS', 'GU', 'MP', 'VI']) {
  7  |   test(`${state} delegate district index link serves the graph-current page`, async ({ page }) => {
  8  |     await page.goto(`/districts/?state=${state}&tab=congressional`);
  9  |     await expect(page.locator('#district-state-select')).toHaveValue(state);
  10 |     const result = page.locator('.entity-search-result');
  11 |     await expect(result).toHaveCount(1, { timeout: 15000 });
> 12 |     await expect(result).toContainText('At-Large Delegate District');
     |                          ^ Error: expect(locator).toContainText(expected) failed
  13 |     const href = await result.getAttribute('href');
  14 |     expect(href).toMatch(/^\/districts\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/$/);
  15 |     const response = await page.goto(href!);
  16 |     expect(response?.status(), `${state}: ${href} must not be a retired or missing alias`).toBe(200);
  17 |     await expect(page.locator('h1')).toBeVisible();
  18 |   });
  19 | }
  20 | 
```