feat: schedule mobile notification quiet hours (Closes #1392)
This commit is contained in:
1 parent
2acd9431e0
commit
cc74b7b8db
9 files changed
+487
-28
No files matched your search
@@ -0,0 +1,44 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
if os.getenv("STACKCHAIN_RUN_RELEASE_E2E") != "1":
|
||||
pytest.skip("rendered mobile quiet-hours checks run only in the browser gate", allow_module_level=True)
|
||||
pytest.importorskip("playwright.sync_api")
|
||||
from playwright.sync_api import expect, sync_playwright
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
FRONTEND = ROOT / "frontend"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("viewport", [
|
||||
{"width": 320, "height": 568},
|
||||
{"width": 390, "height": 844},
|
||||
])
|
||||
def test_notification_quiet_hours_are_phone_usable_without_horizontal_scroll(viewport):
|
||||
html = re.sub(r'<script src="static/[^"]+"></script>', "", (FRONTEND / "index.html").read_text())
|
||||
with sync_playwright() as playwright:
|
||||
browser = playwright.chromium.launch(headless=True)
|
||||
page = browser.new_page(viewport=viewport)
|
||||
page.set_content(html)
|
||||
page.add_style_tag(path=FRONTEND / "dashboard.css")
|
||||
page.locator("#work-settings-toggle").click()
|
||||
|
||||
toggle = page.locator('label[for="push-quiet-hours"]')
|
||||
start = page.locator("#push-quiet-start")
|
||||
end = page.locator("#push-quiet-end")
|
||||
expect(toggle).to_be_visible()
|
||||
expect(start).to_be_visible()
|
||||
expect(end).to_be_visible()
|
||||
expect(start).to_have_value("22:00")
|
||||
expect(end).to_have_value("07:00")
|
||||
for control in (toggle, start, end):
|
||||
bounds = control.bounding_box()
|
||||
assert bounds and bounds["height"] >= 44
|
||||
assert page.evaluate("document.documentElement.scrollWidth <= window.innerWidth")
|
||||
browser.close()
|
||||
Reference in new issue
Block a user