test: exercise mobile reviewer status journey
This commit is contained in:
1 parent
bd96c3caa3
commit
3bc1d2f602
3 files changed
+90
-2
No files matched your search
@@ -0,0 +1,87 @@
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
ROOT = Path(__file__).parents[2]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("viewport", [(320, 568), (390, 844)])
|
||||
def test_mobile_pull_reviewer_status_wraps_and_keeps_updated_review_reachable(viewport):
|
||||
playwright = pytest.importorskip("playwright.sync_api")
|
||||
html = (ROOT / "frontend" / "index.html").read_text()
|
||||
detail = {
|
||||
"state": "open",
|
||||
"draft": False,
|
||||
"mergeable": True,
|
||||
"merged": False,
|
||||
"ci_state": "success",
|
||||
"head_sha": "current-head",
|
||||
"reviewers": [
|
||||
{
|
||||
"login": "casey-with-a-very-long-mobile-login",
|
||||
"status": "waiting",
|
||||
"head_sha": "current-head",
|
||||
"blocking": True,
|
||||
},
|
||||
{
|
||||
"login": "sam",
|
||||
"status": "changes_requested",
|
||||
"head_sha": "current-head",
|
||||
"blocking": True,
|
||||
},
|
||||
{
|
||||
"login": "lee",
|
||||
"status": "outdated",
|
||||
"head_sha": "old-head",
|
||||
"blocking": True,
|
||||
},
|
||||
{
|
||||
"login": "pat",
|
||||
"status": "approved",
|
||||
"head_sha": "current-head",
|
||||
"blocking": False,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
with playwright.sync_playwright() as runtime:
|
||||
try:
|
||||
browser = runtime.chromium.launch(headless=True)
|
||||
except Exception as error:
|
||||
pytest.skip(f"Chromium is not installed: {error}")
|
||||
page = browser.new_page(viewport={"width": viewport[0], "height": viewport[1]})
|
||||
page.set_content(html, wait_until="domcontentloaded")
|
||||
page.add_style_tag(path=ROOT / "frontend" / "dashboard.css")
|
||||
page.add_script_tag(path=ROOT / "frontend" / "pull-sheet.js")
|
||||
page.evaluate(
|
||||
"""detail => {
|
||||
document.querySelector('#pull-sheet').classList.add('open');
|
||||
document.querySelector('#pull-review').open = true;
|
||||
createPullSheet.review(detail, null, document);
|
||||
}""",
|
||||
detail,
|
||||
)
|
||||
|
||||
metrics = page.evaluate(
|
||||
"""() => ({
|
||||
scrollWidth: document.documentElement.scrollWidth,
|
||||
clientWidth: document.documentElement.clientWidth,
|
||||
updatedReviewHeight: document.querySelector('#request-updated-pull-review')
|
||||
.getBoundingClientRect().height,
|
||||
updatedReviewVisible: !document.querySelector('#request-updated-pull-review').hidden,
|
||||
statuses: Array.from(document.querySelectorAll('.pull-reviewer-status span'))
|
||||
.map(node => node.textContent),
|
||||
})"""
|
||||
)
|
||||
browser.close()
|
||||
|
||||
assert metrics["scrollWidth"] <= metrics["clientWidth"]
|
||||
assert metrics["updatedReviewHeight"] >= 44
|
||||
assert metrics["updatedReviewVisible"] is True
|
||||
assert metrics["statuses"] == [
|
||||
"Waiting for review",
|
||||
"Changes requested",
|
||||
"Outdated after new commits",
|
||||
"Approved current head",
|
||||
]
|
||||
@@ -73,7 +73,8 @@ def test_release_promotion_waits_for_packaged_mobile_journeys():
|
||||
"tests/e2e/test_mobile_today_week_reschedule_release.py "
|
||||
"tests/e2e/test_mobile_wrap_up_handoff_release.py "
|
||||
"tests/e2e/test_mobile_following_release.py "
|
||||
"tests/e2e/test_mobile_detail_watch_release.py -q"
|
||||
"tests/e2e/test_mobile_detail_watch_release.py "
|
||||
"tests/e2e/test_mobile_pull_reviewer_status_release.py -q"
|
||||
) in browser
|
||||
assert "needs: [lint, build-release, browser-journey]" in release
|
||||
|
||||
|
||||
Reference in new issue
Block a user