Add test covering changing picto from the datalayer

This commit is contained in:
Yohan Boniface 2023-11-13 16:58:54 +01:00
parent d63d81fec3
commit 00a13acb83

View file

@ -66,3 +66,37 @@ def test_can_change_picto_at_map_level(map, live_server, page, pictos):
expect(marker).to_have_attribute("src", "/uploads/pictogram/star.svg") expect(marker).to_have_attribute("src", "/uploads/pictogram/star.svg")
undefine.click() undefine.click()
expect(marker).to_have_attribute("src", "/static/umap/img/marker.png") expect(marker).to_have_attribute("src", "/static/umap/img/marker.png")
def test_can_change_picto_at_datalayer_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 datalayer
marker.click(modifiers=["Control", "Shift"])
settings = page.get_by_text("Layer 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")