aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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()