From d3920f66e93a7f17981e527ff147e2b8d7dbc6a3 Mon Sep 17 00:00:00 2001 From: Kpa-clawbot Date: Sun, 3 May 2026 11:43:12 -0700 Subject: [PATCH] fix(test): correct leaflet-container selector in geofilter E2E (#1017) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Fixes the `Geofilter draft: save → reload → load → download round-trip` Playwright E2E test that was failing on master with a 10s `waitForFunction` timeout. ## Root cause `test-e2e-playwright.js:2270` used the descendant combinator `'#map .leaflet-container'`, expecting a child element. Leaflet's `L.map('map')` adds the `leaflet-container` class **directly to the `#map` element itself**, so the descendant query never matched and the wait hung until timeout. ## Fix Single-character edit: drop the space between `#map` and `.leaflet-container` so the selector matches the same element (`#map.leaflet-container`). ```diff -await page.waitForFunction(() => window.L && document.querySelector('#map .leaflet-container'), { timeout: 10000 }); +await page.waitForFunction(() => window.L && document.querySelector('#map.leaflet-container'), { timeout: 10000 }); ``` The working `Map page loads with markers` test at line 289 already uses the bare `.leaflet-container` selector, confirming the convention. ## TDD exemption **Test-fix exemption (per AGENTS.md TDD rules):** this PR fixes an existing failing test assertion with no production behavior change. The "red" state is current master (test currently times out in CI run 25287101810). No production code is touched; the geofilter feature itself works (Leaflet initializes correctly — the test just never observed it due to the broken selector). Going forward, the test continues to gate the geofilter draft round-trip behavior. ## Verification - CI Playwright E2E job should now reach past line 2270 and exercise the geofilter buttons (`#btnSaveDraft`, `#btnLoadDraft`, `#btnDownload`). - No other tests modified. Co-authored-by: you --- test-e2e-playwright.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-e2e-playwright.js b/test-e2e-playwright.js index 01a86029..be371b83 100644 --- a/test-e2e-playwright.js +++ b/test-e2e-playwright.js @@ -2267,7 +2267,7 @@ async function run() { await page.waitForSelector('#map', { timeout: 10000 }); await page.evaluate(() => localStorage.removeItem('geofilter-draft')); // Wait for leaflet to finish initial render so click handlers are bound. - await page.waitForFunction(() => window.L && document.querySelector('#map .leaflet-container'), { timeout: 10000 }); + await page.waitForFunction(() => window.L && document.querySelector('#map.leaflet-container'), { timeout: 10000 }); await page.waitForTimeout(300); // Click 3 distinct points on the map to form a polygon.