From d303330f2e19c930d71624e7a68231b604124cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Mon, 8 Jan 2024 18:26:26 +0100 Subject: [PATCH] chore: use system-specific modifier when running tests --- umap/tests/integration/test_drawing.py | 16 ++++++++-------- umap/tests/integration/test_import.py | 4 ++-- umap/tests/integration/test_picto.py | 4 +++- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/umap/tests/integration/test_drawing.py b/umap/tests/integration/test_drawing.py index 27a11036..4b04ea74 100644 --- a/umap/tests/integration/test_drawing.py +++ b/umap/tests/integration/test_drawing.py @@ -6,7 +6,7 @@ def test_draw_polyline(page, live_server, tilelayer): # Click on the Draw a line button on a new map. create_line = page.locator(".leaflet-control-toolbar ").get_by_title( - "Draw a polyline (Ctrl+L)" + "Draw a polyline" ) create_line.click() @@ -40,7 +40,7 @@ def test_clicking_esc_should_finish_line(page, live_server, tilelayer): # Click on the Draw a line button on a new map. create_line = page.locator(".leaflet-control-toolbar ").get_by_title( - "Draw a polyline (Ctrl+L)" + "Draw a polyline" ) create_line.click() @@ -74,7 +74,7 @@ def test_clicking_esc_should_delete_line_if_empty(page, live_server, tilelayer): # Click on the Draw a line button on a new map. create_line = page.locator(".leaflet-control-toolbar ").get_by_title( - "Draw a polyline (Ctrl+L)" + "Draw a polyline" ) create_line.click() @@ -101,7 +101,7 @@ def test_clicking_esc_should_delete_line_if_invalid(page, live_server, tilelayer # Click on the Draw a line button on a new map. create_line = page.locator(".leaflet-control-toolbar ").get_by_title( - "Draw a polyline (Ctrl+L)" + "Draw a polyline" ) create_line.click() @@ -126,7 +126,7 @@ def test_draw_polygon(page, live_server, tilelayer): # Click on the Draw a polygon button on a new map. create_line = page.locator(".leaflet-control-toolbar ").get_by_title( - "Draw a polygon (Ctrl+P)" + "Draw a polygon" ) create_line.click() @@ -160,7 +160,7 @@ def test_clicking_esc_should_finish_polygon(page, live_server, tilelayer): # Click on the Draw a polygon button on a new map. create_line = page.locator(".leaflet-control-toolbar ").get_by_title( - "Draw a polygon (Ctrl+P)" + "Draw a polygon" ) create_line.click() @@ -194,7 +194,7 @@ def test_clicking_esc_should_delete_polygon_if_empty(page, live_server, tilelaye # Click on the Draw a polygon button on a new map. create_line = page.locator(".leaflet-control-toolbar ").get_by_title( - "Draw a polygon (Ctrl+P)" + "Draw a polygon" ) create_line.click() @@ -217,7 +217,7 @@ def test_clicking_esc_should_delete_polygon_if_invalid(page, live_server, tilela # Click on the Draw a polygon button on a new map. create_line = page.locator(".leaflet-control-toolbar ").get_by_title( - "Draw a polygon (Ctrl+P)" + "Draw a polygon" ) create_line.click() diff --git a/umap/tests/integration/test_import.py b/umap/tests/integration/test_import.py index fbc21418..14f914b1 100644 --- a/umap/tests/integration/test_import.py +++ b/umap/tests/integration/test_import.py @@ -8,7 +8,7 @@ pytestmark = pytest.mark.django_db def test_umap_import_from_file(live_server, datalayer, page): page.goto(f"{live_server.url}/map/new/") - button = page.get_by_title("Import data (Ctrl+I)") + button = page.get_by_title("Import data") expect(button).to_be_visible() button.click() with page.expect_file_chooser() as fc_info: @@ -33,7 +33,7 @@ def test_umap_import_geojson_from_textarea(live_server, datalayer, page): expect(markers).to_have_count(0) expect(paths).to_have_count(0) expect(layers).to_have_count(1) - button = page.get_by_title("Import data (Ctrl+I)") + button = page.get_by_title("Import data") expect(button).to_be_visible() button.click() textarea = page.locator(".umap-upload textarea") diff --git a/umap/tests/integration/test_picto.py b/umap/tests/integration/test_picto.py index 049e379d..673c0c9c 100644 --- a/umap/tests/integration/test_picto.py +++ b/umap/tests/integration/test_picto.py @@ -1,3 +1,4 @@ +import platform from pathlib import Path import pytest @@ -80,7 +81,8 @@ def test_can_change_picto_at_datalayer_level(map, live_server, page, pictos): # Should have default img expect(marker).to_have_attribute("src", "/uploads/pictogram/star.svg") # Edit datalayer - marker.click(modifiers=["Control", "Shift"]) + modifier = "Meta" if platform.system() == "Darwin" else "Control" + marker.click(modifiers=[modifier, "Shift"]) settings = page.get_by_text("Layer properties") expect(settings).to_be_visible() shape_settings = page.get_by_text("Shape properties")