From 0562055b659ee15cfd7df5ce18ab801f49112420 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Mon, 13 Nov 2023 19:28:07 +0100 Subject: [PATCH] Picot fied: add test for changing picto from marker itself --- umap/tests/integration/test_picto.py | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/umap/tests/integration/test_picto.py b/umap/tests/integration/test_picto.py index 96675055..2856fd00 100644 --- a/umap/tests/integration/test_picto.py +++ b/umap/tests/integration/test_picto.py @@ -100,3 +100,37 @@ def test_can_change_picto_at_datalayer_level(map, live_server, page, pictos): expect(marker).to_have_attribute("src", "/uploads/pictogram/circle.svg") undefine.click() expect(marker).to_have_attribute("src", "/uploads/pictogram/star.svg") + + +def test_can_change_picto_at_marker_level(map, live_server, page, pictos): + # Faster than doing a login + map.edit_status = Map.ANONYMOUS + map.settings["properties"]["iconUrl"] = "/uploads/pictogram/star.svg" + map.save() + DataLayerFactory(map=map, data=DATALAYER_DATA) + page.goto(f"{live_server.url}{map.get_absolute_url()}?edit") + marker = page.locator(".umap-div-icon img") + expect(marker).to_have_count(1) + # Should have default img + expect(marker).to_have_attribute("src", "/uploads/pictogram/star.svg") + # Edit marker + marker.click(modifiers=["Shift"]) + settings = page.get_by_text("Feature properties") + expect(settings).to_be_visible() + shape_settings = page.get_by_text("Shape properties") + expect(shape_settings).to_be_visible() + shape_settings.click() + define = page.locator(".umap-field-iconUrl .define") + undefine = page.locator(".umap-field-iconUrl .undefine") + expect(define).to_be_visible() + expect(undefine).to_be_hidden() + define.click() + symbols = page.locator(".umap-pictogram-choice") + expect(symbols).to_have_count(2) + search = page.locator(".umap-pictogram-list input") + search.type("circle") + expect(symbols).to_have_count(1) + symbols.click() + expect(marker).to_have_attribute("src", "/uploads/pictogram/circle.svg") + undefine.click() + expect(marker).to_have_attribute("src", "/uploads/pictogram/star.svg")