umap-project 2.3.0__py3-none-any.whl → 2.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of umap-project might be problematic. Click here for more details.
- umap/__init__.py +1 -1
- umap/locale/en/LC_MESSAGES/django.po +81 -31
- umap/locale/fr/LC_MESSAGES/django.mo +0 -0
- umap/locale/fr/LC_MESSAGES/django.po +117 -66
- umap/locale/pl/LC_MESSAGES/django.mo +0 -0
- umap/locale/pl/LC_MESSAGES/django.po +83 -78
- umap/locale/pt/LC_MESSAGES/django.mo +0 -0
- umap/locale/pt/LC_MESSAGES/django.po +129 -123
- umap/management/commands/run_websocket_server.py +23 -0
- umap/models.py +6 -1
- umap/settings/base.py +11 -3
- umap/static/umap/base.css +68 -186
- umap/static/umap/content.css +3 -2
- umap/static/umap/css/dialog.css +18 -0
- umap/static/umap/css/icon.css +8 -0
- umap/static/umap/css/importers.css +51 -0
- umap/static/umap/css/panel.css +18 -57
- umap/static/umap/css/tooltip.css +59 -0
- umap/static/umap/css/window.css +35 -0
- umap/static/umap/img/16-white.svg +1 -3
- umap/static/umap/img/alert-icon-error.svg +8 -0
- umap/static/umap/img/alert-icon-info.svg +4 -0
- umap/static/umap/img/alert-icon-success.svg +3 -0
- umap/static/umap/img/icon-external-link.svg +3 -0
- umap/static/umap/img/importers/communesfr.svg +5 -0
- umap/static/umap/img/importers/datasets.svg +13 -0
- umap/static/umap/img/importers/geodatamine.svg +10 -0
- umap/static/umap/img/importers/overpass.svg +7 -0
- umap/static/umap/img/importers/random.svg +18 -0
- umap/static/umap/img/importers/random1.svg +4 -0
- umap/static/umap/img/importers/random2.svg +4 -0
- umap/static/umap/img/source/16-white.svg +2 -4
- umap/static/umap/js/components/alerts/alert.css +160 -0
- umap/static/umap/js/components/alerts/alert.js +169 -0
- umap/static/umap/js/components/base.js +54 -0
- umap/static/umap/js/modules/autocomplete.js +347 -0
- umap/static/umap/js/modules/browser.js +14 -21
- umap/static/umap/js/modules/caption.js +119 -0
- umap/static/umap/js/modules/global.js +37 -11
- umap/static/umap/js/modules/help.js +255 -0
- umap/static/umap/js/modules/importer.js +308 -0
- umap/static/umap/js/modules/importers/communesfr.js +44 -0
- umap/static/umap/js/modules/importers/datasets.js +42 -0
- umap/static/umap/js/modules/importers/geodatamine.js +95 -0
- umap/static/umap/js/modules/importers/overpass.js +84 -0
- umap/static/umap/js/modules/request.js +12 -14
- umap/static/umap/js/modules/rules.js +241 -0
- umap/static/umap/js/modules/schema.js +63 -14
- umap/static/umap/js/modules/sync/engine.js +93 -0
- umap/static/umap/js/modules/sync/updaters.js +109 -0
- umap/static/umap/js/modules/sync/websocket.js +25 -0
- umap/static/umap/js/modules/ui/dialog.js +52 -0
- umap/static/umap/js/modules/{panel.js → ui/panel.js} +37 -20
- umap/static/umap/js/modules/ui/tooltip.js +116 -0
- umap/static/umap/js/modules/utils.js +25 -18
- umap/static/umap/js/umap.controls.js +37 -112
- umap/static/umap/js/umap.core.js +1 -327
- umap/static/umap/js/umap.features.js +77 -29
- umap/static/umap/js/umap.forms.js +17 -19
- umap/static/umap/js/umap.js +265 -228
- umap/static/umap/js/umap.layer.js +154 -76
- umap/static/umap/js/umap.permissions.js +5 -9
- umap/static/umap/js/umap.popup.js +2 -1
- umap/static/umap/js/umap.tableeditor.js +8 -8
- umap/static/umap/locale/am_ET.js +51 -16
- umap/static/umap/locale/am_ET.json +51 -16
- umap/static/umap/locale/ar.js +51 -16
- umap/static/umap/locale/ar.json +51 -16
- umap/static/umap/locale/ast.js +51 -16
- umap/static/umap/locale/ast.json +51 -16
- umap/static/umap/locale/bg.js +51 -16
- umap/static/umap/locale/bg.json +51 -16
- umap/static/umap/locale/br.js +55 -20
- umap/static/umap/locale/br.json +55 -20
- umap/static/umap/locale/ca.js +51 -16
- umap/static/umap/locale/ca.json +51 -16
- umap/static/umap/locale/cs_CZ.js +93 -58
- umap/static/umap/locale/cs_CZ.json +93 -58
- umap/static/umap/locale/da.js +51 -16
- umap/static/umap/locale/da.json +51 -16
- umap/static/umap/locale/de.js +56 -21
- umap/static/umap/locale/de.json +56 -21
- umap/static/umap/locale/el.js +51 -16
- umap/static/umap/locale/el.json +51 -16
- umap/static/umap/locale/en.js +52 -16
- umap/static/umap/locale/en.json +52 -16
- umap/static/umap/locale/en_US.json +51 -16
- umap/static/umap/locale/es.js +51 -16
- umap/static/umap/locale/es.json +51 -16
- umap/static/umap/locale/et.js +51 -16
- umap/static/umap/locale/et.json +51 -16
- umap/static/umap/locale/eu.js +51 -16
- umap/static/umap/locale/eu.json +51 -16
- umap/static/umap/locale/fa_IR.js +51 -16
- umap/static/umap/locale/fa_IR.json +51 -16
- umap/static/umap/locale/fi.js +51 -16
- umap/static/umap/locale/fi.json +51 -16
- umap/static/umap/locale/fr.js +61 -25
- umap/static/umap/locale/fr.json +61 -25
- umap/static/umap/locale/gl.js +51 -16
- umap/static/umap/locale/gl.json +51 -16
- umap/static/umap/locale/he.js +51 -16
- umap/static/umap/locale/he.json +51 -16
- umap/static/umap/locale/hr.js +51 -16
- umap/static/umap/locale/hr.json +51 -16
- umap/static/umap/locale/hu.js +51 -16
- umap/static/umap/locale/hu.json +51 -16
- umap/static/umap/locale/id.js +51 -16
- umap/static/umap/locale/id.json +51 -16
- umap/static/umap/locale/is.js +51 -16
- umap/static/umap/locale/is.json +51 -16
- umap/static/umap/locale/it.js +51 -16
- umap/static/umap/locale/it.json +51 -16
- umap/static/umap/locale/ja.js +51 -16
- umap/static/umap/locale/ja.json +51 -16
- umap/static/umap/locale/ko.js +51 -16
- umap/static/umap/locale/ko.json +51 -16
- umap/static/umap/locale/lt.js +51 -16
- umap/static/umap/locale/lt.json +51 -16
- umap/static/umap/locale/ms.js +51 -16
- umap/static/umap/locale/ms.json +51 -16
- umap/static/umap/locale/nl.js +51 -16
- umap/static/umap/locale/nl.json +51 -16
- umap/static/umap/locale/no.js +51 -16
- umap/static/umap/locale/no.json +51 -16
- umap/static/umap/locale/pl.js +93 -58
- umap/static/umap/locale/pl.json +93 -58
- umap/static/umap/locale/pl_PL.json +51 -16
- umap/static/umap/locale/pt.js +215 -180
- umap/static/umap/locale/pt.json +215 -180
- umap/static/umap/locale/pt_BR.js +51 -16
- umap/static/umap/locale/pt_BR.json +51 -16
- umap/static/umap/locale/pt_PT.js +51 -16
- umap/static/umap/locale/pt_PT.json +51 -16
- umap/static/umap/locale/ro.js +51 -16
- umap/static/umap/locale/ro.json +51 -16
- umap/static/umap/locale/ru.js +51 -16
- umap/static/umap/locale/ru.json +51 -16
- umap/static/umap/locale/si.js +51 -16
- umap/static/umap/locale/si.json +51 -16
- umap/static/umap/locale/sk_SK.js +51 -16
- umap/static/umap/locale/sk_SK.json +51 -16
- umap/static/umap/locale/sl.js +51 -16
- umap/static/umap/locale/sl.json +51 -16
- umap/static/umap/locale/sr.js +51 -16
- umap/static/umap/locale/sr.json +51 -16
- umap/static/umap/locale/sv.js +51 -16
- umap/static/umap/locale/sv.json +51 -16
- umap/static/umap/locale/th_TH.js +51 -16
- umap/static/umap/locale/th_TH.json +51 -16
- umap/static/umap/locale/tr.js +51 -16
- umap/static/umap/locale/tr.json +51 -16
- umap/static/umap/locale/uk_UA.js +51 -16
- umap/static/umap/locale/uk_UA.json +51 -16
- umap/static/umap/locale/vi.js +51 -16
- umap/static/umap/locale/vi.json +51 -16
- umap/static/umap/locale/vi_VN.json +51 -16
- umap/static/umap/locale/zh.js +51 -16
- umap/static/umap/locale/zh.json +51 -16
- umap/static/umap/locale/zh_CN.json +51 -16
- umap/static/umap/locale/zh_TW.Big5.json +51 -16
- umap/static/umap/locale/zh_TW.js +51 -16
- umap/static/umap/locale/zh_TW.json +51 -16
- umap/static/umap/map.css +40 -53
- umap/static/umap/unittests/sync.js +105 -0
- umap/static/umap/unittests/utils.js +78 -36
- umap/static/umap/vars.css +19 -1
- umap/static/umap/vendors/dompurify/purify.es.js +50 -15
- umap/static/umap/vendors/dompurify/purify.es.mjs.map +1 -1
- umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +2 -2
- umap/templates/umap/components/alerts/alert.html +89 -0
- umap/templates/umap/content.html +4 -3
- umap/templates/umap/css.html +4 -0
- umap/templates/umap/home.html +3 -0
- umap/templates/umap/js.html +0 -3
- umap/templates/umap/map_init.html +2 -8
- umap/templates/umap/messages.html +9 -11
- umap/templates/umap/search.html +3 -0
- umap/tests/base.py +3 -0
- umap/tests/integration/conftest.py +30 -0
- umap/tests/integration/test_anonymous_owned_map.py +8 -13
- umap/tests/integration/test_browser.py +81 -6
- umap/tests/integration/test_caption.py +27 -0
- umap/tests/integration/test_conditional_rules.py +201 -0
- umap/tests/integration/test_dashboard.py +1 -1
- umap/tests/integration/test_datalayer.py +2 -3
- umap/tests/integration/test_edit_datalayer.py +32 -3
- umap/tests/integration/test_edit_map.py +1 -1
- umap/tests/integration/test_facets_browser.py +7 -4
- umap/tests/integration/test_import.py +185 -49
- umap/tests/integration/test_map.py +31 -17
- umap/tests/integration/{test_collaborative_editing.py → test_optimistic_merge.py} +7 -7
- umap/tests/integration/test_owned_map.py +1 -1
- umap/tests/integration/test_picto.py +2 -2
- umap/tests/integration/test_statics.py +1 -1
- umap/tests/integration/test_view_marker.py +19 -2
- umap/tests/integration/test_websocket_sync.py +283 -0
- umap/tests/settings.py +5 -0
- umap/tests/test_datalayer_views.py +0 -1
- umap/tests/test_views.py +53 -0
- umap/urls.py +5 -0
- umap/views.py +40 -11
- umap/websocket_server.py +92 -0
- {umap_project-2.3.0.dist-info → umap_project-2.4.0.dist-info}/METADATA +13 -11
- {umap_project-2.3.0.dist-info → umap_project-2.4.0.dist-info}/RECORD +208 -172
- umap/static/umap/js/umap.autocomplete.js +0 -341
- umap/static/umap/js/umap.importer.js +0 -187
- umap/static/umap/js/umap.ui.js +0 -190
- {umap_project-2.3.0.dist-info → umap_project-2.4.0.dist-info}/WHEEL +0 -0
- {umap_project-2.3.0.dist-info → umap_project-2.4.0.dist-info}/entry_points.txt +0 -0
- {umap_project-2.3.0.dist-info → umap_project-2.4.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from playwright.sync_api import expect
|
|
3
|
+
|
|
4
|
+
from ..base import DataLayerFactory
|
|
5
|
+
|
|
6
|
+
pytestmark = pytest.mark.django_db
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def getColors(elements):
|
|
10
|
+
return [
|
|
11
|
+
el.evaluate("e => window.getComputedStyle(e).backgroundColor")
|
|
12
|
+
for el in elements.all()
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
DATALAYER_DATA1 = {
|
|
17
|
+
"type": "FeatureCollection",
|
|
18
|
+
"features": [
|
|
19
|
+
{
|
|
20
|
+
"type": "Feature",
|
|
21
|
+
"properties": {
|
|
22
|
+
"mytype": "even",
|
|
23
|
+
"name": "Point 2",
|
|
24
|
+
"mynumber": 10,
|
|
25
|
+
"myboolean": True,
|
|
26
|
+
"mydate": "2024/04/14 12:19:17",
|
|
27
|
+
},
|
|
28
|
+
"geometry": {"type": "Point", "coordinates": [0.065918, 48.385442]},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"type": "Feature",
|
|
32
|
+
"properties": {
|
|
33
|
+
"mytype": "odd",
|
|
34
|
+
"name": "Point 1",
|
|
35
|
+
"mynumber": 12,
|
|
36
|
+
"myboolean": False,
|
|
37
|
+
"mydate": "2024/03/13 12:20:20",
|
|
38
|
+
},
|
|
39
|
+
"geometry": {"type": "Point", "coordinates": [3.55957, 49.767074]},
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
"_umap_options": {
|
|
43
|
+
"name": "Calque 1",
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
DATALAYER_DATA2 = {
|
|
49
|
+
"type": "FeatureCollection",
|
|
50
|
+
"features": [
|
|
51
|
+
{
|
|
52
|
+
"type": "Feature",
|
|
53
|
+
"properties": {
|
|
54
|
+
"mytype": "even",
|
|
55
|
+
"name": "Point 4",
|
|
56
|
+
"mynumber": 10,
|
|
57
|
+
"myboolean": "true",
|
|
58
|
+
"mydate": "2024/08/18 13:14:15",
|
|
59
|
+
},
|
|
60
|
+
"geometry": {"type": "Point", "coordinates": [0.856934, 45.290347]},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"type": "Feature",
|
|
64
|
+
"properties": {
|
|
65
|
+
"mytype": "odd",
|
|
66
|
+
"name": "Point 3",
|
|
67
|
+
"mynumber": 14,
|
|
68
|
+
"mydate": "2024-04-14T10:19:17.000Z",
|
|
69
|
+
},
|
|
70
|
+
"geometry": {"type": "Point", "coordinates": [4.372559, 47.945786]},
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
"_umap_options": {
|
|
74
|
+
"name": "Calque 2",
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def test_simple_equal_rule_at_load(live_server, page, map):
|
|
80
|
+
map.settings["properties"]["rules"] = [
|
|
81
|
+
{"condition": "mytype=odd", "options": {"color": "aliceblue"}}
|
|
82
|
+
]
|
|
83
|
+
map.save()
|
|
84
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA1)
|
|
85
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA2)
|
|
86
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
|
|
87
|
+
markers = page.locator(".leaflet-marker-icon .icon_container")
|
|
88
|
+
expect(markers).to_have_count(4)
|
|
89
|
+
colors = getColors(markers)
|
|
90
|
+
assert colors.count("rgb(240, 248, 255)") == 2
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def test_simple_not_equal_rule_at_load(live_server, page, map):
|
|
94
|
+
map.settings["properties"]["rules"] = [
|
|
95
|
+
{"condition": "mytype!=even", "options": {"color": "aliceblue"}}
|
|
96
|
+
]
|
|
97
|
+
map.save()
|
|
98
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA1)
|
|
99
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA2)
|
|
100
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
|
|
101
|
+
markers = page.locator(".leaflet-marker-icon .icon_container")
|
|
102
|
+
expect(markers).to_have_count(4)
|
|
103
|
+
colors = getColors(markers)
|
|
104
|
+
assert colors.count("rgb(240, 248, 255)") == 2
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def test_gt_rule_with_number_at_load(live_server, page, map):
|
|
108
|
+
map.settings["properties"]["rules"] = [
|
|
109
|
+
{"condition": "mynumber>10", "options": {"color": "aliceblue"}}
|
|
110
|
+
]
|
|
111
|
+
map.save()
|
|
112
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA1)
|
|
113
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA2)
|
|
114
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
|
|
115
|
+
markers = page.locator(".leaflet-marker-icon .icon_container")
|
|
116
|
+
expect(markers).to_have_count(4)
|
|
117
|
+
colors = getColors(markers)
|
|
118
|
+
assert colors.count("rgb(240, 248, 255)") == 2
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def test_lt_rule_with_number_at_load(live_server, page, map):
|
|
122
|
+
map.settings["properties"]["rules"] = [
|
|
123
|
+
{"condition": "mynumber<14", "options": {"color": "aliceblue"}}
|
|
124
|
+
]
|
|
125
|
+
map.save()
|
|
126
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA1)
|
|
127
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA2)
|
|
128
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
|
|
129
|
+
markers = page.locator(".leaflet-marker-icon .icon_container")
|
|
130
|
+
expect(markers).to_have_count(4)
|
|
131
|
+
colors = getColors(markers)
|
|
132
|
+
assert colors.count("rgb(240, 248, 255)") == 3
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def test_lt_rule_with_float_at_load(live_server, page, map):
|
|
136
|
+
map.settings["properties"]["rules"] = [
|
|
137
|
+
{"condition": "mynumber<12.3", "options": {"color": "aliceblue"}}
|
|
138
|
+
]
|
|
139
|
+
map.save()
|
|
140
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA1)
|
|
141
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA2)
|
|
142
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
|
|
143
|
+
markers = page.locator(".leaflet-marker-icon .icon_container")
|
|
144
|
+
expect(markers).to_have_count(4)
|
|
145
|
+
colors = getColors(markers)
|
|
146
|
+
assert colors.count("rgb(240, 248, 255)") == 3
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def test_equal_rule_with_boolean_at_load(live_server, page, map):
|
|
150
|
+
map.settings["properties"]["rules"] = [
|
|
151
|
+
{"condition": "myboolean=true", "options": {"color": "aliceblue"}}
|
|
152
|
+
]
|
|
153
|
+
map.save()
|
|
154
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA1)
|
|
155
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA2)
|
|
156
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
|
|
157
|
+
markers = page.locator(".leaflet-marker-icon .icon_container")
|
|
158
|
+
expect(markers).to_have_count(4)
|
|
159
|
+
colors = getColors(markers)
|
|
160
|
+
assert colors.count("rgb(240, 248, 255)") == 2
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def test_can_create_new_rule(live_server, page, openmap):
|
|
164
|
+
DataLayerFactory(map=openmap, data=DATALAYER_DATA1)
|
|
165
|
+
DataLayerFactory(map=openmap, data=DATALAYER_DATA2)
|
|
166
|
+
page.goto(f"{live_server.url}{openmap.get_absolute_url()}#6/48.948/1.670")
|
|
167
|
+
markers = page.locator(".leaflet-marker-icon .icon_container")
|
|
168
|
+
expect(markers).to_have_count(4)
|
|
169
|
+
page.get_by_role("button", name="Edit").click()
|
|
170
|
+
page.get_by_role("link", name="Map advanced properties").click()
|
|
171
|
+
page.get_by_text("Conditional style rules").click()
|
|
172
|
+
page.get_by_role("button", name="Add rule").click()
|
|
173
|
+
page.locator("input[name=condition]").click()
|
|
174
|
+
page.locator("input[name=condition]").fill("mytype=odd")
|
|
175
|
+
page.locator(".umap-field-color .define").first.click()
|
|
176
|
+
page.get_by_title("AliceBlue").first.click()
|
|
177
|
+
colors = getColors(markers)
|
|
178
|
+
assert colors.count("rgb(240, 248, 255)") == 2
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def test_can_deactive_rule_from_list(live_server, page, openmap):
|
|
182
|
+
openmap.settings["properties"]["rules"] = [
|
|
183
|
+
{"condition": "mytype=odd", "options": {"color": "aliceblue"}}
|
|
184
|
+
]
|
|
185
|
+
openmap.save()
|
|
186
|
+
DataLayerFactory(map=openmap, data=DATALAYER_DATA1)
|
|
187
|
+
DataLayerFactory(map=openmap, data=DATALAYER_DATA2)
|
|
188
|
+
page.goto(f"{live_server.url}{openmap.get_absolute_url()}#6/48.948/1.670")
|
|
189
|
+
markers = page.locator(".leaflet-marker-icon .icon_container")
|
|
190
|
+
expect(markers).to_have_count(4)
|
|
191
|
+
colors = getColors(markers)
|
|
192
|
+
assert colors.count("rgb(240, 248, 255)") == 2
|
|
193
|
+
page.get_by_role("button", name="Edit").click()
|
|
194
|
+
page.get_by_role("link", name="Map advanced properties").click()
|
|
195
|
+
page.get_by_text("Conditional style rules").click()
|
|
196
|
+
page.get_by_role("button", name="Show/hide layer").click()
|
|
197
|
+
colors = getColors(markers)
|
|
198
|
+
assert colors.count("rgb(240, 248, 255)") == 0
|
|
199
|
+
page.get_by_role("button", name="Show/hide layer").click()
|
|
200
|
+
colors = getColors(markers)
|
|
201
|
+
assert colors.count("rgb(240, 248, 255)") == 2
|
|
@@ -28,7 +28,7 @@ def test_owner_can_delete_map_after_confirmation(map, live_server, login):
|
|
|
28
28
|
def test_dashboard_map_preview(map, live_server, datalayer, login):
|
|
29
29
|
page = login(map.owner)
|
|
30
30
|
page.goto(f"{live_server.url}/en/me")
|
|
31
|
-
dialog = page.
|
|
31
|
+
dialog = page.get_by_role("dialog")
|
|
32
32
|
expect(dialog).to_be_hidden()
|
|
33
33
|
button = page.get_by_role("button", name="Open preview")
|
|
34
34
|
expect(button).to_be_visible()
|
|
@@ -27,7 +27,7 @@ def test_honour_displayOnLoad_false(map, live_server, datalayer, page):
|
|
|
27
27
|
layers_off = page.locator(".umap-browser .datalayer.off")
|
|
28
28
|
expect(layers).to_have_count(1)
|
|
29
29
|
expect(layers_off).to_have_count(1)
|
|
30
|
-
page.get_by_role("button", name="
|
|
30
|
+
page.get_by_role("button", name="Open browser").click()
|
|
31
31
|
page.get_by_label("Zoom in").click()
|
|
32
32
|
expect(markers).to_be_hidden()
|
|
33
33
|
page.get_by_title("Show/hide layer").click()
|
|
@@ -41,7 +41,7 @@ def test_should_honour_fromZoom(live_server, map, datalayer, page):
|
|
|
41
41
|
markers = page.locator(".leaflet-marker-icon")
|
|
42
42
|
expect(markers).to_be_hidden()
|
|
43
43
|
page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.55/14.68")
|
|
44
|
-
|
|
44
|
+
page.wait_for_timeout(500)
|
|
45
45
|
expect(markers).to_be_visible()
|
|
46
46
|
page.get_by_label("Zoom out").click()
|
|
47
47
|
expect(markers).to_be_hidden()
|
|
@@ -57,7 +57,6 @@ def test_should_honour_toZoom(live_server, map, datalayer, page):
|
|
|
57
57
|
markers = page.locator(".leaflet-marker-icon")
|
|
58
58
|
expect(markers).to_be_hidden()
|
|
59
59
|
page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.55/14.68")
|
|
60
|
-
markers = page.locator(".leaflet-marker-icon")
|
|
61
60
|
expect(markers).to_be_visible()
|
|
62
61
|
page.get_by_label("Zoom out").click()
|
|
63
62
|
expect(markers).to_be_visible()
|
|
@@ -54,7 +54,7 @@ def test_cancel_deleting_datalayer_should_restore(
|
|
|
54
54
|
live_server, openmap, datalayer, page
|
|
55
55
|
):
|
|
56
56
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
|
57
|
-
page.get_by_title("
|
|
57
|
+
page.get_by_title("Open browser").click()
|
|
58
58
|
layers = page.locator(".umap-browser .datalayer")
|
|
59
59
|
markers = page.locator(".leaflet-marker-icon")
|
|
60
60
|
expect(layers).to_have_count(1)
|
|
@@ -63,7 +63,7 @@ def test_cancel_deleting_datalayer_should_restore(
|
|
|
63
63
|
page.once("dialog", lambda dialog: dialog.accept())
|
|
64
64
|
page.locator(".panel.right").get_by_title("Delete layer").click()
|
|
65
65
|
expect(markers).to_have_count(0)
|
|
66
|
-
page.get_by_role("button", name="
|
|
66
|
+
page.get_by_role("button", name="Open browser").click()
|
|
67
67
|
expect(page.get_by_text("test datalayer")).to_be_hidden()
|
|
68
68
|
page.once("dialog", lambda dialog: dialog.accept())
|
|
69
69
|
page.get_by_role("button", name="Cancel edits").click()
|
|
@@ -73,7 +73,7 @@ def test_cancel_deleting_datalayer_should_restore(
|
|
|
73
73
|
|
|
74
74
|
def test_can_clone_datalayer(live_server, openmap, login, datalayer, page):
|
|
75
75
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
|
76
|
-
page.get_by_title("
|
|
76
|
+
page.get_by_title("Open browser").click()
|
|
77
77
|
layers = page.locator(".umap-browser .datalayer")
|
|
78
78
|
markers = page.locator(".leaflet-marker-icon")
|
|
79
79
|
expect(layers).to_have_count(1)
|
|
@@ -183,3 +183,32 @@ def test_can_edit_layer_on_ctrl_shift_click(live_server, openmap, page, datalaye
|
|
|
183
183
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
|
184
184
|
page.locator(".leaflet-marker-icon").click(modifiers=[modifier, "Shift"])
|
|
185
185
|
expect(page.get_by_text("Layer properties")).to_be_visible()
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def test_deleting_datalayer_should_remove_from_browser_and_layers_list(
|
|
189
|
+
live_server, openmap, datalayer, page
|
|
190
|
+
):
|
|
191
|
+
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
|
192
|
+
panel = page.locator(".panel.left")
|
|
193
|
+
edit_panel = page.locator(".panel.right")
|
|
194
|
+
page.get_by_title("Open browser").click()
|
|
195
|
+
page.get_by_role("link", name="Manage layers").click()
|
|
196
|
+
expect(panel.get_by_text("test datalayer")).to_be_visible()
|
|
197
|
+
expect(edit_panel.get_by_text("test datalayer")).to_be_visible()
|
|
198
|
+
page.once("dialog", lambda dialog: dialog.accept())
|
|
199
|
+
page.locator(".panel.right").get_by_title("Delete layer").click()
|
|
200
|
+
expect(panel.get_by_text("test datalayer")).to_be_hidden()
|
|
201
|
+
expect(edit_panel.get_by_text("test datalayer")).to_be_hidden()
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def test_deleting_datalayer_should_remove_from_caption(
|
|
205
|
+
live_server, openmap, datalayer, page
|
|
206
|
+
):
|
|
207
|
+
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
|
208
|
+
panel = page.locator(".panel.left")
|
|
209
|
+
page.get_by_role("button", name="About").click()
|
|
210
|
+
page.get_by_role("link", name="Manage layers").click()
|
|
211
|
+
expect(panel.get_by_text("test datalayer")).to_be_visible()
|
|
212
|
+
page.once("dialog", lambda dialog: dialog.accept())
|
|
213
|
+
page.locator(".panel.right").get_by_title("Delete layer").click()
|
|
214
|
+
expect(panel.get_by_text("test datalayer")).to_be_hidden()
|
|
@@ -170,7 +170,7 @@ def test_sortkey_impacts_datalayerindex(map, live_server, page):
|
|
|
170
170
|
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
171
171
|
|
|
172
172
|
# By default, features are sorted by name (Third, Second, First)
|
|
173
|
-
page.get_by_role("button", name="
|
|
173
|
+
page.get_by_role("button", name="Open browser").click()
|
|
174
174
|
page.get_by_role("heading", name="Show/hide layer").locator("i").click()
|
|
175
175
|
|
|
176
176
|
first_listed_feature = page.locator(".umap-browser .datalayer ul > li").nth(0)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import copy
|
|
2
|
+
import re
|
|
2
3
|
|
|
3
4
|
import pytest
|
|
4
5
|
from playwright.sync_api import expect
|
|
@@ -101,7 +102,9 @@ def test_simple_facet_search(live_server, page, map):
|
|
|
101
102
|
DataLayerFactory(map=map, data=DATALAYER_DATA2)
|
|
102
103
|
DataLayerFactory(map=map, data=DATALAYER_DATA3)
|
|
103
104
|
page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
|
|
104
|
-
panel = page.locator(".
|
|
105
|
+
panel = page.locator(".panel.left.on")
|
|
106
|
+
expect(panel).to_have_class(re.compile(".*expanded.*"))
|
|
107
|
+
expect(panel.locator(".umap-browser")).to_be_visible()
|
|
105
108
|
# From a non browsable datalayer, should not be impacted
|
|
106
109
|
paths = page.locator(".leaflet-overlay-pane path")
|
|
107
110
|
expect(paths).to_be_visible()
|
|
@@ -225,7 +228,7 @@ def test_facets_search_are_persistent_when_closing_panel(live_server, page, map)
|
|
|
225
228
|
DataLayerFactory(map=map, data=DATALAYER_DATA1)
|
|
226
229
|
DataLayerFactory(map=map, data=DATALAYER_DATA2)
|
|
227
230
|
page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
|
|
228
|
-
panel = page.locator(".
|
|
231
|
+
panel = page.locator(".panel.left")
|
|
229
232
|
|
|
230
233
|
# Facet values
|
|
231
234
|
odd = page.get_by_label("odd")
|
|
@@ -263,8 +266,8 @@ def test_facets_search_are_persistent_when_closing_panel(live_server, page, map)
|
|
|
263
266
|
# Close panel
|
|
264
267
|
expect(panel.locator("summary")).to_have_attribute("data-badge", " ")
|
|
265
268
|
expect(page.locator(".umap-control-browse")).to_have_attribute("data-badge", " ")
|
|
266
|
-
|
|
267
|
-
page.get_by_role("button", name="
|
|
269
|
+
panel.get_by_role("button", name="Close").click()
|
|
270
|
+
page.get_by_role("button", name="Open browser").click()
|
|
268
271
|
expect(panel.get_by_label("Min")).to_have_value("13")
|
|
269
272
|
expect(panel.get_by_label("Min")).to_have_attribute("data-modified", "true")
|
|
270
273
|
expect(panel.get_by_label("odd")).to_be_checked()
|