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

# Error details

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

Locator:  locator('.entity-search-result')
Expected: 1
Received: 0
Timeout:  15000ms

Call log:
  - Expect "toHaveCount" locator('.entity-search-result') with timeout 15000ms
  - waiting for locator('.entity-search-result')
    34 × locator resolved to 0 elements
       - unexpected value "0"

```

# Page snapshot

```yaml
- generic [active] [ref=e1]:
  - link "← Back to Home" [ref=e2] [cursor=pointer]:
    - /url: /
  - banner [ref=e3]:
    - heading "Districts" [level=1] [ref=e4]
    - paragraph [ref=e5]: Congressional, State Senate and State House districts
  - generic [ref=e6]:
    - button "Congressional map" [ref=e7] [cursor=pointer]
    - button "List" [ref=e8] [cursor=pointer]
  - main [ref=e9]:
    - generic [ref=e11]:
      - generic [ref=e12]:
        - textbox "Search districts by name..." [ref=e13]
        - button "Search" [ref=e14] [cursor=pointer]
      - generic [ref=e15]:
        - button "All" [ref=e16] [cursor=pointer]
        - button "Congressional" [pressed] [ref=e17] [cursor=pointer]
        - button "State Senate" [ref=e18] [cursor=pointer]
        - button "State House" [ref=e19] [cursor=pointer]
      - generic [ref=e20]:
        - generic [ref=e21]: "State:"
        - combobox "State:" [ref=e22] [cursor=pointer]:
          - option "All states"
          - option "Alabama"
          - option "Alaska"
          - option "American Samoa" [selected]
          - option "Arizona"
          - option "Arkansas"
          - option "California"
          - option "Colorado"
          - option "Connecticut"
          - option "Delaware"
          - option "District of Columbia"
          - option "Florida"
          - option "Georgia"
          - option "Guam"
          - option "Hawaii"
          - option "Idaho"
          - option "Illinois"
          - option "Indiana"
          - option "Iowa"
          - option "Kansas"
          - option "Kentucky"
          - option "Louisiana"
          - option "Maine"
          - option "Maryland"
          - option "Massachusetts"
          - option "Michigan"
          - option "Minnesota"
          - option "Mississippi"
          - option "Missouri"
          - option "Montana"
          - option "Nebraska"
          - option "Nevada"
          - option "New Hampshire"
          - option "New Jersey"
          - option "New Mexico"
          - option "New York"
          - option "North Carolina"
          - option "North Dakota"
          - option "Northern Mariana Islands"
          - option "Ohio"
          - option "Oklahoma"
          - option "Oregon"
          - option "Pennsylvania"
          - option "Puerto Rico"
          - option "Rhode Island"
          - option "South Carolina"
          - option "South Dakota"
          - option "Tennessee"
          - option "Texas"
          - option "U.S. Virgin Islands"
          - option "Utah"
          - option "Vermont"
          - option "Virginia"
          - option "Washington"
          - option "West Virginia"
          - option "Wisconsin"
          - option "Wyoming"
      - generic [ref=e23]:
        - heading "All Districts" [level=3] [ref=e25]
        - paragraph [ref=e27]: No entities found.
```

# 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 });
     |                          ^ Error: expect(locator).toHaveCount(expected) failed
  12 |     await expect(result).toContainText('At-Large Delegate District');
  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 | 
```