From 8990d1ed01e60f625cc5b6ca934bf35f3fcb3a94 Mon Sep 17 00:00:00 2001 From: Markos Gogoulos Date: Tue, 6 Dec 2022 12:28:39 +0200 Subject: [PATCH] test actions for playwright --- tests/e2e/test_actions.py | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/e2e/test_actions.py diff --git a/tests/e2e/test_actions.py b/tests/e2e/test_actions.py new file mode 100644 index 0000000..24602df --- /dev/null +++ b/tests/e2e/test_actions.py @@ -0,0 +1,40 @@ +import re +from playwright.sync_api import Page, expect + + +def test_register_link(page: Page): + page.goto("https://demo.mediacms.io/") + + # Expect a title "to contain" a substring. + expect(page).to_have_title(re.compile("MediaCMS")) + + # create a locator + get_started = page.get_by_role("link", name="REGISTER") + + # Expect an attribute "to be strictly equal" to the value. + expect(get_started).to_have_attribute("href", "/accounts/signup/") + + # Click the get started link. + get_started.click() + + # Expects the URL to contain intro. + expect(page).to_have_url(re.compile(".*signup")) + +def test_login_link(page: Page): + page.goto("https://demo.mediacms.io/") + + # Expect a title "to contain" a substring. + expect(page).to_have_title(re.compile("MediaCMS")) + + # create a locator + get_started = page.get_by_role("link", name="SIGN IN") + + # Expect an attribute "to be strictly equal" to the value. + expect(get_started).to_have_attribute("href", "/accounts/login/") + + # Click the get started link. + get_started.click() + + # Expects the URL to contain intro. + expect(page).to_have_url(re.compile(".*login")) +