diff options
author | Daniel Schadt <kingdread@gmx.de> | 2023-05-15 20:19:48 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2023-05-15 20:19:48 +0200 |
commit | e6e0271278765eed288e9f7da27ffaa423d64d53 (patch) | |
tree | 8bd212655d2d0daf81e00158cca625dddfb330d7 /tests | |
parent | 844a652e47b3a9d5fd44eee8ec0d6a49b9bde91c (diff) | |
parent | c635dcc671810f46cf4c2783da7d11b6cd0b97ec (diff) | |
download | fietsboek-e6e0271278765eed288e9f7da27ffaa423d64d53.tar.gz fietsboek-e6e0271278765eed288e9f7da27ffaa423d64d53.tar.bz2 fietsboek-e6e0271278765eed288e9f7da27ffaa423d64d53.zip |
Merge branch 'elevation-jumper'
Diffstat (limited to 'tests')
-rw-r--r-- | tests/assets/Elevation_Jump.gpx.gz | bin | 0 -> 4417 bytes | |||
-rw-r--r-- | tests/playwright/test_transformers.py | 29 |
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/assets/Elevation_Jump.gpx.gz b/tests/assets/Elevation_Jump.gpx.gz Binary files differnew file mode 100644 index 0000000..836ddb1 --- /dev/null +++ b/tests/assets/Elevation_Jump.gpx.gz 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 |