aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/assets/Elevation_Jump.gpx.gzbin0 -> 4417 bytes
-rw-r--r--tests/playwright/test_transformers.py29
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/assets/Elevation_Jump.gpx.gz b/tests/assets/Elevation_Jump.gpx.gz
new file mode 100644
index 0000000..836ddb1
--- /dev/null
+++ b/tests/assets/Elevation_Jump.gpx.gz
Binary files differ
diff --git a/tests/playwright/test_transformers.py b/tests/playwright/test_transformers.py
index d4f07e1..fc89afb 100644
--- a/tests/playwright/test_transformers.py
+++ b/tests/playwright/test_transformers.py
@@ -1,3 +1,4 @@
+import gpxpy
from playwright.sync_api import Page, expect
from sqlalchemy import select
@@ -141,3 +142,31 @@ def test_transformer_steep_slope_edited(page: Page, playwright_helper, tmp_path,
track = dbaccess.execute(select(models.Track).filter_by(id=track_id)).scalar_one()
assert track.cache.uphill < 2
+
+
+def test_transformer_elevation_jump_enabled(page: Page, playwright_helper, tmp_path, data_manager):
+ playwright_helper.login()
+
+ page.goto("/")
+ page.get_by_text("Upload").click()
+
+ extract_and_upload(page, "Elevation_Jump.gpx.gz", tmp_path)
+
+ page.locator("#transformer-heading-2 .accordion-button").click()
+ page.locator("#transformer-2.collapse.show").wait_for()
+ page.locator("#transformer-enabled-2").check()
+
+ page.locator(".btn", has_text="Upload").click()
+
+ page.locator(".alert", has_text="Upload successful").wait_for()
+
+ new_track_id = int(page.url.rsplit("/", 1)[1])
+ data = data_manager.open(new_track_id)
+
+ gpx = gpxpy.parse(data.decompress_gpx())
+ points = iter(gpx.walk(only_points=True))
+ next(points)
+ for prev_point, point in zip(gpx.walk(only_points=True), points):
+ # The given GPX has a jump of 94 between two consecutive points, so
+ # here we assert that that jump is gone.
+ assert abs(prev_point.elevation - point.elevation) < 10.0