aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/assets/Elevation_Jump.gpx.gzbin0 -> 4417 bytes
-rw-r--r--tests/integration/test_smoke.py2
-rw-r--r--tests/playwright/test_transformers.py29
3 files changed, 30 insertions, 1 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/integration/test_smoke.py b/tests/integration/test_smoke.py
index 5176e88..cead68d 100644
--- a/tests/integration/test_smoke.py
+++ b/tests/integration/test_smoke.py
@@ -1,7 +1,7 @@
def test_home(testapp):
res = testapp.get("/")
assert res.status_code == 200
- assert b'<h1>Home</h1>' in res.body
+ assert b'<h1 class="float-start">Home</h1>' in res.body
def test_maintenance(testapp, data_manager):
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