chore: use system-specific modifier when running tests

This commit is contained in:
Alexis Métaireau 2024-01-08 18:26:26 +01:00
parent 20814dd73c
commit d303330f2e
3 changed files with 13 additions and 11 deletions

View file

@ -6,7 +6,7 @@ def test_draw_polyline(page, live_server, tilelayer):
# Click on the Draw a line button on a new map. # Click on the Draw a line button on a new map.
create_line = page.locator(".leaflet-control-toolbar ").get_by_title( create_line = page.locator(".leaflet-control-toolbar ").get_by_title(
"Draw a polyline (Ctrl+L)" "Draw a polyline"
) )
create_line.click() 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. # Click on the Draw a line button on a new map.
create_line = page.locator(".leaflet-control-toolbar ").get_by_title( create_line = page.locator(".leaflet-control-toolbar ").get_by_title(
"Draw a polyline (Ctrl+L)" "Draw a polyline"
) )
create_line.click() 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. # Click on the Draw a line button on a new map.
create_line = page.locator(".leaflet-control-toolbar ").get_by_title( create_line = page.locator(".leaflet-control-toolbar ").get_by_title(
"Draw a polyline (Ctrl+L)" "Draw a polyline"
) )
create_line.click() 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. # Click on the Draw a line button on a new map.
create_line = page.locator(".leaflet-control-toolbar ").get_by_title( create_line = page.locator(".leaflet-control-toolbar ").get_by_title(
"Draw a polyline (Ctrl+L)" "Draw a polyline"
) )
create_line.click() 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. # Click on the Draw a polygon button on a new map.
create_line = page.locator(".leaflet-control-toolbar ").get_by_title( create_line = page.locator(".leaflet-control-toolbar ").get_by_title(
"Draw a polygon (Ctrl+P)" "Draw a polygon"
) )
create_line.click() 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. # Click on the Draw a polygon button on a new map.
create_line = page.locator(".leaflet-control-toolbar ").get_by_title( create_line = page.locator(".leaflet-control-toolbar ").get_by_title(
"Draw a polygon (Ctrl+P)" "Draw a polygon"
) )
create_line.click() 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. # Click on the Draw a polygon button on a new map.
create_line = page.locator(".leaflet-control-toolbar ").get_by_title( create_line = page.locator(".leaflet-control-toolbar ").get_by_title(
"Draw a polygon (Ctrl+P)" "Draw a polygon"
) )
create_line.click() 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. # Click on the Draw a polygon button on a new map.
create_line = page.locator(".leaflet-control-toolbar ").get_by_title( create_line = page.locator(".leaflet-control-toolbar ").get_by_title(
"Draw a polygon (Ctrl+P)" "Draw a polygon"
) )
create_line.click() create_line.click()

View file

@ -8,7 +8,7 @@ pytestmark = pytest.mark.django_db
def test_umap_import_from_file(live_server, datalayer, page): def test_umap_import_from_file(live_server, datalayer, page):
page.goto(f"{live_server.url}/map/new/") 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() expect(button).to_be_visible()
button.click() button.click()
with page.expect_file_chooser() as fc_info: 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(markers).to_have_count(0)
expect(paths).to_have_count(0) expect(paths).to_have_count(0)
expect(layers).to_have_count(1) 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() expect(button).to_be_visible()
button.click() button.click()
textarea = page.locator(".umap-upload textarea") textarea = page.locator(".umap-upload textarea")

View file

@ -1,3 +1,4 @@
import platform
from pathlib import Path from pathlib import Path
import pytest import pytest
@ -80,7 +81,8 @@ def test_can_change_picto_at_datalayer_level(map, live_server, page, pictos):
# Should have default img # Should have default img
expect(marker).to_have_attribute("src", "/uploads/pictogram/star.svg") expect(marker).to_have_attribute("src", "/uploads/pictogram/star.svg")
# Edit datalayer # 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") settings = page.get_by_text("Layer properties")
expect(settings).to_be_visible() expect(settings).to_be_visible()
shape_settings = page.get_by_text("Shape properties") shape_settings = page.get_by_text("Shape properties")