aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2022-12-14 19:12:08 +0100
committerDaniel Schadt <kingdread@gmx.de>2022-12-14 19:12:08 +0100
commit58d1da5606d3bfe241e18fdf9416ec9a28f3a3f1 (patch)
tree75eba16a0f1a9e29928173072c597ba239243897 /tests
parent9da6679f4953bbf9d584dd5530ef7ca31ce502ab (diff)
downloadfietsboek-58d1da5606d3bfe241e18fdf9416ec9a28f3a3f1.tar.gz
fietsboek-58d1da5606d3bfe241e18fdf9416ec9a28f3a3f1.tar.bz2
fietsboek-58d1da5606d3bfe241e18fdf9416ec9a28f3a3f1.zip
add test for track browsing
Diffstat (limited to 'tests')
-rw-r--r--tests/playwright/test_basic.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/playwright/test_basic.py b/tests/playwright/test_basic.py
index 61779f1..b3e340d 100644
--- a/tests/playwright/test_basic.py
+++ b/tests/playwright/test_basic.py
@@ -8,7 +8,7 @@ from sqlalchemy import select
from testutils import load_gpx_asset
from fietsboek import models
-from fietsboek.models.track import Visibility
+from fietsboek.models.track import Visibility, TrackType
from fietsboek.config import Config
@@ -150,3 +150,35 @@ def test_edit(page: Page, john_doe, app_settings, dbaccess):
assert track.visibility == Visibility.PUBLIC
assert track.text_tags() == {"Shitty Tour"}
assert track.description == "Not so descriptive anymore"
+
+
+def test_browse(page: Page, john_doe, app_settings, dbaccess):
+ do_login(app_settings, page, john_doe)
+ with dbaccess:
+ track = models.Track(
+ title="We're looking for this track",
+ visibility=Visibility.PRIVATE,
+ description="Another description",
+ type=TrackType.ORGANIC,
+ )
+ track.date = datetime.datetime.now(datetime.timezone.utc)
+ track.gpx_data = load_gpx_asset("Teasi_1.gpx.gz")
+ john_doe.tracks.append(track)
+ dbaccess.commit()
+
+ page.goto("/")
+ page.get_by_text("Browse").click()
+
+ expect(page.locator(".card-header", has_text="We're looking for this track")).to_be_visible()
+
+ page.get_by_role("textbox", name="Search terms").fill("Nothing")
+ page.get_by_role("button", name="Apply filters").click()
+
+ expect(
+ page.locator("p", has_text="No results matching the filters were found.")
+ ).to_be_visible()
+
+ page.get_by_role("textbox", name="Search terms").fill("looking for")
+ page.get_by_role("button", name="Apply filters").click()
+
+ expect(page.locator(".card-header", has_text="We're looking for this track")).to_be_visible()