diff options
author | Daniel Schadt <kingdread@gmx.de> | 2022-12-22 20:12:02 +0100 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2022-12-22 20:12:02 +0100 |
commit | ad26d3fe30c653243232188d1cb88858bf2e63f4 (patch) | |
tree | 4644ca7c55827f439ffb37a617cc011a96c83b8f /tests/playwright/test_home.py | |
parent | c0c8e764a8819ba10066beb4ca829488ceed4e9d (diff) | |
download | fietsboek-ad26d3fe30c653243232188d1cb88858bf2e63f4.tar.gz fietsboek-ad26d3fe30c653243232188d1cb88858bf2e63f4.tar.bz2 fietsboek-ad26d3fe30c653243232188d1cb88858bf2e63f4.zip |
add more tests for the home page
Diffstat (limited to 'tests/playwright/test_home.py')
-rw-r--r-- | tests/playwright/test_home.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/playwright/test_home.py b/tests/playwright/test_home.py new file mode 100644 index 0000000..096a7ff --- /dev/null +++ b/tests/playwright/test_home.py @@ -0,0 +1,40 @@ +from playwright.sync_api import Page, expect + + +def test_homepage(page: Page): + page.goto("/") + assert "Welcome to Fietsboek!" in page.content() + assert "Here you can …" in page.content() + + +def test_homepage_logged_in(page: Page, playwright_helper): + playwright_helper.login() + playwright_helper.add_track() + + page.goto("/") + + expect(page.locator("h1", has_text="Home")).to_be_visible() + expect(page.locator("a", has_text="Another awesome track")).to_be_visible() + + +def test_homepage_collapse(page: Page, playwright_helper): + playwright_helper.login() + playwright_helper.add_track() + + page.goto("/") + + page.locator(".summary-toggler").nth(0).click() + expect(page.locator("a", has_text="Another awesome track")).not_to_be_visible() + expect(page.locator(".list-group-item-secondary", has_text="December")).not_to_be_visible() + + page.locator(".summary-toggler").nth(0).click() + expect(page.locator("a", has_text="Another awesome track")).to_be_visible() + expect(page.locator(".list-group-item-secondary", has_text="December")).to_be_visible() + + page.locator(".summary-toggler").nth(1).click() + expect(page.locator("a", has_text="Another awesome track")).not_to_be_visible() + expect(page.locator(".list-group-item-secondary", has_text="December")).to_be_visible() + + page.locator(".summary-toggler").nth(1).click() + expect(page.locator("a", has_text="Another awesome track")).to_be_visible() + expect(page.locator(".list-group-item-secondary", has_text="December")).to_be_visible() |