# 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/geo-map.spec.ts >> /counties/kerr-county-tx/: boundary map, no missing scripts or shapes
- Location: tests/ui/geo-map.spec.ts:18:7

# Error details

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

Locator:  locator('script[src="/js/geo-map.js"][data-geo-shape]')
Expected: 1
Received: 0
Timeout:  5000ms

Call log:
  - Expect "toHaveCount" locator('script[src="/js/geo-map.js"][data-geo-shape]') with timeout 5000ms
  - waiting for locator('script[src="/js/geo-map.js"][data-geo-shape]')
    14 × locator resolved to 0 elements
       - unexpected value "0"

```

# Page snapshot

```yaml
- generic [active] [ref=e1]:
  - banner [ref=e2]:
    - heading "Kerr County, Texas" [level=1] [ref=e3]
    - paragraph [ref=e4]: County
  - generic [ref=e5]:
    - generic [ref=e6]:
      - generic [ref=e7]: Not signed in
      - generic [ref=e9]:
        - link "Log in" [ref=e10] [cursor=pointer]:
          - /url: /outpost.goauthentik.io/start?rd=https%3A%2F%2Fus.elect.info%2Fcounties%2Fkerr-county-tx%2F
        - link "Create an account" [ref=e11] [cursor=pointer]:
          - /url: /signin/register?rd=https%3A%2F%2Fus.elect.info%2Fcounties%2Fkerr-county-tx%2F
    - toolbar "Member tools" [ref=e12]:
      - button "All cycles (Sign in to use the cycle facet)" [disabled] [ref=e13] [cursor=pointer]:
        - generic [ref=e17]: All cycles
      - button "Graph (Sign in to use Graph)" [disabled] [ref=e20] [cursor=pointer]:
        - generic [ref=e29]: Graph
  - generic [ref=e32]:
    - heading "Overview" [level=2] [ref=e33]
    - generic [ref=e34]:
      - term [ref=e35]: County Name
      - definition [ref=e36]: Kerr County
      - term [ref=e37]: State
      - definition [ref=e38]:
        - link "Texas" [ref=e39] [cursor=pointer]:
          - /url: https://us.elect.info/states/texas/
      - term [ref=e40]: FIPS Code
      - definition [ref=e41]: "48265"
      - term [ref=e42]: State FIPS
      - definition [ref=e43]: "48"
      - term [ref=e44]: County FIPS
      - definition [ref=e45]: "265"
  - generic [ref=e46]:
    - heading "Geography" [level=2] [ref=e47]
    - generic [ref=e48]:
      - term [ref=e49]: Land Area
      - definition [ref=e50]: 1103.33 sq mi
      - term [ref=e51]: Water Area
      - definition [ref=e52]: 3.95 sq mi
      - term [ref=e53]: Total Area
      - definition [ref=e54]: 1107.28 sq mi
      - term [ref=e55]: Latitude
      - definition [ref=e56]: "30.059953"
      - term [ref=e57]: Longitude
      - definition [ref=e58]: "-99.353339"
  - generic [ref=e59]:
    - heading "Demographics" [level=2] [ref=e60]
    - generic [ref=e61]:
      - term [ref=e62]: Total Citizen Population
      - definition [ref=e63]: 51,451
      - term [ref=e64]: Citizen Voting Age Population (CVAP)
      - definition [ref=e65]: 41,950
    - heading "Citizen Population by Race/Ethnicity" [level=3] [ref=e66]
    - table [ref=e67]:
      - rowgroup [ref=e68]:
        - row [ref=e69]:
          - columnheader "Group" [ref=e70]
          - columnheader "Citizens" [ref=e71]
          - columnheader "Share" [ref=e72]
      - rowgroup [ref=e73]:
        - row [ref=e74]:
          - cell "Non-Hispanic" [ref=e75]
          - cell "38,758" [ref=e76]
          - cell "75.3%" [ref=e77]
        - row [ref=e78]:
          - cell "Hispanic" [ref=e79]
          - cell "12,695" [ref=e80]
          - cell "24.7%" [ref=e81]
        - row [ref=e82]:
          - cell "White" [ref=e83]
          - cell "36,593" [ref=e84]
          - cell "71.1%" [ref=e85]
        - row [ref=e86]:
          - cell "Black" [ref=e87]
          - cell "809" [ref=e88]
          - cell "1.6%" [ref=e89]
        - row [ref=e90]:
          - cell "Asian" [ref=e91]
          - cell "364" [ref=e92]
          - cell "0.7%" [ref=e93]
        - row [ref=e94]:
          - cell "American Indian / Alaska Native" [ref=e95]
          - cell "78" [ref=e96]
          - cell "0.2%" [ref=e97]
        - row [ref=e98]:
          - cell "Native Hawaiian / Pacific Islander" [ref=e99]
          - cell "6" [ref=e100]
          - cell "0.0%" [ref=e101]
        - row [ref=e102]:
          - cell "Two or More Races" [ref=e103]
          - cell "216" [ref=e104]
          - cell "0.4%" [ref=e105]
    - heading "Citizen Voting Age Population by Race/Ethnicity" [level=3] [ref=e106]
    - table [ref=e107]:
      - rowgroup [ref=e108]:
        - row [ref=e109]:
          - columnheader "Group" [ref=e110]
          - columnheader "CVAP" [ref=e111]
          - columnheader "Share" [ref=e112]
      - rowgroup [ref=e113]:
        - row [ref=e114]:
          - cell "Non-Hispanic" [ref=e115]
          - cell "33,419" [ref=e116]
          - cell "79.7%" [ref=e117]
        - row [ref=e118]:
          - cell "Hispanic" [ref=e119]
          - cell "8,535" [ref=e120]
          - cell "20.3%" [ref=e121]
        - row [ref=e122]:
          - cell "White" [ref=e123]
          - cell "31,576" [ref=e124]
          - cell "75.3%" [ref=e125]
        - row [ref=e126]:
          - cell "Black" [ref=e127]
          - cell "880" [ref=e128]
          - cell "2.1%" [ref=e129]
        - row [ref=e130]:
          - cell "Asian" [ref=e131]
          - cell "385" [ref=e132]
          - cell "0.9%" [ref=e133]
        - row [ref=e134]:
          - cell "American Indian / Alaska Native" [ref=e135]
          - cell "521" [ref=e136]
          - cell "1.2%" [ref=e137]
        - row [ref=e138]:
          - cell "Native Hawaiian / Pacific Islander" [ref=e139]
          - cell "6" [ref=e140]
          - cell "0.0%" [ref=e141]
        - row [ref=e142]:
          - cell "Two or More Races" [ref=e143]
          - cell "59" [ref=e144]
          - cell "0.1%" [ref=e145]
    - paragraph [ref=e146]: "Source: Redistricting Data Hub / U.S. Census Bureau CVAP Special Tabulation."
  - generic [ref=e147]:
    - heading "Economics" [level=2] [ref=e148]
    - generic [ref=e149]:
      - term [ref=e150]: Total Population (ACS)
      - definition [ref=e151]: 53,489
      - term [ref=e152]: Median Household Income (est.)
      - definition [ref=e153]: $72,251
      - term [ref=e154]: Poverty Rate
      - definition [ref=e155]: 10.9%
      - term [ref=e156]: Population Below Poverty
      - definition [ref=e157]: 5,834
    - heading "Population by Race (ACS)" [level=3] [ref=e158]
    - table [ref=e159]:
      - rowgroup [ref=e160]:
        - row [ref=e161]:
          - columnheader "Group" [ref=e162]
          - columnheader "Population" [ref=e163]
          - columnheader "Share" [ref=e164]
      - rowgroup [ref=e165]:
        - row [ref=e166]:
          - cell "White" [ref=e167]
          - cell "39,539" [ref=e168]
          - cell "73.9%" [ref=e169]
        - row [ref=e170]:
          - cell "Black" [ref=e171]
          - cell "850" [ref=e172]
          - cell "1.6%" [ref=e173]
        - row [ref=e174]:
          - cell "Asian" [ref=e175]
          - cell "618" [ref=e176]
          - cell "1.2%" [ref=e177]
    - paragraph [ref=e178]: "Aggregated from census tract data. Median values are population-weighted estimates. Source: ACS 5-Year Estimates."
  - generic [ref=e179]:
    - heading "Voter Registration" [level=2] [ref=e180]
    - generic [ref=e181]:
      - term [ref=e182]: Total Registered Voters
      - definition [ref=e183]: 36,329
    - heading "Registration by Party" [level=3] [ref=e184]
    - table [ref=e185]:
      - rowgroup [ref=e186]:
        - row [ref=e187]:
          - columnheader "Group" [ref=e188]
          - columnheader "Registered" [ref=e189]
          - columnheader "Share" [ref=e190]
      - rowgroup [ref=e191]:
        - row [ref=e192]:
          - cell "Democratic" [ref=e193]
          - cell "8,460" [ref=e194]
          - cell "23.3%" [ref=e195]
        - row [ref=e196]:
          - cell "Republican" [ref=e197]
          - cell "22,461" [ref=e198]
          - cell "61.8%" [ref=e199]
        - row [ref=e200]:
          - cell "Independent / Unaffiliated" [ref=e201]
          - cell "5,408" [ref=e202]
          - cell "14.9%" [ref=e203]
        - row [ref=e204]:
          - cell "Other" [ref=e205]
          - cell "0" [ref=e206]
          - cell "0.0%" [ref=e207]
    - heading "Registration by Gender" [level=3] [ref=e208]
    - table [ref=e209]:
      - rowgroup [ref=e210]:
        - row [ref=e211]:
          - columnheader "Group" [ref=e212]
          - columnheader "Registered" [ref=e213]
          - columnheader "Share" [ref=e214]
      - rowgroup [ref=e215]:
        - row [ref=e216]:
          - cell "Male" [ref=e217]
          - cell "16,989" [ref=e218]
          - cell "46.8%" [ref=e219]
        - row [ref=e220]:
          - cell "Female" [ref=e221]
          - cell "19,334" [ref=e222]
          - cell "53.2%" [ref=e223]
    - heading "Registration by Ethnicity" [level=3] [ref=e224]
    - table [ref=e225]:
      - rowgroup [ref=e226]:
        - row [ref=e227]:
          - columnheader "Group" [ref=e228]
          - columnheader "Registered" [ref=e229]
          - columnheader "Share" [ref=e230]
      - rowgroup [ref=e231]:
        - row [ref=e232]:
          - cell "White" [ref=e233]
          - cell "26,956" [ref=e234]
          - cell "74.2%" [ref=e235]
        - row [ref=e236]:
          - cell "Hispanic" [ref=e237]
          - cell "5,999" [ref=e238]
          - cell "16.5%" [ref=e239]
        - row [ref=e240]:
          - cell "Black" [ref=e241]
          - cell "102" [ref=e242]
          - cell "0.3%" [ref=e243]
        - row [ref=e244]:
          - cell "Asian" [ref=e245]
          - cell "293" [ref=e246]
          - cell "0.8%" [ref=e247]
    - paragraph [ref=e248]: "Source: L2 voter file data via Redistricting Data Hub (2022 snapshot, 50 states)."
  - generic [ref=e249]:
    - heading "Turnout" [level=2] [ref=e250]
    - generic [ref=e251]:
      - term [ref=e252]: Total Voted
      - definition [ref=e253]: 22,161
      - term [ref=e254]: Overall Turnout Rate
      - definition [ref=e255]: 61.0%
    - heading "Turnout by Ethnicity" [level=3] [ref=e256]
    - table [ref=e257]:
      - rowgroup [ref=e258]:
        - row [ref=e259]:
          - columnheader "Group" [ref=e260]
          - columnheader "Voted" [ref=e261]
          - columnheader "Turnout Rate" [ref=e262]
      - rowgroup [ref=e263]:
        - row [ref=e264]:
          - cell "White" [ref=e265]
          - cell "17,984" [ref=e266]
          - cell "66.7%" [ref=e267]
        - row [ref=e268]:
          - cell "Hispanic" [ref=e269]
          - cell "2,122" [ref=e270]
          - cell "35.4%" [ref=e271]
        - row [ref=e272]:
          - cell "Black" [ref=e273]
          - cell "36" [ref=e274]
          - cell "35.3%" [ref=e275]
        - row [ref=e276]:
          - cell "Asian" [ref=e277]
          - cell "143" [ref=e278]
          - cell "48.8%" [ref=e279]
    - heading "Turnout by Gender" [level=3] [ref=e280]
    - table [ref=e281]:
      - rowgroup [ref=e282]:
        - row [ref=e283]:
          - columnheader "Group" [ref=e284]
          - columnheader "Voted" [ref=e285]
          - columnheader "Turnout Rate" [ref=e286]
      - rowgroup [ref=e287]:
        - row [ref=e288]:
          - cell "Male" [ref=e289]
          - cell "10,268" [ref=e290]
          - cell "60.4%" [ref=e291]
        - row [ref=e292]:
          - cell "Female" [ref=e293]
          - cell "11,891" [ref=e294]
          - cell "61.5%" [ref=e295]
    - paragraph [ref=e296]: "2022 midterm general election. Source: L2 voter file data via Redistricting Data Hub (50 states)."
  - generic [ref=e297]:
    - heading "Education" [level=2] [ref=e298]
    - generic [ref=e299]:
      - term [ref=e300]: High School Diploma or Higher
      - definition [ref=e301]: 10,103 (26.1%)
      - term [ref=e302]: Bachelor's Degree or Higher
      - definition [ref=e303]: 12,379 (30.7%)
    - paragraph [ref=e304]: "Population age 25 and over. Aggregated from census tract data. Source: ACS 5-Year Estimates."
  - generic [ref=e305]:
    - heading "Housing" [level=2] [ref=e306]
    - generic [ref=e307]:
      - term [ref=e308]: Total Housing Units
      - definition [ref=e309]: 25,632
      - term [ref=e310]: Median Home Value (est.)
      - definition [ref=e311]: $322,127
      - term [ref=e312]: Median Gross Rent (est.)
      - definition [ref=e313]: $1,206
    - paragraph [ref=e314]: "Aggregated from census tract data. Median values are population-weighted estimates. Source: ACS 5-Year Estimates."
  - generic [ref=e315]:
    - heading "Commute to Work" [level=2] [ref=e316]
    - generic [ref=e317]:
      - term [ref=e318]: Drove Alone
      - definition [ref=e319]: 72.4%
      - term [ref=e320]: Public Transit
      - definition [ref=e321]: 0.1%
      - term [ref=e322]: Work From Home
      - definition [ref=e323]: 9.9%
    - paragraph [ref=e324]: "Workers age 16 and over. Aggregated from census tract data. Source: ACS 5-Year Estimates."
  - generic [ref=e325]:
    - heading "Health Insurance" [level=2] [ref=e326]
    - generic [ref=e327]:
      - term [ref=e328]: Health Insurance Coverage
      - definition [ref=e329]: 20.4%
    - paragraph [ref=e330]: "Civilian noninstitutionalized population. Aggregated from census tract data. Source: ACS 5-Year Estimates."
  - contentinfo [ref=e331]:
    - paragraph [ref=e332]:
      - link "elect.info" [ref=e333] [cursor=pointer]:
        - /url: https://us.elect.info/
      - text: "| Data from"
      - link "Federal Election Commission" [ref=e334] [cursor=pointer]:
        - /url: https://us.elect.info/datasources/fec.gov/
      - text: "| Generated 2026-10-23"
