test actions for playwright

playwright
Markos Gogoulos 2022-12-06 12:28:39 +02:00
rodzic 6b7c707135
commit 8990d1ed01
1 zmienionych plików z 40 dodań i 0 usunięć

Wyświetl plik

@ -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"))