umap/umap/tests/integration/test_slideshow.py
Yohan Boniface 787f22efd4 WIP: rename DataLayer/Map.settings to DataLayer/Map.metadata and more
The main goal is to clarify the use of options/settings/properties…

- `settings` should be reserved to Django
- `options` should be reserved to pure Leaflet context
- `properties` used in the geojson context, for user data

Main changes:
- `DataLayer.settings` is renamed to `DataLayer.metadata`
- `DataLayer.geojson` is renamed to `Datalayer.data`
- `DataLayer.metadata` are not saved anymore in the geojson data file
- `Map.settings` is renamed to `Map.metadata`
- `Map.metadata` is now a flat key/value object, not a geojson Feature anymore
- `Map.zoom` is now populated and reused

Note: U.Map is still inheriting from Leaflet Map, so it mixes
`options` and `metadata`.

This changes is very intrusive, it changes

- the DB schema
- the way we store data in the FS (now without metadata)
- the way we backup map data

fix #1636
prepares #1335
prepares #1635
prepares #175
2024-08-27 11:24:31 +02:00

65 lines
1.8 KiB
Python

import pytest
from playwright.sync_api import expect
from ..base import DataLayerFactory
pytestmark = pytest.mark.django_db
DATALAYER_DATA = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [13.6, 48.5],
},
"properties": {"name": "1st Point"},
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [13.7, 48.4],
},
"properties": {"name": "2d Point"},
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [13.5, 48.6],
},
"properties": {"name": "3d Point"},
},
],
}
def test_can_use_slideshow_manually(map, live_server, page):
map.metadata["slideshow"] = {"active": True, "delay": 5000}
map.save()
DataLayerFactory(map=map, data=DATALAYER_DATA)
page.goto(f"{live_server.url}{map.get_absolute_url()}")
first_point = page.get_by_text("1st Point")
second_point = page.get_by_text("2d Point")
third_point = page.get_by_text("3d Point")
expect(first_point).to_be_hidden()
expect(second_point).to_be_hidden()
expect(third_point).to_be_hidden()
next_ = page.get_by_title("Zoom to the next")
expect(next_).to_be_visible()
next_.click()
expect(first_point).to_be_visible()
next_.click()
expect(first_point).to_be_hidden()
expect(second_point).to_be_visible()
next_.click()
expect(first_point).to_be_hidden()
expect(second_point).to_be_hidden()
expect(third_point).to_be_visible()
next_.click()
expect(first_point).to_be_visible()
expect(second_point).to_be_hidden()
expect(third_point).to_be_hidden()