stackchain-dashboard/tests/e2e/test_mobile_detail_watch_release.py
timmy 35a88bb398
Some checks failed
CI / lint (pull_request) Successful in 3m20s
CI / build-release (pull_request) Successful in 6s
CI / browser-journey (pull_request) Failing after 5m41s
CI / release-candidate (pull_request) Has been skipped
feat: watch assigned work from mobile detail (Closes #1309)
2026-08-23 14:42:06 +00:00

45 lines
1.7 KiB
Python

import os
from pathlib import Path
import pytest
if os.getenv("STACKCHAIN_RUN_RELEASE_E2E") != "1":
pytest.skip("packaged mobile detail-watch journey runs only in its gated CI job", allow_module_level=True)
pytest.importorskip("playwright.sync_api")
from playwright.sync_api import expect, sync_playwright
ROOT = Path(__file__).parents[2]
FRONTEND = ROOT / "frontend"
@pytest.mark.parametrize("viewport", [
{"width": 320, "height": 568},
{"width": 390, "height": 844},
])
def test_issue_and_pull_detail_watch_controls_are_phone_usable(viewport):
with sync_playwright() as playwright:
browser = playwright.chromium.launch(headless=True)
page = browser.new_page(viewport=viewport)
page.set_content((FRONTEND / "index.html").read_text())
page.add_style_tag(path=FRONTEND / "dashboard.css")
page.add_script_tag(path=FRONTEND / "search-preview.js")
for sheet, button, expected in [
("#issue-sheet", "#watch-issue-detail", "Watch issue"),
("#pull-sheet", "#watch-pull-detail", "Watch pull request"),
]:
page.locator(sheet).evaluate("node => node.classList.add('open')")
control = page.locator(button)
expect(control).to_be_visible()
expect(control).to_have_text(expected)
assert control.bounding_box()["height"] >= 44
control.focus()
expect(control).to_be_focused()
page.locator(sheet).evaluate("node => node.classList.remove('open')")
assert page.evaluate(
"document.documentElement.scrollWidth > document.documentElement.clientWidth"
) is False
browser.close()