wip: fix more tests

This commit is contained in:
Yohan Boniface 2024-06-13 20:53:07 +02:00
parent 897d4f22f4
commit e968261dff
2 changed files with 5 additions and 4 deletions

View file

@ -194,14 +194,15 @@ def test_alert_message_after_create(
def test_email_sending_error_are_catched(tilelayer, page, live_server): def test_email_sending_error_are_catched(tilelayer, page, live_server):
page.goto(f"{live_server.url}/en/map/new") page.goto(f"{live_server.url}/en/map/new")
alert = page.locator('umap-alert-creation div[role="dialog"]') alert_creation = page.locator('umap-alert-creation div[role="dialog"]')
with page.expect_response(re.compile(r".*/map/create/")): with page.expect_response(re.compile(r".*/map/create/")):
page.get_by_role("button", name="Save").click() page.get_by_role("button", name="Save").click()
alert.get_by_placeholder("Email").fill("foo@bar.com") alert_creation.get_by_placeholder("Email").fill("foo@bar.com")
with patch("umap.views.send_mail", side_effect=SMTPException) as patched: with patch("umap.views.send_mail", side_effect=SMTPException) as patched:
with page.expect_response(re.compile("/en/map/.*/send-edit-link/")): with page.expect_response(re.compile("/en/map/.*/send-edit-link/")):
alert.get_by_role("input", name="Send me the link").click() alert_creation.get_by_role("button", name="Send me the link").click()
assert patched.called assert patched.called
alert = page.locator('umap-alert div[role="dialog"]')
expect(alert.get_by_text("Can't send email to foo@bar.com")).to_be_visible() expect(alert.get_by_text("Can't send email to foo@bar.com")).to_be_visible()

View file

@ -228,7 +228,7 @@ def test_facets_search_are_persistent_when_closing_panel(live_server, page, map)
DataLayerFactory(map=map, data=DATALAYER_DATA1) DataLayerFactory(map=map, data=DATALAYER_DATA1)
DataLayerFactory(map=map, data=DATALAYER_DATA2) DataLayerFactory(map=map, data=DATALAYER_DATA2)
page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670") page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
panel = page.locator(".umap-browser") panel = page.locator(".panel.left")
# Facet values # Facet values
odd = page.get_by_label("odd") odd = page.get_by_label("odd")