umap-project 3.3.6__py3-none-any.whl → 3.4.0b0__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/cs_CZ/LC_MESSAGES/django.mo +0 -0
- umap/locale/cs_CZ/LC_MESSAGES/django.po +43 -33
- umap/locale/da/LC_MESSAGES/django.mo +0 -0
- umap/locale/da/LC_MESSAGES/django.po +43 -33
- umap/locale/de/LC_MESSAGES/django.mo +0 -0
- umap/locale/de/LC_MESSAGES/django.po +35 -29
- umap/locale/el/LC_MESSAGES/django.mo +0 -0
- umap/locale/el/LC_MESSAGES/django.po +35 -29
- umap/locale/en/LC_MESSAGES/django.po +34 -28
- umap/locale/es/LC_MESSAGES/django.mo +0 -0
- umap/locale/es/LC_MESSAGES/django.po +43 -33
- umap/locale/et/LC_MESSAGES/django.mo +0 -0
- umap/locale/et/LC_MESSAGES/django.po +58 -54
- umap/locale/eu/LC_MESSAGES/django.mo +0 -0
- umap/locale/eu/LC_MESSAGES/django.po +43 -33
- umap/locale/fa_IR/LC_MESSAGES/django.mo +0 -0
- umap/locale/fa_IR/LC_MESSAGES/django.po +43 -33
- umap/locale/fr/LC_MESSAGES/django.mo +0 -0
- umap/locale/fr/LC_MESSAGES/django.po +36 -30
- umap/locale/gl/LC_MESSAGES/django.mo +0 -0
- umap/locale/gl/LC_MESSAGES/django.po +43 -33
- umap/locale/hu/LC_MESSAGES/django.mo +0 -0
- umap/locale/hu/LC_MESSAGES/django.po +35 -29
- umap/locale/is/LC_MESSAGES/django.mo +0 -0
- umap/locale/is/LC_MESSAGES/django.po +43 -33
- umap/locale/it/LC_MESSAGES/django.mo +0 -0
- umap/locale/it/LC_MESSAGES/django.po +43 -33
- umap/locale/nl/LC_MESSAGES/django.mo +0 -0
- umap/locale/nl/LC_MESSAGES/django.po +35 -29
- umap/locale/pl/LC_MESSAGES/django.mo +0 -0
- umap/locale/pl/LC_MESSAGES/django.po +43 -33
- umap/locale/pt/LC_MESSAGES/django.mo +0 -0
- umap/locale/pt/LC_MESSAGES/django.po +43 -33
- umap/locale/th_TH/LC_MESSAGES/django.mo +0 -0
- umap/locale/th_TH/LC_MESSAGES/django.po +310 -109
- umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
- umap/locale/zh_TW/LC_MESSAGES/django.po +80 -70
- umap/management/commands/switch_user.py +2 -2
- umap/static/umap/base.css +89 -32
- umap/static/umap/content.css +129 -33
- umap/static/umap/css/bar.css +82 -20
- umap/static/umap/css/browser.css +163 -0
- umap/static/umap/css/contextmenu.css +15 -0
- umap/static/umap/css/dialog.css +36 -16
- umap/static/umap/css/form.css +122 -32
- umap/static/umap/css/icon.css +46 -3
- umap/static/umap/css/panel.css +7 -3
- umap/static/umap/css/popup.css +34 -8
- umap/static/umap/css/tooltip.css +8 -4
- umap/static/umap/img/16-white.svg +26 -8
- umap/static/umap/img/16.svg +1 -1
- umap/static/umap/img/source/16-white.svg +36 -18
- umap/static/umap/img/source/16.svg +1 -1
- umap/static/umap/js/components/alerts/alert.css +69 -31
- umap/static/umap/js/components/alerts/alert.js +20 -2
- umap/static/umap/js/modules/browser.js +63 -55
- umap/static/umap/js/modules/caption.js +10 -7
- umap/static/umap/js/modules/data/features.js +82 -59
- umap/static/umap/js/modules/data/layer.js +56 -157
- umap/static/umap/js/modules/domutils.js +109 -0
- umap/static/umap/js/modules/filters.js +807 -0
- umap/static/umap/js/modules/form/builder.js +8 -5
- umap/static/umap/js/modules/form/fields.js +110 -220
- umap/static/umap/js/modules/formatter.js +24 -1
- umap/static/umap/js/modules/help.js +3 -2
- umap/static/umap/js/modules/importers/opendata.js +5 -0
- umap/static/umap/js/modules/importers/openrouteservice.js +6 -1
- umap/static/umap/js/modules/managers.js +265 -1
- umap/static/umap/js/modules/permissions.js +35 -31
- umap/static/umap/js/modules/rendering/controls.js +7 -7
- umap/static/umap/js/modules/rendering/icon.js +3 -8
- umap/static/umap/js/modules/rendering/layers/classified.js +17 -10
- umap/static/umap/js/modules/rendering/layers/cluster.js +2 -2
- umap/static/umap/js/modules/rendering/template.js +44 -8
- umap/static/umap/js/modules/rendering/ui.js +29 -23
- umap/static/umap/js/modules/rules.js +4 -3
- umap/static/umap/js/modules/schema.js +3 -6
- umap/static/umap/js/modules/share.js +4 -3
- umap/static/umap/js/modules/tableeditor.js +50 -38
- umap/static/umap/js/modules/templates.js +2 -3
- umap/static/umap/js/modules/ui/bar.js +42 -18
- umap/static/umap/js/modules/ui/dialog.js +33 -31
- umap/static/umap/js/modules/ui/panel.js +21 -7
- umap/static/umap/js/modules/ui/tooltip.js +6 -5
- umap/static/umap/js/modules/umap.js +148 -51
- umap/static/umap/js/modules/utils.js +23 -1
- umap/static/umap/js/umap.core.js +1 -110
- umap/static/umap/locale/am_ET.js +40 -14
- umap/static/umap/locale/am_ET.json +40 -14
- umap/static/umap/locale/ar.js +40 -14
- umap/static/umap/locale/ar.json +40 -14
- umap/static/umap/locale/ast.js +40 -14
- umap/static/umap/locale/ast.json +40 -14
- umap/static/umap/locale/bg.js +40 -14
- umap/static/umap/locale/bg.json +40 -14
- umap/static/umap/locale/br.js +47 -21
- umap/static/umap/locale/br.json +47 -21
- umap/static/umap/locale/ca.js +40 -14
- umap/static/umap/locale/ca.json +40 -14
- umap/static/umap/locale/cs_CZ.js +40 -14
- umap/static/umap/locale/cs_CZ.json +40 -14
- umap/static/umap/locale/da.js +40 -14
- umap/static/umap/locale/da.json +40 -14
- umap/static/umap/locale/de.js +39 -13
- umap/static/umap/locale/de.json +39 -13
- umap/static/umap/locale/el.js +40 -14
- umap/static/umap/locale/el.json +40 -14
- umap/static/umap/locale/en.js +39 -13
- umap/static/umap/locale/en.json +39 -13
- umap/static/umap/locale/en_US.json +40 -14
- umap/static/umap/locale/es.js +40 -14
- umap/static/umap/locale/es.json +40 -14
- umap/static/umap/locale/et.js +79 -53
- umap/static/umap/locale/et.json +79 -53
- umap/static/umap/locale/eu.js +72 -46
- umap/static/umap/locale/eu.json +72 -46
- umap/static/umap/locale/fa_IR.js +40 -14
- umap/static/umap/locale/fa_IR.json +40 -14
- umap/static/umap/locale/fi.js +40 -14
- umap/static/umap/locale/fi.json +40 -14
- umap/static/umap/locale/fr.js +39 -13
- umap/static/umap/locale/fr.json +39 -13
- umap/static/umap/locale/gl.js +40 -14
- umap/static/umap/locale/gl.json +40 -14
- umap/static/umap/locale/he.js +40 -14
- umap/static/umap/locale/he.json +40 -14
- umap/static/umap/locale/hr.js +40 -14
- umap/static/umap/locale/hr.json +40 -14
- umap/static/umap/locale/hu.js +40 -14
- umap/static/umap/locale/hu.json +40 -14
- umap/static/umap/locale/id.js +40 -14
- umap/static/umap/locale/id.json +40 -14
- umap/static/umap/locale/is.js +40 -14
- umap/static/umap/locale/is.json +40 -14
- umap/static/umap/locale/it.js +40 -14
- umap/static/umap/locale/it.json +40 -14
- umap/static/umap/locale/ja.js +40 -14
- umap/static/umap/locale/ja.json +40 -14
- umap/static/umap/locale/ko.js +40 -14
- umap/static/umap/locale/ko.json +40 -14
- umap/static/umap/locale/lt.js +40 -14
- umap/static/umap/locale/lt.json +40 -14
- umap/static/umap/locale/ms.js +40 -14
- umap/static/umap/locale/ms.json +40 -14
- umap/static/umap/locale/nl.js +40 -14
- umap/static/umap/locale/nl.json +40 -14
- umap/static/umap/locale/no.js +40 -14
- umap/static/umap/locale/no.json +40 -14
- umap/static/umap/locale/pl.js +40 -14
- umap/static/umap/locale/pl.json +40 -14
- umap/static/umap/locale/pl_PL.json +40 -14
- umap/static/umap/locale/pt.js +40 -14
- umap/static/umap/locale/pt.json +40 -14
- umap/static/umap/locale/pt_BR.js +40 -14
- umap/static/umap/locale/pt_BR.json +40 -14
- umap/static/umap/locale/pt_PT.js +40 -14
- umap/static/umap/locale/pt_PT.json +40 -14
- umap/static/umap/locale/ro.js +40 -14
- umap/static/umap/locale/ro.json +40 -14
- umap/static/umap/locale/ru.js +40 -14
- umap/static/umap/locale/ru.json +40 -14
- umap/static/umap/locale/sk_SK.js +40 -14
- umap/static/umap/locale/sk_SK.json +40 -14
- umap/static/umap/locale/sl.js +40 -14
- umap/static/umap/locale/sl.json +40 -14
- umap/static/umap/locale/sr.js +40 -14
- umap/static/umap/locale/sr.json +40 -14
- umap/static/umap/locale/sv.js +40 -14
- umap/static/umap/locale/sv.json +40 -14
- umap/static/umap/locale/th_TH.js +40 -14
- umap/static/umap/locale/th_TH.json +40 -14
- umap/static/umap/locale/tr.js +40 -14
- umap/static/umap/locale/tr.json +40 -14
- umap/static/umap/locale/uk_UA.js +40 -14
- umap/static/umap/locale/uk_UA.json +40 -14
- umap/static/umap/locale/vi.js +40 -14
- umap/static/umap/locale/vi.json +40 -14
- umap/static/umap/locale/vi_VN.json +40 -14
- umap/static/umap/locale/zh.js +40 -14
- umap/static/umap/locale/zh.json +40 -14
- umap/static/umap/locale/zh_CN.json +40 -14
- umap/static/umap/locale/zh_TW.Big5.json +40 -14
- umap/static/umap/locale/zh_TW.js +39 -13
- umap/static/umap/locale/zh_TW.json +39 -13
- umap/static/umap/map.css +60 -223
- umap/static/umap/unittests/utils.js +18 -0
- umap/static/umap/vars.css +23 -5
- umap/templates/umap/components/alerts/alert.html +32 -29
- umap/templates/umap/css.html +2 -1
- umap/templates/umap/login_popup_end.html +18 -9
- umap/templates/umap/user_map_table.html +7 -2
- umap/tests/integration/conftest.py +2 -6
- umap/tests/integration/test_anonymous_owned_map.py +89 -36
- umap/tests/integration/test_basics.py +25 -1
- umap/tests/integration/test_browser.py +37 -0
- umap/tests/integration/test_draw_polygon.py +2 -0
- umap/tests/integration/test_edit_marker.py +1 -1
- umap/tests/integration/test_export_map.py +19 -0
- umap/tests/integration/test_fields.py +522 -0
- umap/tests/integration/test_filters.py +617 -0
- umap/tests/integration/test_import.py +15 -42
- umap/tests/integration/test_remote_data.py +60 -4
- umap/tests/integration/test_share.py +4 -4
- umap/tests/integration/test_tableeditor.py +31 -7
- umap/tests/integration/test_websocket_sync.py +3 -1
- umap/tests/test_dashboard.py +10 -0
- umap/urls.py +1 -0
- umap/views.py +5 -0
- {umap_project-3.3.6.dist-info → umap_project-3.4.0b0.dist-info}/METADATA +12 -12
- {umap_project-3.3.6.dist-info → umap_project-3.4.0b0.dist-info}/RECORD +214 -211
- umap/static/umap/js/modules/facets.js +0 -164
- umap/tests/integration/test_facets_browser.py +0 -279
- {umap_project-3.3.6.dist-info → umap_project-3.4.0b0.dist-info}/WHEEL +0 -0
- {umap_project-3.3.6.dist-info → umap_project-3.4.0b0.dist-info}/entry_points.txt +0 -0
- {umap_project-3.3.6.dist-info → umap_project-3.4.0b0.dist-info}/licenses/LICENSE +0 -0
|
@@ -18,25 +18,24 @@ def owner_session(anonymap, context, live_server):
|
|
|
18
18
|
key, value = anonymap.signed_cookie_elements
|
|
19
19
|
signed = get_cookie_signer(salt=key).sign(value)
|
|
20
20
|
context.add_cookies([{"name": key, "value": signed, "url": live_server.url}])
|
|
21
|
-
return context.new_page()
|
|
22
21
|
|
|
23
22
|
|
|
24
|
-
def test_map_load_with_owner(anonymap, live_server, owner_session):
|
|
25
|
-
|
|
26
|
-
map_el =
|
|
23
|
+
def test_map_load_with_owner(anonymap, live_server, owner_session, page):
|
|
24
|
+
page.goto(f"{live_server.url}{anonymap.get_absolute_url()}")
|
|
25
|
+
map_el = page.locator("#map")
|
|
27
26
|
expect(map_el).to_be_visible()
|
|
28
|
-
enable =
|
|
27
|
+
enable = page.get_by_role("button", name="Edit")
|
|
29
28
|
expect(enable).to_be_visible()
|
|
30
29
|
enable.click()
|
|
31
|
-
disable =
|
|
30
|
+
disable = page.get_by_role("button", name="View")
|
|
32
31
|
expect(disable).to_be_visible()
|
|
33
|
-
save =
|
|
32
|
+
save = page.get_by_role("button", name="Save")
|
|
34
33
|
expect(save).to_be_visible()
|
|
35
|
-
add_marker =
|
|
34
|
+
add_marker = page.get_by_title("Draw a marker")
|
|
36
35
|
expect(add_marker).to_be_visible()
|
|
37
|
-
edit_settings =
|
|
36
|
+
edit_settings = page.get_by_title("Map advanced properties")
|
|
38
37
|
expect(edit_settings).to_be_visible()
|
|
39
|
-
edit_permissions =
|
|
38
|
+
edit_permissions = page.get_by_title("Update permissions and editors")
|
|
40
39
|
expect(edit_permissions).to_be_visible()
|
|
41
40
|
|
|
42
41
|
|
|
@@ -71,35 +70,31 @@ def test_map_load_with_anonymous_but_editable_layer(
|
|
|
71
70
|
expect(edit_permissions).to_be_hidden()
|
|
72
71
|
|
|
73
72
|
|
|
74
|
-
def test_owner_permissions_form(map, datalayer, live_server, owner_session):
|
|
75
|
-
|
|
76
|
-
edit_permissions =
|
|
73
|
+
def test_owner_permissions_form(map, datalayer, live_server, owner_session, page):
|
|
74
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}?edit")
|
|
75
|
+
edit_permissions = page.get_by_title("Update permissions and editors")
|
|
77
76
|
expect(edit_permissions).to_be_visible()
|
|
78
77
|
edit_permissions.click()
|
|
79
|
-
owner_field =
|
|
78
|
+
owner_field = page.locator(".umap-field-owner")
|
|
80
79
|
expect(owner_field).to_be_hidden()
|
|
81
|
-
editors_field =
|
|
80
|
+
editors_field = page.locator(".umap-field-editors input")
|
|
82
81
|
expect(editors_field).to_be_hidden()
|
|
83
|
-
datalayer_label =
|
|
82
|
+
datalayer_label = page.get_by_text('Who can edit "test datalayer"')
|
|
84
83
|
expect(datalayer_label).to_be_visible()
|
|
85
|
-
options =
|
|
86
|
-
".datalayer-permissions select[name='edit_status'] option"
|
|
87
|
-
)
|
|
84
|
+
options = page.locator(".datalayer-permissions select[name='edit_status'] option")
|
|
88
85
|
expect(options).to_have_count(3)
|
|
89
|
-
option =
|
|
86
|
+
option = page.locator(
|
|
90
87
|
".datalayer-permissions select[name='edit_status'] option:checked"
|
|
91
88
|
)
|
|
92
89
|
expect(option).to_have_text("Inherit")
|
|
93
|
-
expect(
|
|
90
|
+
expect(page.locator(".umap-field-share_status select")).to_be_visible()
|
|
94
91
|
options = [
|
|
95
92
|
int(option.get_attribute("value"))
|
|
96
|
-
for option in
|
|
97
|
-
".umap-field-share_status select option"
|
|
98
|
-
).all()
|
|
93
|
+
for option in page.locator(".umap-field-share_status select option").all()
|
|
99
94
|
]
|
|
100
95
|
assert options == [Map.DRAFT, Map.PUBLIC]
|
|
101
96
|
# This field should not be present in anonymous maps
|
|
102
|
-
expect(
|
|
97
|
+
expect(page.locator(".umap-field-owner")).to_be_hidden()
|
|
103
98
|
|
|
104
99
|
|
|
105
100
|
def test_anonymous_can_add_marker_on_editable_layer(
|
|
@@ -180,7 +175,7 @@ def test_alert_message_after_create(
|
|
|
180
175
|
new_map = Map.objects.last()
|
|
181
176
|
expect(alert).to_be_visible()
|
|
182
177
|
expect(
|
|
183
|
-
alert.get_by_text("
|
|
178
|
+
alert.get_by_text("Hey, you created a map without an account!")
|
|
184
179
|
).to_be_visible()
|
|
185
180
|
expect(alert.get_by_role("button", name="Copy")).to_be_visible()
|
|
186
181
|
expect(alert.get_by_role("button", name="Send me the link")).to_be_visible()
|
|
@@ -224,22 +219,22 @@ def test_alert_message_after_create_show_link_even_without_mail(
|
|
|
224
219
|
alert = page.locator('umap-alert-creation div[role="dialog"]')
|
|
225
220
|
expect(alert).to_be_visible()
|
|
226
221
|
expect(
|
|
227
|
-
alert.get_by_text("
|
|
222
|
+
alert.get_by_text("Hey, you created a map without an account!")
|
|
228
223
|
).to_be_visible()
|
|
229
224
|
expect(alert.get_by_role("button", name="Copy")).to_be_visible()
|
|
230
225
|
expect(alert.get_by_role("button", name="Send me the link")).to_be_hidden()
|
|
231
226
|
|
|
232
227
|
|
|
233
|
-
def test_anonymous_owner_can_delete_the_map(anonymap, live_server, owner_session):
|
|
228
|
+
def test_anonymous_owner_can_delete_the_map(anonymap, live_server, owner_session, page):
|
|
234
229
|
assert Map.objects.count() == 1
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
expect(
|
|
240
|
-
|
|
241
|
-
with
|
|
242
|
-
|
|
230
|
+
page.goto(f"{live_server.url}{anonymap.get_absolute_url()}")
|
|
231
|
+
page.get_by_role("button", name="Edit").click()
|
|
232
|
+
page.get_by_role("button", name="Map advanced properties").click()
|
|
233
|
+
page.get_by_text("Advanced actions").click()
|
|
234
|
+
expect(page.get_by_role("button", name="Delete")).to_be_visible()
|
|
235
|
+
page.get_by_role("button", name="Delete").click()
|
|
236
|
+
with page.expect_response(re.compile(r".*/update/delete/.*")):
|
|
237
|
+
page.get_by_role("button", name="OK").click()
|
|
243
238
|
assert Map.objects.get(pk=anonymap.pk).share_status == Map.DELETED
|
|
244
239
|
|
|
245
240
|
|
|
@@ -251,3 +246,61 @@ def test_non_owner_cannot_see_delete_button(anonymap, live_server, page):
|
|
|
251
246
|
page.get_by_role("button", name="Map advanced properties").click()
|
|
252
247
|
page.get_by_text("Advanced actions").click()
|
|
253
248
|
expect(page.get_by_role("button", name="Delete")).to_be_hidden()
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
def test_logged_in_user_should_have_a_message_to_attach_map(
|
|
252
|
+
anonymap, live_server, login, user, page, owner_session
|
|
253
|
+
):
|
|
254
|
+
page.goto(f"{live_server.url}{anonymap.get_absolute_url()}")
|
|
255
|
+
page.get_by_role("button", name="Edit").click()
|
|
256
|
+
expect(
|
|
257
|
+
page.get_by_text(
|
|
258
|
+
"This map is anonymous, do you want to attach it to your account?"
|
|
259
|
+
)
|
|
260
|
+
).to_be_hidden()
|
|
261
|
+
|
|
262
|
+
page = login(user)
|
|
263
|
+
page.goto(f"{live_server.url}{anonymap.get_absolute_url()}")
|
|
264
|
+
page.get_by_role("button", name="Edit").click()
|
|
265
|
+
expect(
|
|
266
|
+
page.get_by_text(
|
|
267
|
+
"This map is anonymous, do you want to attach it to your account?"
|
|
268
|
+
)
|
|
269
|
+
).to_be_visible()
|
|
270
|
+
with page.expect_response(re.compile(r".*/update/owner/.*")):
|
|
271
|
+
page.get_by_role("button", name="OK").click()
|
|
272
|
+
saved = Map.objects.get(pk=anonymap.pk)
|
|
273
|
+
assert saved.owner
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def test_can_attach_map_after_save(
|
|
277
|
+
live_server, user, page, tilelayer, context, settings
|
|
278
|
+
):
|
|
279
|
+
settings.ENABLE_ACCOUNT_LOGIN = True
|
|
280
|
+
page.goto(f"{live_server.url}/en/map/new")
|
|
281
|
+
expect(page.get_by_role("button", name="Anonymous")).to_be_visible()
|
|
282
|
+
expect(page.get_by_role("button", name="Visibility: Draft")).to_have_class(
|
|
283
|
+
re.compile(r".*anonymous.*")
|
|
284
|
+
)
|
|
285
|
+
assert not Map.objects.count()
|
|
286
|
+
with page.expect_response(re.compile(r".*/map/create/")):
|
|
287
|
+
page.get_by_role("button", name="Save draft", exact=True).click()
|
|
288
|
+
assert Map.objects.count() == 1
|
|
289
|
+
saved = Map.objects.last()
|
|
290
|
+
assert not saved.owner
|
|
291
|
+
with context.expect_page() as login_page_info:
|
|
292
|
+
page.get_by_role("link", name="log in").click()
|
|
293
|
+
login_page = login_page_info.value
|
|
294
|
+
expect(login_page).to_have_title("Login - Online map creator")
|
|
295
|
+
login_page.get_by_placeholder("Username").fill(user.username)
|
|
296
|
+
login_page.get_by_placeholder("Password").fill("123123")
|
|
297
|
+
with page.expect_response(re.compile(r".*/update/owner/")):
|
|
298
|
+
login_page.locator('#login_form input[type="submit"]').click()
|
|
299
|
+
expect(page.get_by_text("Map has been attached to your account")).to_be_visible()
|
|
300
|
+
saved = Map.objects.last()
|
|
301
|
+
assert saved.owner == user
|
|
302
|
+
expect(page.get_by_role("button", name="Anonymous")).to_be_hidden()
|
|
303
|
+
expect(page.get_by_role("button", name=user.username)).to_be_visible()
|
|
304
|
+
expect(page.get_by_role("button", name="Visibility: Draft")).not_to_have_class(
|
|
305
|
+
re.compile(r".*anonymous.*")
|
|
306
|
+
)
|
|
@@ -79,7 +79,9 @@ def test_cannot_put_script_tag_in_datalayer_name_or_description(
|
|
|
79
79
|
expect(page.get_by_text("before after")).to_be_visible()
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
def
|
|
82
|
+
def test_login_from_map_page_after_save(
|
|
83
|
+
live_server, page, tilelayer, settings, user, context
|
|
84
|
+
):
|
|
83
85
|
settings.ENABLE_ACCOUNT_LOGIN = True
|
|
84
86
|
assert Map.objects.count() == 0
|
|
85
87
|
page.goto(f"{live_server.url}/en/map/new/")
|
|
@@ -102,3 +104,25 @@ def test_login_from_map_page(live_server, page, tilelayer, settings, user, conte
|
|
|
102
104
|
assert Map.objects.count() == 1
|
|
103
105
|
# Use name should now appear on the header toolbar
|
|
104
106
|
expect(page.get_by_role("button", name="Joe")).to_be_visible()
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def test_login_from_unsaved_map_page(
|
|
110
|
+
live_server, page, tilelayer, settings, user, context
|
|
111
|
+
):
|
|
112
|
+
settings.ENABLE_ACCOUNT_LOGIN = True
|
|
113
|
+
assert Map.objects.count() == 0
|
|
114
|
+
page.goto(f"{live_server.url}/en/map/new/")
|
|
115
|
+
page.locator('[data-ref="user"]').click()
|
|
116
|
+
with context.expect_page() as login_page_info:
|
|
117
|
+
page.get_by_role("button", name="Login").click()
|
|
118
|
+
login_page = login_page_info.value
|
|
119
|
+
expect(login_page).to_have_title("Login - Online map creator")
|
|
120
|
+
login_page.get_by_placeholder("Username").fill(user.username)
|
|
121
|
+
login_page.get_by_placeholder("Password").fill("123123")
|
|
122
|
+
login_page.locator('#login_form input[type="submit"]').click()
|
|
123
|
+
# Login page should be closed
|
|
124
|
+
page.wait_for_timeout(500) # Seems needed from time to time…
|
|
125
|
+
assert len(context.pages) == 1
|
|
126
|
+
# Save should have proceed
|
|
127
|
+
# Use name should now appear on the header toolbar
|
|
128
|
+
expect(page.get_by_role("button", name="Joe")).to_be_visible()
|
|
@@ -353,6 +353,43 @@ def test_should_redraw_list_on_feature_delete(live_server, openmap, page, bootst
|
|
|
353
353
|
expect(buttons).to_have_count(3)
|
|
354
354
|
|
|
355
355
|
|
|
356
|
+
def test_should_change_feature_title_and_color_on_edit(
|
|
357
|
+
live_server, openmap, page, bootstrap
|
|
358
|
+
):
|
|
359
|
+
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit#2/19/-2")
|
|
360
|
+
expect(page.locator(".umap-browser .feature.marker")).to_contain_text(
|
|
361
|
+
"one point in france"
|
|
362
|
+
)
|
|
363
|
+
page.locator(".leaflet-marker-icon").click(modifiers=["Shift"])
|
|
364
|
+
page.locator('input[name="name"]').fill("changed name")
|
|
365
|
+
expect(page.locator(".umap-browser .feature.marker")).to_contain_text(
|
|
366
|
+
"changed name"
|
|
367
|
+
)
|
|
368
|
+
|
|
369
|
+
# Change color
|
|
370
|
+
expect(
|
|
371
|
+
page.get_by_role("listitem").filter(has_text="changed name").locator("i")
|
|
372
|
+
).to_have_css("background-color", "rgb(0, 0, 139)")
|
|
373
|
+
page.get_by_role("heading", name="Shape properties").click()
|
|
374
|
+
page.locator(".umap-field-color").get_by_role("button", name="define").first.click()
|
|
375
|
+
page.get_by_title("Crimson").click()
|
|
376
|
+
expect(
|
|
377
|
+
page.get_by_role("listitem").filter(has_text="changed name").locator("i")
|
|
378
|
+
).to_have_css("background-color", "rgb(220, 20, 60)")
|
|
379
|
+
|
|
380
|
+
# Undo color
|
|
381
|
+
page.locator(".edit-undo").click()
|
|
382
|
+
expect(
|
|
383
|
+
page.get_by_role("listitem").filter(has_text="changed name").locator("i")
|
|
384
|
+
).to_have_css("background-color", "rgb(0, 0, 139)")
|
|
385
|
+
|
|
386
|
+
# Undo title change
|
|
387
|
+
page.locator(".edit-undo").click()
|
|
388
|
+
expect(page.locator(".umap-browser .feature.marker")).to_contain_text(
|
|
389
|
+
"one point in france"
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
|
|
356
393
|
def test_should_show_header_for_display_on_load_false(
|
|
357
394
|
live_server, page, bootstrap, map, datalayer
|
|
358
395
|
):
|
|
@@ -426,6 +426,8 @@ def test_can_draw_a_polygon_and_invert_it(live_server, page, tilelayer, settings
|
|
|
426
426
|
page.get_by_text("Advanced properties").click()
|
|
427
427
|
page.get_by_text("Display the polygon inverted").click()
|
|
428
428
|
data = save_and_get_json(page)
|
|
429
|
+
# Close save message
|
|
430
|
+
page.get_by_role("dialog").get_by_role("button", name="Close").click()
|
|
429
431
|
assert len(data["features"]) == 1
|
|
430
432
|
assert data["features"][0]["geometry"]["type"] == "Polygon"
|
|
431
433
|
assert data["features"][0]["geometry"]["coordinates"] == [
|
|
@@ -137,6 +137,6 @@ def test_add_property_from_feature_properties_panel(
|
|
|
137
137
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
|
138
138
|
page.locator(".leaflet-marker-icon").click(modifiers=["Shift"])
|
|
139
139
|
page.get_by_role("button", name="Add a new field").click()
|
|
140
|
-
page.locator('input[name="
|
|
140
|
+
page.locator('input[name="key"]').fill("newprop")
|
|
141
141
|
page.get_by_role("button", name="OK").click()
|
|
142
142
|
expect(page.locator(".panel.right").get_by_text("newprop")).to_be_visible()
|
|
@@ -215,6 +215,25 @@ test two,53.725145179688646,2.9700064980570517,"""
|
|
|
215
215
|
)
|
|
216
216
|
|
|
217
217
|
|
|
218
|
+
def test_wkt_export(map, live_server, bootstrap, page):
|
|
219
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}?share")
|
|
220
|
+
button = page.get_by_role("button", name="wkt")
|
|
221
|
+
expect(button).to_be_visible()
|
|
222
|
+
with page.expect_download() as download_info:
|
|
223
|
+
button.click()
|
|
224
|
+
download = download_info.value
|
|
225
|
+
assert download.suggested_filename == "test_map.csv"
|
|
226
|
+
path = Path("/tmp/") / download.suggested_filename
|
|
227
|
+
download.save_as(path)
|
|
228
|
+
assert (
|
|
229
|
+
path.read_text()
|
|
230
|
+
== """name,geometry,description
|
|
231
|
+
name poly,"POLYGON ((11.25 53.585984,10.151367 52.975108,12.689209 52.167194,14.084473 53.199452,12.634277 53.618579,11.25 53.585984,11.25 53.585984))",
|
|
232
|
+
test one,POINT (-0.274658 52.57635),Some description
|
|
233
|
+
test two,"LINESTRING (-0.571289 54.476422,0.439453 54.610255,1.724854 53.448807,4.163818 53.988395,5.306396 53.533778,6.591797 53.709714,7.042236 53.350551)","""
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
|
|
218
237
|
def test_gpx_export(map, live_server, bootstrap, page):
|
|
219
238
|
page.goto(f"{live_server.url}{map.get_absolute_url()}?share")
|
|
220
239
|
button = page.get_by_role("button", name="gpx")
|