Add integration test for textarea import
This commit is contained in:
parent
c62c327878
commit
50da2c0e1c
1 changed files with 25 additions and 1 deletions
|
@ -6,7 +6,7 @@ from playwright.sync_api import expect
|
||||||
pytestmark = pytest.mark.django_db
|
pytestmark = pytest.mark.django_db
|
||||||
|
|
||||||
|
|
||||||
def test_umap_import(live_server, datalayer, page):
|
def test_umap_import_from_file(live_server, datalayer, page):
|
||||||
page.goto(f"{live_server.url}/map/new/")
|
page.goto(f"{live_server.url}/map/new/")
|
||||||
button = page.get_by_title("Import data (Ctrl+I)")
|
button = page.get_by_title("Import data (Ctrl+I)")
|
||||||
expect(button).to_be_visible()
|
expect(button).to_be_visible()
|
||||||
|
@ -23,3 +23,27 @@ def test_umap_import(live_server, datalayer, page):
|
||||||
expect(layers).to_have_count(3)
|
expect(layers).to_have_count(3)
|
||||||
nonloaded = page.locator(".umap-browse-datalayers li.off")
|
nonloaded = page.locator(".umap-browse-datalayers li.off")
|
||||||
expect(nonloaded).to_have_count(1)
|
expect(nonloaded).to_have_count(1)
|
||||||
|
|
||||||
|
|
||||||
|
def test_umap_import_geojson_from_textarea(live_server, datalayer, page):
|
||||||
|
page.goto(f"{live_server.url}/map/new/")
|
||||||
|
layers = page.locator(".umap-browse-datalayers li")
|
||||||
|
markers = page.locator(".leaflet-marker-icon")
|
||||||
|
paths = page.locator("path")
|
||||||
|
expect(markers).to_have_count(0)
|
||||||
|
expect(paths).to_have_count(0)
|
||||||
|
expect(layers).to_have_count(1)
|
||||||
|
button = page.get_by_title("Import data (Ctrl+I)")
|
||||||
|
expect(button).to_be_visible()
|
||||||
|
button.click()
|
||||||
|
textarea = page.locator(".umap-upload textarea")
|
||||||
|
path = Path(__file__).parent.parent / "fixtures/test_upload_data.json"
|
||||||
|
textarea.fill(path.read_text())
|
||||||
|
page.locator('select[name="format"]').select_option("geojson")
|
||||||
|
button = page.get_by_role("button", name="Import", exact=True)
|
||||||
|
expect(button).to_be_visible()
|
||||||
|
button.click()
|
||||||
|
# No layer has been created
|
||||||
|
expect(layers).to_have_count(1)
|
||||||
|
expect(markers).to_have_count(2)
|
||||||
|
expect(paths).to_have_count(3)
|
||||||
|
|
Loading…
Reference in a new issue