aboutsummaryrefslogtreecommitdiff
path: root/tests/playwright/test_profiles.py
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2023-04-01 13:08:02 +0200
committerDaniel Schadt <kingdread@gmx.de>2023-04-01 13:08:02 +0200
commite37e056c36272e5f0c0e23bd993290208e14a979 (patch)
treed9fd93519a7361256c48de7931efe546180580d5 /tests/playwright/test_profiles.py
parentbc5074a52b81e85245d628aebd23eb65c496c35a (diff)
downloadfietsboek-e37e056c36272e5f0c0e23bd993290208e14a979.tar.gz
fietsboek-e37e056c36272e5f0c0e23bd993290208e14a979.tar.bz2
fietsboek-e37e056c36272e5f0c0e23bd993290208e14a979.zip
add some very basic tests for profiles
I'd like to have more, but this is a start (and already caught some errors, see the last two commits).
Diffstat (limited to 'tests/playwright/test_profiles.py')
-rw-r--r--tests/playwright/test_profiles.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/playwright/test_profiles.py b/tests/playwright/test_profiles.py
new file mode 100644
index 0000000..40d8ba8
--- /dev/null
+++ b/tests/playwright/test_profiles.py
@@ -0,0 +1,27 @@
+from playwright.sync_api import Page, expect
+
+from .conftest import Helper
+
+
+def test_forbidden(page: Page, playwright_helper: Helper):
+ john = playwright_helper.john_doe()
+
+ with page.expect_response(lambda resp: resp.status == 403):
+ page.goto(f"/user/{john.id}")
+
+
+def test_profile(page: Page, playwright_helper: Helper):
+ playwright_helper.login()
+
+ page.goto("/")
+ page.get_by_role("button", name="User").click()
+ page.get_by_role("link", name="Profile").click()
+
+ expect(page.locator("#profileLength")).to_have_text("0 km")
+ expect(page.locator("#profileUphill")).to_have_text("0 m")
+ expect(page.locator("#profileDownhill")).to_have_text("0 m")
+ expect(page.locator("#profileMovingTime")).to_have_text("0:00:00")
+ expect(page.locator("#profileStoppedTime")).to_have_text("0:00:00")
+ expect(page.locator("#profileMaxSpeed")).to_have_text("0 km/h")
+ expect(page.locator("#profileAvgSpeed")).to_have_text("0 km/h")
+ expect(page.locator("#profileNumberOfTracks")).to_have_text("0")