```

# Test source

```ts
  1  | import { test, expect } from '@playwright/test';
  2  | 
  3  | /*
  4  |  * /js/geo-map.js boundary maps (sites#470). Congressional District, County, Place and ZIP Code pages loaded a script
  5  |  * that never existed (a console 404 on every page). The renderer's tag now names the entity's GeoJSON; the script
  6  |  * adds a Boundary section with a Leaflet map. Missing shapes (territory delegate districts) add nothing.
  7  |  */
  8  | 
  9  | const PAGES: Array<[string, string]> = [
  10 |   ['/districts/ny-16/', 'overview'],
  11 |   ['/districts/ak-00/', 'overview'],
  12 |   ['/counties/kerr-county-tx/', 'geography'],
  13 |   ['/places/megargel-cdp-al/', 'geography'],
  14 |   ['/postalcodes/73762/', 'overview'],
  15 | ];
  16 | 
  17 | for (const [path, after] of PAGES) {
  18 |   test(`${path}: boundary map, no missing scripts or shapes`, async ({ page }) => {
  19 |     test.setTimeout(60000);
  20 |     const failures: string[] = [];
  21 |     page.on('response', r => {
  22 |       const url = r.url();
  23 |       if (r.status() >= 400 && /\/(js|geo)\//.test(url)) failures.push(`${r.status()} ${url}`);
  24 |     });
  25 |     page.on('pageerror', e => failures.push(e.message));
  26 |     const res = await page.goto(path);
  27 |     expect(res?.status(), `${path} should answer 200`).toBe(200);
  28 |     const tag = page.locator('script[src="/js/geo-map.js"][data-geo-shape]');
> 29 |     await expect(tag).toHaveCount(1);
     |                       ^ Error: expect(locator).toHaveCount(expected) failed
  30 |     expect(await tag.getAttribute('data-geo-shape')).toMatch(/^\/geo\/(districts|counties|places|zcta)\/.+\.geojson$/);
  31 |     await expect(page.locator('section#boundary[data-loaded="true"] .leaflet-container')).toBeVisible({ timeout: 30000 });
  32 |     expect(await page.locator('section#boundary').evaluate(s => s.previousElementSibling?.id)).toBe(after);
  33 |     await expect(page.locator('section#boundary a', { hasText: 'Boundary as GeoJSON' })).toHaveAttribute('href', /\.geojson$/);
  34 |     expect(failures).toEqual([]);
  35 |   });
  36 | }
  37 | 
```