aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/playwright/test_basic.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/playwright/test_basic.py b/tests/playwright/test_basic.py
index 231962e..3ae0f58 100644
--- a/tests/playwright/test_basic.py
+++ b/tests/playwright/test_basic.py
@@ -101,6 +101,33 @@ def test_edit(page: Page, playwright_helper, dbaccess):
assert track.description == "Not so descriptive anymore"
+def test_edit_change_gpx(page: Page, playwright_helper, tmp_path, dbaccess):
+ playwright_helper.login()
+ track_id = playwright_helper.add_track().id
+
+ track = dbaccess.execute(select(models.Track).filter_by(id=track_id)).scalar_one()
+ old_cache = track.cache.length, track.cache.uphill, track.cache.downhill
+
+ page.goto(f"/track/{track_id}")
+ page.locator(".btn", has_text="Edit").click()
+
+ gpx_data = load_gpx_asset("Synthetic_BRouter_1.gpx.gz")
+ gpx_path = tmp_path / "NewGPX.gpx"
+ with open(gpx_path, "wb") as gpx_fobj:
+ gpx_fobj.write(gpx_data)
+
+ page.get_by_label("New file for this track").set_input_files(gpx_path)
+ page.locator(".btn", has_text="Save").click()
+
+ track = dbaccess.execute(select(models.Track).filter_by(id=track_id)).scalar_one()
+ new_cache = track.cache
+ dbaccess.refresh(new_cache)
+
+ assert old_cache[0] != new_cache.length
+ assert old_cache[1] != new_cache.uphill
+ assert old_cache[2] != new_cache.downhill
+
+
def test_browse(page: Page, playwright_helper, dbaccess):
playwright_helper.login()
track = playwright_helper.add_track()