diff options
author | Daniel Schadt <kingdread@gmx.de> | 2022-12-13 22:13:23 +0100 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2022-12-13 22:13:23 +0100 |
commit | 9da6679f4953bbf9d584dd5530ef7ca31ce502ab (patch) | |
tree | 79d557cd598cb13c82612a75be834ecc0aea64f2 /tests | |
parent | 17f7b14c7d541045df28a99c008b5b236ec75042 (diff) | |
download | fietsboek-9da6679f4953bbf9d584dd5530ef7ca31ce502ab.tar.gz fietsboek-9da6679f4953bbf9d584dd5530ef7ca31ce502ab.tar.bz2 fietsboek-9da6679f4953bbf9d584dd5530ef7ca31ce502ab.zip |
add a test for editing tracks
Diffstat (limited to 'tests')
-rw-r--r-- | tests/playwright/test_basic.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/playwright/test_basic.py b/tests/playwright/test_basic.py index 4c6f9d6..61779f1 100644 --- a/tests/playwright/test_basic.py +++ b/tests/playwright/test_basic.py @@ -111,3 +111,42 @@ def test_upload(page: Page, john_doe, app_settings, tmp_path, dbaccess): assert track.visibility == Visibility.PUBLIC assert track.text_tags() == {"Tolle Tour"} assert track.description == "Beschreibung der tollen Tour" + + +def test_edit(page: Page, john_doe, app_settings, dbaccess): + do_login(app_settings, page, john_doe) + with dbaccess: + track = models.Track( + title="Another awesome track", + visibility=Visibility.PRIVATE, + description="Another description", + ) + track.date = datetime.datetime.now(datetime.timezone.utc) + track.gpx_data = load_gpx_asset("Teasi_1.gpx.gz") + john_doe.tracks.append(track) + dbaccess.flush() + track_id = track.id + dbaccess.commit() + + page.goto(f"/track/{track_id}") + page.locator(".btn", has_text="Edit").click() + + # We now fill in most of the data + page.get_by_label("Title").fill("Not so awesome anymore!") + page.get_by_label("Date").type("09232019") + page.get_by_label("Date").press("Tab") + page.get_by_label("Date").type("15:28") + page.get_by_label("Visibility").select_option(label="Public") + page.get_by_label("Tags").fill("Shitty Tour") + page.get_by_role("button", name="Add Tag").click() + page.get_by_label("Description").fill("Not so descriptive anymore") + + page.locator(".btn", has_text="Save").click() + + track = dbaccess.execute(select(models.Track).filter_by(id=track_id)).scalar_one() + + assert track.title == "Not so awesome anymore!" + assert track.date.replace(tzinfo=None) == datetime.datetime(2019, 9, 23, 15, 28) + assert track.visibility == Visibility.PUBLIC + assert track.text_tags() == {"Shitty Tour"} + assert track.description == "Not so descriptive anymore" |