Improve desktop geolocation handling
This commit is contained in:
parent
07080c79d3
commit
c3999d796d
2 changed files with 28 additions and 2 deletions
|
|
@ -219,6 +219,23 @@ def test_single_postcode_match_opens_directly(chromium_browser: Any, flask_url:
|
|||
page.close()
|
||||
|
||||
|
||||
def test_browser_location_loads_nearby_stops(chromium_browser: Any, flask_url: str) -> None:
|
||||
"""A permitted desktop geolocation result is used for a nearby-stop search."""
|
||||
context = chromium_browser.new_context(geolocation={"latitude": 51.5, "longitude": -0.12})
|
||||
context.grant_permissions(["geolocation"], origin=flask_url)
|
||||
page = context.new_page()
|
||||
page.route("**/api/stops?*", lambda route: route.fulfill(json={
|
||||
"kind": "location",
|
||||
"location": {"lat": 51.5, "lon": -0.12, "label": "Your location"},
|
||||
"stops": [],
|
||||
}))
|
||||
page.goto(flask_url, wait_until="networkidle")
|
||||
page.get_by_role("button", name="Use my current location").click()
|
||||
playwright_api.expect(page).to_have_url(re.compile(r"\?lat=51.5&lon=-0.12$"))
|
||||
playwright_api.expect(page.locator("#stop-count")).to_have_text("0 found")
|
||||
context.close()
|
||||
|
||||
|
||||
def test_mobile_layout_opens_results_sheet(chromium_browser: Any, flask_url: str) -> None:
|
||||
"""The finder exposes its search panel as an open mobile bottom sheet."""
|
||||
page = chromium_browser.new_page(viewport={"width": 390, "height": 844})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue