From b863beaec956140c844adf542718d27ecfca7a33 Mon Sep 17 00:00:00 2001 From: David Larlet Date: Thu, 13 Jun 2024 14:13:42 -0400 Subject: [PATCH] chore: fix tests --- umap/static/umap/js/components/alerts/alert.html | 2 +- umap/tests/integration/conftest.py | 2 +- umap/tests/integration/test_anonymous_owned_map.py | 8 ++++---- umap/tests/integration/test_facets_browser.py | 2 +- umap/tests/integration/test_import.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/umap/static/umap/js/components/alerts/alert.html b/umap/static/umap/js/components/alerts/alert.html index a0d7c7c0..b65cfdde 100644 --- a/umap/static/umap/js/components/alerts/alert.html +++ b/umap/static/umap/js/components/alerts/alert.html @@ -36,7 +36,7 @@

{% translate "You can also receive that URL by email:" %}

- +
diff --git a/umap/tests/integration/conftest.py b/umap/tests/integration/conftest.py index 3f976a09..a0b4a04b 100644 --- a/umap/tests/integration/conftest.py +++ b/umap/tests/integration/conftest.py @@ -9,7 +9,7 @@ from playwright.sync_api import expect @pytest.fixture(scope="session") def browser_context_args(browser_context_args): - return {**browser_context_args, "locale": "en-GB"} + return {**browser_context_args, "locale": "en-GB", "timezone_id": "Europe/Paris"} @pytest.fixture(autouse=True) diff --git a/umap/tests/integration/test_anonymous_owned_map.py b/umap/tests/integration/test_anonymous_owned_map.py index 523589c2..91930dd9 100644 --- a/umap/tests/integration/test_anonymous_owned_map.py +++ b/umap/tests/integration/test_anonymous_owned_map.py @@ -164,7 +164,7 @@ def test_alert_message_after_create( page.goto(f"{live_server.url}/en/map/new") save = page.get_by_role("button", name="Save") expect(save).to_be_visible() - alert = page.locator("#umap-alert-container") + alert = page.locator('umap-alert-creation div[role="dialog"]') expect(alert).to_be_hidden() with page.expect_response(re.compile(r".*/map/create/")): save.click() @@ -194,13 +194,13 @@ def test_alert_message_after_create( def test_email_sending_error_are_catched(tilelayer, page, live_server): page.goto(f"{live_server.url}/en/map/new") - alert = page.locator("#umap-alert-container") + alert = page.locator('umap-alert-creation div[role="dialog"]') with page.expect_response(re.compile(r".*/map/create/")): page.get_by_role("button", name="Save").click() alert.get_by_placeholder("Email").fill("foo@bar.com") with patch("umap.views.send_mail", side_effect=SMTPException) as patched: with page.expect_response(re.compile("/en/map/.*/send-edit-link/")): - alert.get_by_role("button", name="Send me the link").click() + alert.get_by_role("input", name="Send me the link").click() assert patched.called expect(alert.get_by_text("Can't send email to foo@bar.com")).to_be_visible() @@ -214,7 +214,7 @@ def test_alert_message_after_create_show_link_even_without_mail( page.goto(f"{live_server.url}/en/map/new") with page.expect_response(re.compile(r".*/map/create/")): page.get_by_role("button", name="Save").click() - alert = page.locator("#umap-alert-container") + alert = page.locator('umap-alert-creation div[role="dialog"]') expect(alert).to_be_visible() expect( alert.get_by_text( diff --git a/umap/tests/integration/test_facets_browser.py b/umap/tests/integration/test_facets_browser.py index c386cc3c..53beae06 100644 --- a/umap/tests/integration/test_facets_browser.py +++ b/umap/tests/integration/test_facets_browser.py @@ -266,7 +266,7 @@ def test_facets_search_are_persistent_when_closing_panel(live_server, page, map) # Close panel expect(panel.locator("summary")).to_have_attribute("data-badge", " ") expect(page.locator(".umap-control-browse")).to_have_attribute("data-badge", " ") - page.get_by_role("listitem", name="Close").click() + panel.get_by_role("button", name="Close").click() page.get_by_role("button", name="See layers").click() expect(panel.get_by_label("Min")).to_have_value("13") expect(panel.get_by_label("Min")).to_have_attribute("data-modified", "true") diff --git a/umap/tests/integration/test_import.py b/umap/tests/integration/test_import.py index ac56d0ae..de7fd972 100644 --- a/umap/tests/integration/test_import.py +++ b/umap/tests/integration/test_import.py @@ -448,4 +448,4 @@ def test_import_csv_without_valid_latlon_headers(tilelayer, live_server, page): # FIXME do not create a layer expect(layers).to_have_count(1) expect(markers).to_have_count(0) - expect(page.locator("#umap-alert-container")).to_be_visible() + expect(page.locator('umap-alert div[data-level="error"]')).to_be_visible()