chore: add openmap fixture
This commit is contained in:
parent
490a1a6e19
commit
ca8f7bf280
8 changed files with 68 additions and 123 deletions
|
@ -5,6 +5,8 @@ import pytest
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.core.signing import get_cookie_signer
|
from django.core.signing import get_cookie_signer
|
||||||
|
|
||||||
|
from umap.models import Map
|
||||||
|
|
||||||
from .base import (
|
from .base import (
|
||||||
DataLayerFactory,
|
DataLayerFactory,
|
||||||
LicenceFactory,
|
LicenceFactory,
|
||||||
|
@ -48,6 +50,13 @@ def map(licence, tilelayer):
|
||||||
return MapFactory(owner=user, licence=licence)
|
return MapFactory(owner=user, licence=licence)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def openmap(map):
|
||||||
|
map.edit_status = Map.ANONYMOUS
|
||||||
|
map.save()
|
||||||
|
return map
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def anonymap(map):
|
def anonymap(map):
|
||||||
map.owner = None
|
map.owner = None
|
||||||
|
|
|
@ -4,8 +4,6 @@ from time import sleep
|
||||||
import pytest
|
import pytest
|
||||||
from playwright.sync_api import expect
|
from playwright.sync_api import expect
|
||||||
|
|
||||||
from umap.models import Map
|
|
||||||
|
|
||||||
from ..base import DataLayerFactory
|
from ..base import DataLayerFactory
|
||||||
|
|
||||||
pytestmark = pytest.mark.django_db
|
pytestmark = pytest.mark.django_db
|
||||||
|
@ -247,10 +245,8 @@ def test_should_sort_features_in_natural_order(live_server, map, page):
|
||||||
expect(features.nth(2)).to_have_text("100. a line")
|
expect(features.nth(2)).to_have_text("100. a line")
|
||||||
|
|
||||||
|
|
||||||
def test_should_redraw_list_on_feature_delete(live_server, map, page, bootstrap):
|
def test_should_redraw_list_on_feature_delete(live_server, openmap, page, bootstrap):
|
||||||
map.edit_status = Map.ANONYMOUS
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}")
|
||||||
map.save()
|
|
||||||
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
||||||
# Enable edit
|
# Enable edit
|
||||||
page.get_by_role("button", name="Edit").click()
|
page.get_by_role("button", name="Edit").click()
|
||||||
buttons = page.locator(".umap-browse-data li .feature-delete")
|
buttons = page.locator(".umap-browse-data li .feature-delete")
|
||||||
|
@ -305,11 +301,8 @@ def test_should_allow_to_toggle_datalayer_visibility(live_server, map, page, boo
|
||||||
expect(paths).to_have_count(0)
|
expect(paths).to_have_count(0)
|
||||||
|
|
||||||
|
|
||||||
def test_should_have_edit_buttons_in_edit_mode(live_server, map, page, bootstrap):
|
def test_should_have_edit_buttons_in_edit_mode(live_server, openmap, page, bootstrap):
|
||||||
# Faster than doing a login
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}")
|
||||||
map.edit_status = Map.ANONYMOUS
|
|
||||||
map.save()
|
|
||||||
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
||||||
browser = page.locator("#umap-ui-container")
|
browser = page.locator("#umap-ui-container")
|
||||||
edit_layer = browser.get_by_title("Edit", exact=True)
|
edit_layer = browser.get_by_title("Edit", exact=True)
|
||||||
in_table = browser.get_by_title("Edit properties in a table")
|
in_table = browser.get_by_title("Edit properties in a table")
|
||||||
|
|
|
@ -4,8 +4,6 @@ from pathlib import Path
|
||||||
import pytest
|
import pytest
|
||||||
from playwright.sync_api import expect
|
from playwright.sync_api import expect
|
||||||
|
|
||||||
from umap.models import Map
|
|
||||||
|
|
||||||
from ..base import DataLayerFactory
|
from ..base import DataLayerFactory
|
||||||
|
|
||||||
pytestmark = pytest.mark.django_db
|
pytestmark = pytest.mark.django_db
|
||||||
|
@ -28,19 +26,15 @@ def test_basic_choropleth_map_with_default_color(map, live_server, page):
|
||||||
expect(page.locator("path[fill='#eff3ff']")).to_have_count(3)
|
expect(page.locator("path[fill='#eff3ff']")).to_have_count(3)
|
||||||
|
|
||||||
|
|
||||||
def test_basic_choropleth_map_with_custom_brewer(map, live_server, page):
|
def test_basic_choropleth_map_with_custom_brewer(openmap, live_server, page):
|
||||||
# Faster than doing a login
|
|
||||||
map.edit_status = Map.ANONYMOUS
|
|
||||||
map.save()
|
|
||||||
|
|
||||||
path = Path(__file__).parent.parent / "fixtures/choropleth_region_chomage.geojson"
|
path = Path(__file__).parent.parent / "fixtures/choropleth_region_chomage.geojson"
|
||||||
data = json.loads(path.read_text())
|
data = json.loads(path.read_text())
|
||||||
|
|
||||||
# Change brewer at load
|
# Change brewer at load
|
||||||
data["_umap_options"]["choropleth"]["brewer"] = "Reds"
|
data["_umap_options"]["choropleth"]["brewer"] = "Reds"
|
||||||
DataLayerFactory(data=data, map=map)
|
DataLayerFactory(data=data, map=openmap)
|
||||||
|
|
||||||
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}")
|
||||||
# Hauts-de-France
|
# Hauts-de-France
|
||||||
expect(page.locator("path[fill='#a50f15']")).to_have_count(1)
|
expect(page.locator("path[fill='#a50f15']")).to_have_count(1)
|
||||||
# Occitanie
|
# Occitanie
|
||||||
|
@ -71,19 +65,15 @@ def test_basic_choropleth_map_with_custom_brewer(map, live_server, page):
|
||||||
expect(page.locator("path[fill='#edf8e9']")).to_have_count(3)
|
expect(page.locator("path[fill='#edf8e9']")).to_have_count(3)
|
||||||
|
|
||||||
|
|
||||||
def test_basic_choropleth_map_with_custom_classes(map, live_server, page):
|
def test_basic_choropleth_map_with_custom_classes(openmap, live_server, page):
|
||||||
# Faster than doing a login
|
|
||||||
map.edit_status = Map.ANONYMOUS
|
|
||||||
map.save()
|
|
||||||
|
|
||||||
path = Path(__file__).parent.parent / "fixtures/choropleth_region_chomage.geojson"
|
path = Path(__file__).parent.parent / "fixtures/choropleth_region_chomage.geojson"
|
||||||
data = json.loads(path.read_text())
|
data = json.loads(path.read_text())
|
||||||
|
|
||||||
# Change brewer at load
|
# Change brewer at load
|
||||||
data["_umap_options"]["choropleth"]["classes"] = 6
|
data["_umap_options"]["choropleth"]["classes"] = 6
|
||||||
DataLayerFactory(data=data, map=map)
|
DataLayerFactory(data=data, map=openmap)
|
||||||
|
|
||||||
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}")
|
||||||
|
|
||||||
# Hauts-de-France
|
# Hauts-de-France
|
||||||
expect(page.locator("path[fill='#08519c']")).to_have_count(1)
|
expect(page.locator("path[fill='#08519c']")).to_have_count(1)
|
||||||
|
|
|
@ -269,15 +269,12 @@ def test_same_second_edit_doesnt_conflict(context, live_server, tilelayer):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def test_should_display_alert_on_conflict(context, live_server, datalayer, map):
|
def test_should_display_alert_on_conflict(context, live_server, datalayer, openmap):
|
||||||
map.edit_status = Map.ANONYMOUS
|
|
||||||
map.save()
|
|
||||||
|
|
||||||
# Open the map on two pages.
|
# Open the map on two pages.
|
||||||
page_one = context.new_page()
|
page_one = context.new_page()
|
||||||
page_one.goto(f"{live_server.url}{map.get_absolute_url()}?edit")
|
page_one.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
||||||
page_two = context.new_page()
|
page_two = context.new_page()
|
||||||
page_two.goto(f"{live_server.url}{map.get_absolute_url()}?edit")
|
page_two.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
||||||
|
|
||||||
page_one.locator(".leaflet-marker-icon").click(modifiers=["Shift"])
|
page_one.locator(".leaflet-marker-icon").click(modifiers=["Shift"])
|
||||||
page_one.locator('input[name="name"]').fill("new name")
|
page_one.locator('input[name="name"]').fill("new name")
|
||||||
|
|
|
@ -2,7 +2,7 @@ import re
|
||||||
|
|
||||||
from playwright.sync_api import expect
|
from playwright.sync_api import expect
|
||||||
|
|
||||||
from umap.models import DataLayer, Map
|
from umap.models import DataLayer
|
||||||
|
|
||||||
from ..base import DataLayerFactory
|
from ..base import DataLayerFactory
|
||||||
|
|
||||||
|
@ -53,12 +53,9 @@ def test_should_have_fieldset_for_layer_type_properties(page, live_server, tilel
|
||||||
|
|
||||||
|
|
||||||
def test_cancel_deleting_datalayer_should_restore(
|
def test_cancel_deleting_datalayer_should_restore(
|
||||||
live_server, map, login, datalayer, page
|
live_server, openmap, datalayer, page
|
||||||
):
|
):
|
||||||
# Faster than doing a login
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
||||||
map.edit_status = Map.ANONYMOUS
|
|
||||||
map.save()
|
|
||||||
page.goto(f"{live_server.url}{map.get_absolute_url()}?edit")
|
|
||||||
layers = page.locator(".umap-browse-datalayers li")
|
layers = page.locator(".umap-browse-datalayers li")
|
||||||
markers = page.locator(".leaflet-marker-icon")
|
markers = page.locator(".leaflet-marker-icon")
|
||||||
expect(layers).to_have_count(1)
|
expect(layers).to_have_count(1)
|
||||||
|
@ -77,11 +74,8 @@ def test_cancel_deleting_datalayer_should_restore(
|
||||||
).to_be_visible()
|
).to_be_visible()
|
||||||
|
|
||||||
|
|
||||||
def test_can_clone_datalayer(live_server, map, login, datalayer, page):
|
def test_can_clone_datalayer(live_server, openmap, login, datalayer, page):
|
||||||
# Faster than doing a login
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
||||||
map.edit_status = Map.ANONYMOUS
|
|
||||||
map.save()
|
|
||||||
page.goto(f"{live_server.url}{map.get_absolute_url()}?edit")
|
|
||||||
layers = page.locator(".umap-browse-datalayers li")
|
layers = page.locator(".umap-browse-datalayers li")
|
||||||
markers = page.locator(".leaflet-marker-icon")
|
markers = page.locator(".leaflet-marker-icon")
|
||||||
expect(layers).to_have_count(1)
|
expect(layers).to_have_count(1)
|
||||||
|
@ -94,7 +88,7 @@ def test_can_clone_datalayer(live_server, map, login, datalayer, page):
|
||||||
expect(markers).to_have_count(2)
|
expect(markers).to_have_count(2)
|
||||||
|
|
||||||
|
|
||||||
def test_can_change_icon_class(live_server, map, page):
|
def test_can_change_icon_class(live_server, openmap, page):
|
||||||
# Faster than doing a login
|
# Faster than doing a login
|
||||||
data = {
|
data = {
|
||||||
"type": "FeatureCollection",
|
"type": "FeatureCollection",
|
||||||
|
@ -106,10 +100,8 @@ def test_can_change_icon_class(live_server, map, page):
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
DataLayerFactory(map=map, data=data)
|
DataLayerFactory(map=openmap, data=data)
|
||||||
map.edit_status = Map.ANONYMOUS
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
||||||
map.save()
|
|
||||||
page.goto(f"{live_server.url}{map.get_absolute_url()}?edit")
|
|
||||||
expect(page.locator(".umap-div-icon")).to_be_visible()
|
expect(page.locator(".umap-div-icon")).to_be_visible()
|
||||||
page.get_by_role("link", name="Manage layers").click()
|
page.get_by_role("link", name="Manage layers").click()
|
||||||
expect(page.locator(".umap-circle-icon")).to_be_hidden()
|
expect(page.locator(".umap-circle-icon")).to_be_hidden()
|
||||||
|
@ -121,11 +113,9 @@ def test_can_change_icon_class(live_server, map, page):
|
||||||
expect(page.locator(".umap-div-icon")).to_be_hidden()
|
expect(page.locator(".umap-div-icon")).to_be_hidden()
|
||||||
|
|
||||||
|
|
||||||
def test_can_change_name(live_server, map, page, datalayer):
|
def test_can_change_name(live_server, openmap, page, datalayer):
|
||||||
map.edit_status = Map.ANONYMOUS
|
|
||||||
map.save()
|
|
||||||
page.goto(
|
page.goto(
|
||||||
f"{live_server.url}{map.get_absolute_url()}?edit&datalayersControl=expanded"
|
f"{live_server.url}{openmap.get_absolute_url()}?edit&datalayersControl=expanded"
|
||||||
)
|
)
|
||||||
page.get_by_role("link", name="Manage layers").click()
|
page.get_by_role("link", name="Manage layers").click()
|
||||||
page.locator("#umap-ui-container").get_by_title("Edit", exact=True).click()
|
page.locator("#umap-ui-container").get_by_title("Edit", exact=True).click()
|
||||||
|
@ -142,11 +132,9 @@ def test_can_change_name(live_server, map, page, datalayer):
|
||||||
expect(page.locator(".umap-is-dirty")).to_be_hidden()
|
expect(page.locator(".umap-is-dirty")).to_be_hidden()
|
||||||
|
|
||||||
|
|
||||||
def test_can_create_new_datalayer(live_server, map, page, datalayer):
|
def test_can_create_new_datalayer(live_server, openmap, page, datalayer):
|
||||||
map.edit_status = Map.ANONYMOUS
|
|
||||||
map.save()
|
|
||||||
page.goto(
|
page.goto(
|
||||||
f"{live_server.url}{map.get_absolute_url()}?edit&datalayersControl=expanded"
|
f"{live_server.url}{openmap.get_absolute_url()}?edit&datalayersControl=expanded"
|
||||||
)
|
)
|
||||||
page.get_by_role("link", name="Manage layers").click()
|
page.get_by_role("link", name="Manage layers").click()
|
||||||
page.get_by_role("button", name="Add a layer").click()
|
page.get_by_role("button", name="Add a layer").click()
|
||||||
|
@ -174,10 +162,8 @@ def test_can_create_new_datalayer(live_server, map, page, datalayer):
|
||||||
expect(page.locator(".umap-is-dirty")).to_be_hidden()
|
expect(page.locator(".umap-is-dirty")).to_be_hidden()
|
||||||
|
|
||||||
|
|
||||||
def test_can_restore_version(live_server, map, page, datalayer):
|
def test_can_restore_version(live_server, openmap, page, datalayer):
|
||||||
map.edit_status = Map.ANONYMOUS
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
||||||
map.save()
|
|
||||||
page.goto(f"{live_server.url}{map.get_absolute_url()}?edit")
|
|
||||||
marker = page.locator(".leaflet-marker-icon")
|
marker = page.locator(".leaflet-marker-icon")
|
||||||
expect(marker).to_have_class(re.compile(".*umap-ball-icon.*"))
|
expect(marker).to_have_class(re.compile(".*umap-ball-icon.*"))
|
||||||
marker.click(modifiers=["Shift"])
|
marker.click(modifiers=["Shift"])
|
||||||
|
|
|
@ -5,7 +5,7 @@ from pathlib import Path
|
||||||
import pytest
|
import pytest
|
||||||
from playwright.sync_api import expect
|
from playwright.sync_api import expect
|
||||||
|
|
||||||
from umap.models import DataLayer, Map
|
from umap.models import DataLayer
|
||||||
|
|
||||||
pytestmark = pytest.mark.django_db
|
pytestmark = pytest.mark.django_db
|
||||||
|
|
||||||
|
@ -175,11 +175,8 @@ def test_import_csv_from_textarea(tilelayer, live_server, page):
|
||||||
expect(markers).to_have_count(2)
|
expect(markers).to_have_count(2)
|
||||||
|
|
||||||
|
|
||||||
def test_can_import_in_existing_datalayer(live_server, datalayer, page, map):
|
def test_can_import_in_existing_datalayer(live_server, datalayer, page, openmap):
|
||||||
# Faster than doing a login
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}")
|
||||||
map.edit_status = Map.ANONYMOUS
|
|
||||||
map.save()
|
|
||||||
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
||||||
layers = page.locator(".umap-browse-datalayers li")
|
layers = page.locator(".umap-browse-datalayers li")
|
||||||
markers = page.locator(".leaflet-marker-icon")
|
markers = page.locator(".leaflet-marker-icon")
|
||||||
expect(markers).to_have_count(1)
|
expect(markers).to_have_count(1)
|
||||||
|
@ -196,11 +193,8 @@ def test_can_import_in_existing_datalayer(live_server, datalayer, page, map):
|
||||||
expect(markers).to_have_count(3)
|
expect(markers).to_have_count(3)
|
||||||
|
|
||||||
|
|
||||||
def test_can_replace_datalayer_data(live_server, datalayer, page, map):
|
def test_can_replace_datalayer_data(live_server, datalayer, page, openmap):
|
||||||
# Faster than doing a login
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}")
|
||||||
map.edit_status = Map.ANONYMOUS
|
|
||||||
map.save()
|
|
||||||
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
||||||
layers = page.locator(".umap-browse-datalayers li")
|
layers = page.locator(".umap-browse-datalayers li")
|
||||||
markers = page.locator(".leaflet-marker-icon")
|
markers = page.locator(".leaflet-marker-icon")
|
||||||
expect(markers).to_have_count(1)
|
expect(markers).to_have_count(1)
|
||||||
|
@ -218,11 +212,8 @@ def test_can_replace_datalayer_data(live_server, datalayer, page, map):
|
||||||
expect(markers).to_have_count(2)
|
expect(markers).to_have_count(2)
|
||||||
|
|
||||||
|
|
||||||
def test_can_import_in_new_datalayer(live_server, datalayer, page, map):
|
def test_can_import_in_new_datalayer(live_server, datalayer, page, openmap):
|
||||||
# Faster than doing a login
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}")
|
||||||
map.edit_status = Map.ANONYMOUS
|
|
||||||
map.save()
|
|
||||||
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
||||||
layers = page.locator(".umap-browse-datalayers li")
|
layers = page.locator(".umap-browse-datalayers li")
|
||||||
markers = page.locator(".leaflet-marker-icon")
|
markers = page.locator(".leaflet-marker-icon")
|
||||||
expect(markers).to_have_count(1)
|
expect(markers).to_have_count(1)
|
||||||
|
|
|
@ -3,8 +3,6 @@ import re
|
||||||
import pytest
|
import pytest
|
||||||
from playwright.sync_api import expect
|
from playwright.sync_api import expect
|
||||||
|
|
||||||
from umap.models import Map
|
|
||||||
|
|
||||||
from ..base import DataLayerFactory
|
from ..base import DataLayerFactory
|
||||||
|
|
||||||
pytestmark = pytest.mark.django_db
|
pytestmark = pytest.mark.django_db
|
||||||
|
@ -149,18 +147,15 @@ def test_default_view_latest_with_polygon(map, live_server, page):
|
||||||
|
|
||||||
|
|
||||||
def test_remote_layer_should_not_be_used_as_datalayer_for_created_features(
|
def test_remote_layer_should_not_be_used_as_datalayer_for_created_features(
|
||||||
map, live_server, datalayer, page
|
openmap, live_server, datalayer, page
|
||||||
):
|
):
|
||||||
# Faster than doing a login
|
|
||||||
map.edit_status = Map.ANONYMOUS
|
|
||||||
map.save()
|
|
||||||
datalayer.settings["remoteData"] = {
|
datalayer.settings["remoteData"] = {
|
||||||
"url": "https://overpass-api.de/api/interpreter?data=[out:xml];node[harbour=yes]({south},{west},{north},{east});out body;",
|
"url": "https://overpass-api.de/api/interpreter?data=[out:xml];node[harbour=yes]({south},{west},{north},{east});out body;",
|
||||||
"format": "osm",
|
"format": "osm",
|
||||||
"from": "10",
|
"from": "10",
|
||||||
}
|
}
|
||||||
datalayer.save()
|
datalayer.save()
|
||||||
page.goto(f"{live_server.url}{map.get_absolute_url()}?edit")
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
||||||
toggle = page.get_by_role("button", name="See data layers")
|
toggle = page.get_by_role("button", name="See data layers")
|
||||||
expect(toggle).to_be_visible()
|
expect(toggle).to_be_visible()
|
||||||
toggle.click()
|
toggle.click()
|
||||||
|
@ -179,13 +174,10 @@ def test_remote_layer_should_not_be_used_as_datalayer_for_created_features(
|
||||||
expect(layers).to_have_count(2)
|
expect(layers).to_have_count(2)
|
||||||
|
|
||||||
|
|
||||||
def test_can_hide_datalayer_from_caption(map, live_server, datalayer, page):
|
def test_can_hide_datalayer_from_caption(openmap, live_server, datalayer, page):
|
||||||
# Faster than doing a login
|
|
||||||
map.edit_status = Map.ANONYMOUS
|
|
||||||
map.save()
|
|
||||||
# Add another DataLayer
|
# Add another DataLayer
|
||||||
other = DataLayerFactory(map=map, name="Hidden", settings={"inCaption": False})
|
other = DataLayerFactory(map=openmap, name="Hidden", settings={"inCaption": False})
|
||||||
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}")
|
||||||
toggle = page.get_by_text("About").first
|
toggle = page.get_by_text("About").first
|
||||||
expect(toggle).to_be_visible()
|
expect(toggle).to_be_visible()
|
||||||
toggle.click()
|
toggle.click()
|
||||||
|
|
|
@ -5,7 +5,7 @@ import pytest
|
||||||
from django.core.files.base import ContentFile
|
from django.core.files.base import ContentFile
|
||||||
from playwright.sync_api import expect
|
from playwright.sync_api import expect
|
||||||
|
|
||||||
from umap.models import Map, Pictogram
|
from umap.models import Pictogram
|
||||||
|
|
||||||
from ..base import DataLayerFactory
|
from ..base import DataLayerFactory
|
||||||
|
|
||||||
|
@ -37,12 +37,9 @@ def pictos():
|
||||||
Pictogram(name="circle", pictogram=ContentFile(path.read_text(), path.name)).save()
|
Pictogram(name="circle", pictogram=ContentFile(path.read_text(), path.name)).save()
|
||||||
|
|
||||||
|
|
||||||
def test_can_change_picto_at_map_level(map, live_server, page, pictos):
|
def test_can_change_picto_at_map_level(openmap, live_server, page, pictos):
|
||||||
# Faster than doing a login
|
DataLayerFactory(map=openmap, data=DATALAYER_DATA)
|
||||||
map.edit_status = Map.ANONYMOUS
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
||||||
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")
|
marker = page.locator(".umap-div-icon img")
|
||||||
expect(marker).to_have_count(1)
|
expect(marker).to_have_count(1)
|
||||||
# Should have default img
|
# Should have default img
|
||||||
|
@ -71,13 +68,11 @@ def test_can_change_picto_at_map_level(map, live_server, page, pictos):
|
||||||
expect(marker).to_have_attribute("src", "/static/umap/img/marker.svg")
|
expect(marker).to_have_attribute("src", "/static/umap/img/marker.svg")
|
||||||
|
|
||||||
|
|
||||||
def test_can_change_picto_at_datalayer_level(map, live_server, page, pictos):
|
def test_can_change_picto_at_datalayer_level(openmap, live_server, page, pictos):
|
||||||
# Faster than doing a login
|
openmap.settings["properties"]["iconUrl"] = "/uploads/pictogram/star.svg"
|
||||||
map.edit_status = Map.ANONYMOUS
|
openmap.save()
|
||||||
map.settings["properties"]["iconUrl"] = "/uploads/pictogram/star.svg"
|
DataLayerFactory(map=openmap, data=DATALAYER_DATA)
|
||||||
map.save()
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
||||||
DataLayerFactory(map=map, data=DATALAYER_DATA)
|
|
||||||
page.goto(f"{live_server.url}{map.get_absolute_url()}?edit")
|
|
||||||
marker = page.locator(".umap-div-icon img")
|
marker = page.locator(".umap-div-icon img")
|
||||||
expect(marker).to_have_count(1)
|
expect(marker).to_have_count(1)
|
||||||
# Should have default img
|
# Should have default img
|
||||||
|
@ -112,13 +107,11 @@ def test_can_change_picto_at_datalayer_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")
|
||||||
|
|
||||||
|
|
||||||
def test_can_change_picto_at_marker_level(map, live_server, page, pictos):
|
def test_can_change_picto_at_marker_level(openmap, live_server, page, pictos):
|
||||||
# Faster than doing a login
|
openmap.settings["properties"]["iconUrl"] = "/uploads/pictogram/star.svg"
|
||||||
map.edit_status = Map.ANONYMOUS
|
openmap.save()
|
||||||
map.settings["properties"]["iconUrl"] = "/uploads/pictogram/star.svg"
|
DataLayerFactory(map=openmap, data=DATALAYER_DATA)
|
||||||
map.save()
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
||||||
DataLayerFactory(map=map, data=DATALAYER_DATA)
|
|
||||||
page.goto(f"{live_server.url}{map.get_absolute_url()}?edit")
|
|
||||||
marker = page.locator(".umap-div-icon img")
|
marker = page.locator(".umap-div-icon img")
|
||||||
expect(marker).to_have_count(1)
|
expect(marker).to_have_count(1)
|
||||||
# Should have default img
|
# Should have default img
|
||||||
|
@ -152,12 +145,9 @@ def test_can_change_picto_at_marker_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")
|
||||||
|
|
||||||
|
|
||||||
def test_can_use_remote_url_as_picto(map, live_server, page, pictos):
|
def test_can_use_remote_url_as_picto(openmap, live_server, page, pictos):
|
||||||
# Faster than doing a login
|
DataLayerFactory(map=openmap, data=DATALAYER_DATA)
|
||||||
map.edit_status = Map.ANONYMOUS
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
||||||
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")
|
marker = page.locator(".umap-div-icon img")
|
||||||
expect(marker).to_have_count(1)
|
expect(marker).to_have_count(1)
|
||||||
# Should have default img
|
# Should have default img
|
||||||
|
@ -195,12 +185,9 @@ def test_can_use_remote_url_as_picto(map, live_server, page, pictos):
|
||||||
expect(symbols).to_have_count(1)
|
expect(symbols).to_have_count(1)
|
||||||
|
|
||||||
|
|
||||||
def test_can_use_char_as_picto(map, live_server, page, pictos):
|
def test_can_use_char_as_picto(openmap, live_server, page, pictos):
|
||||||
# Faster than doing a login
|
DataLayerFactory(map=openmap, data=DATALAYER_DATA)
|
||||||
map.edit_status = Map.ANONYMOUS
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
||||||
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 span")
|
marker = page.locator(".umap-div-icon span")
|
||||||
# Should have default img, so not a span
|
# Should have default img, so not a span
|
||||||
expect(marker).to_have_count(0)
|
expect(marker).to_have_count(0)
|
||||||
|
|
Loading…
Reference in a new issue