1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
from playwright.sync_api import Page, expect
from sqlalchemy import select
from testutils import extract_and_upload
from fietsboek import models
def test_transformer_zero_elevation_disabled(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()
# Once we have finished the upload, extract the ID of the track and check
# the properties
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):
playwright_helper.login()
page.goto("/")
page.get_by_text("Upload").click()
extract_and_upload(page, "Synthetic_Zero_Elevation.gpx.gz", tmp_path)
page.locator("#transformer-heading-1 .accordion-button").click()
page.locator("#transformer-enabled-1").click()
page.locator(".btn", has_text="Upload").click()
# Once we have finished the upload, extract the ID of the track and check
# the properties
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_steep_slope_disabled(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()
# Once we have finished the upload, extract the ID of the track and check
# the properties
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):
playwright_helper.login()
page.goto("/")
page.get_by_text("Upload").click()
extract_and_upload(page, "Synthetic_Steep_Slope.gpx.gz", tmp_path)
page.locator("#transformer-heading-1 .accordion-button").click()
page.locator("#transformer-enabled-1").click()
page.locator(".btn", has_text="Upload").click()
# Once we have finished the upload, extract the ID of the track and check
# the properties
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")
|