mirror of
https://github.com/Sea-Haven-Industries/meal-order-manager.git
synced 2026-10-07 16:18:54 +00:00
test(form): strengthen phone-width coverage
This commit is contained in:
parent
fca2ec6044
commit
2df66fd36f
1 changed files with 29 additions and 4 deletions
|
|
@ -70,8 +70,8 @@ def _render(*, google: bool = False, api_key: str = "test-key") -> str:
|
||||||
def _google_credential() -> str:
|
def _google_credential() -> str:
|
||||||
payload = json.dumps(
|
payload = json.dumps(
|
||||||
{
|
{
|
||||||
"name": "Adam Moussa",
|
"name": "Test Admin",
|
||||||
"email": "adam.moussa@seahavenind.com",
|
"email": "test-admin@example.com",
|
||||||
"picture": (
|
"picture": (
|
||||||
"data:image/svg+xml,"
|
"data:image/svg+xml,"
|
||||||
"<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40'/>"
|
"<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40'/>"
|
||||||
|
|
@ -309,7 +309,7 @@ class TestGenerateFormPlaywright:
|
||||||
)
|
)
|
||||||
assert page.locator("#total-display").inner_text() == "$10.80"
|
assert page.locator("#total-display").inner_text() == "$10.80"
|
||||||
|
|
||||||
@pytest.mark.parametrize("width", [320, 375])
|
@pytest.mark.parametrize("width", [320, 375, 479])
|
||||||
def test_local_roster_has_no_horizontal_overflow(self, browser_page, width):
|
def test_local_roster_has_no_horizontal_overflow(self, browser_page, width):
|
||||||
page = browser_page
|
page = browser_page
|
||||||
page.set_viewport_size({"width": width, "height": 800})
|
page.set_viewport_size({"width": width, "height": 800})
|
||||||
|
|
@ -406,7 +406,32 @@ class TestGenerateFormGooglePlaywright:
|
||||||
"#admin-btn",
|
"#admin-btn",
|
||||||
"#sign-out-btn",
|
"#sign-out-btn",
|
||||||
):
|
):
|
||||||
assert page.locator(selector).is_visible()
|
locator = page.locator(selector)
|
||||||
|
assert locator.is_visible()
|
||||||
|
bounds = locator.evaluate(
|
||||||
|
"""element => {
|
||||||
|
const rect = element.getBoundingClientRect();
|
||||||
|
return {
|
||||||
|
left: rect.left,
|
||||||
|
top: rect.top,
|
||||||
|
right: rect.right,
|
||||||
|
bottom: rect.bottom,
|
||||||
|
viewportWidth: window.innerWidth,
|
||||||
|
viewportHeight: window.innerHeight,
|
||||||
|
};
|
||||||
|
}"""
|
||||||
|
)
|
||||||
|
assert bounds["left"] >= 0
|
||||||
|
assert bounds["top"] >= 0
|
||||||
|
assert bounds["right"] <= bounds["viewportWidth"]
|
||||||
|
assert bounds["bottom"] <= bounds["viewportHeight"]
|
||||||
|
|
||||||
|
for selector in ("#user-name", "#user-email"):
|
||||||
|
assert page.locator(selector).evaluate(
|
||||||
|
"""element =>
|
||||||
|
element.scrollWidth <= element.clientWidth &&
|
||||||
|
element.scrollHeight <= element.clientHeight"""
|
||||||
|
)
|
||||||
assert page.locator("#admin-btn").is_enabled()
|
assert page.locator("#admin-btn").is_enabled()
|
||||||
assert page.locator("#sign-out-btn").is_enabled()
|
assert page.locator("#sign-out-btn").is_enabled()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue