aboutsummaryrefslogtreecommitdiff
path: root/tests/playwright
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2023-03-07 19:03:02 +0100
committerDaniel Schadt <kingdread@gmx.de>2023-03-07 19:03:02 +0100
commit5a7c780b4f171de2476a4ff060cc450b4e3a3749 (patch)
tree3f94e8ffc7d0e3ee2c1734364889d60de90aa28f /tests/playwright
parente9025533b86228f7073a672269c939c5ae5db8e2 (diff)
downloadfietsboek-5a7c780b4f171de2476a4ff060cc450b4e3a3749.tar.gz
fietsboek-5a7c780b4f171de2476a4ff060cc450b4e3a3749.tar.bz2
fietsboek-5a7c780b4f171de2476a4ff060cc450b4e3a3749.zip
also test transformers when editing a track
Diffstat (limited to 'tests/playwright')
-rw-r--r--tests/playwright/test_transformers.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/playwright/test_transformers.py b/tests/playwright/test_transformers.py
index 0fc4ffc..d12be5e 100644
--- a/tests/playwright/test_transformers.py
+++ b/tests/playwright/test_transformers.py
@@ -46,6 +46,30 @@ def test_transformer_zero_elevation_enabled(page: Page, playwright_helper, tmp_p
expect(page.locator("#detailsUphill")).to_contain_text("0 m")
+def test_transformer_zero_elevation_edited(page: Page, playwright_helper, tmp_path, dbaccess):
+ playwright_helper.login()
+
+ page.goto("/")
+ page.get_by_text("Upload").click()
+
+ extract_and_upload(page, "Synthetic_Zero_Elevation.gpx.gz", tmp_path)
+
+ page.locator(".btn", has_text="Upload").click()
+
+ page.locator(".btn", has_text="Edit").click()
+
+ page.locator("#transformer-heading-1 .accordion-button").click()
+ page.locator("#transformer-enabled-1").click()
+
+ page.locator(".btn", has_text="Save").click()
+
+ track_id = int(page.url.rsplit("/", 1)[1])
+ track = dbaccess.execute(select(models.Track).filter_by(id=track_id)).scalar_one()
+
+ assert track.cache.uphill < 0.1
+ expect(page.locator("#detailsUphill")).to_contain_text("0 m")
+
+
def test_transformer_steep_slope_disabled(page: Page, playwright_helper, tmp_path, dbaccess):
playwright_helper.login()
@@ -85,3 +109,27 @@ def test_transformer_steep_slope_enabled(page: Page, playwright_helper, tmp_path
assert track.cache.uphill < 2
expect(page.locator("#detailsUphill")).to_contain_text("1.2 m")
+
+
+def test_transformer_steep_slope_edited(page: Page, playwright_helper, tmp_path, dbaccess):
+ playwright_helper.login()
+
+ page.goto("/")
+ page.get_by_text("Upload").click()
+
+ extract_and_upload(page, "Synthetic_Steep_Slope.gpx.gz", tmp_path)
+
+ page.locator(".btn", has_text="Upload").click()
+
+ page.locator(".btn", has_text="Edit").click()
+
+ page.locator("#transformer-heading-1 .accordion-button").click()
+ page.locator("#transformer-enabled-1").click()
+
+ page.locator(".btn", has_text="Save").click()
+
+ track_id = int(page.url.rsplit("/", 1)[1])
+ track = dbaccess.execute(select(models.Track).filter_by(id=track_id)).scalar_one()
+
+ assert track.cache.uphill < 2
+ expect(page.locator("#detailsUphill")).to_contain_text("1.2 m")