aboutsummaryrefslogtreecommitdiff
path: root/tests/playwright/test_transformers.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/playwright/test_transformers.py')
-rw-r--r--tests/playwright/test_transformers.py23
1 files changed, 9 insertions, 14 deletions
diff --git a/tests/playwright/test_transformers.py b/tests/playwright/test_transformers.py
index d12be5e..0b2e4de 100644
--- a/tests/playwright/test_transformers.py
+++ b/tests/playwright/test_transformers.py
@@ -15,13 +15,14 @@ def test_transformer_zero_elevation_disabled(page: Page, playwright_helper, tmp_
page.locator(".btn", has_text="Upload").click()
- # Once we have finished the upload, extract the ID of the track and check
- # the properties
+ # Expect early (here and in the other tests) to ensure that the backend has
+ # caught up with executing the transformer. Otherwise it might happen that
+ # we read the database while the request is not finished yet.
+ expect(page.locator("#detailsUphill")).to_contain_text("167.7 m")
new_track_id = int(page.url.rsplit("/", 1)[1])
track = dbaccess.execute(select(models.Track).filter_by(id=new_track_id)).scalar_one()
assert track.cache.uphill > 160
- expect(page.locator("#detailsUphill")).to_contain_text("167.7 m")
def test_transformer_zero_elevation_enabled(page: Page, playwright_helper, tmp_path, dbaccess):
@@ -37,13 +38,11 @@ def test_transformer_zero_elevation_enabled(page: Page, playwright_helper, tmp_p
page.locator(".btn", has_text="Upload").click()
- # Once we have finished the upload, extract the ID of the track and check
- # the properties
+ expect(page.locator("#detailsUphill")).to_contain_text("0 m")
new_track_id = int(page.url.rsplit("/", 1)[1])
track = dbaccess.execute(select(models.Track).filter_by(id=new_track_id)).scalar_one()
assert track.cache.uphill < 0.1
- expect(page.locator("#detailsUphill")).to_contain_text("0 m")
def test_transformer_zero_elevation_edited(page: Page, playwright_helper, tmp_path, dbaccess):
@@ -63,11 +62,11 @@ def test_transformer_zero_elevation_edited(page: Page, playwright_helper, tmp_pa
page.locator(".btn", has_text="Save").click()
+ expect(page.locator("#detailsUphill")).to_contain_text("0 m")
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):
@@ -80,13 +79,11 @@ def test_transformer_steep_slope_disabled(page: Page, playwright_helper, tmp_pat
page.locator(".btn", has_text="Upload").click()
- # Once we have finished the upload, extract the ID of the track and check
- # the properties
+ expect(page.locator("#detailsUphill")).to_contain_text("61.54 m")
new_track_id = int(page.url.rsplit("/", 1)[1])
track = dbaccess.execute(select(models.Track).filter_by(id=new_track_id)).scalar_one()
assert track.cache.uphill > 60
- expect(page.locator("#detailsUphill")).to_contain_text("61.54 m")
def test_transformer_steep_slope_enabled(page: Page, playwright_helper, tmp_path, dbaccess):
@@ -102,13 +99,11 @@ def test_transformer_steep_slope_enabled(page: Page, playwright_helper, tmp_path
page.locator(".btn", has_text="Upload").click()
- # Once we have finished the upload, extract the ID of the track and check
- # the properties
+ expect(page.locator("#detailsUphill")).to_contain_text("1.2 m")
new_track_id = int(page.url.rsplit("/", 1)[1])
track = dbaccess.execute(select(models.Track).filter_by(id=new_track_id)).scalar_one()
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):
@@ -128,8 +123,8 @@ def test_transformer_steep_slope_edited(page: Page, playwright_helper, tmp_path,
page.locator(".btn", has_text="Save").click()
+ expect(page.locator("#detailsUphill")).to_contain_text("1.2 m")
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")