feat: follow pull requests from mobile Search (Closes #1307)
This commit is contained in:
1 parent
41c28cc70a
commit
7131792ded
23 files changed
+271
-83
No files matched your search
@@ -13,25 +13,39 @@ ROOT = Path(__file__).parents[2]
|
||||
FRONTEND = ROOT / "frontend"
|
||||
|
||||
|
||||
def test_following_queue_is_phone_usable_at_narrow_viewport():
|
||||
@pytest.mark.parametrize("viewport", [
|
||||
{"width": 320, "height": 568},
|
||||
{"width": 390, "height": 844},
|
||||
])
|
||||
def test_following_queue_is_phone_usable_at_narrow_viewport(viewport):
|
||||
with sync_playwright() as playwright:
|
||||
browser = playwright.chromium.launch(headless=True)
|
||||
page = browser.new_page(viewport={"width": 320, "height": 568})
|
||||
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")
|
||||
page.add_script_tag(path=FRONTEND / "following.js")
|
||||
|
||||
row = page.locator('[data-mobile-queue="following"]')
|
||||
expect(row).to_have_count(1)
|
||||
page.locator("#following-list").evaluate("""node => {
|
||||
node.innerHTML = '<button class="following-card has-unseen-change" type="button"><span><em>New activity</em><strong>Changed issue with a long mobile title</strong><small>stackchain/api #42 · open · just now</small></span><span aria-hidden="true">›</span></button>';
|
||||
expect(row).to_contain_text("Issues and pull requests you watch")
|
||||
page.evaluate("""() => {
|
||||
globalThis.fetch = async () => ({
|
||||
ok:true,
|
||||
json:async () => ({revision:1,items:[{
|
||||
repository:'stackchain/api', kind:'pull', number:42,
|
||||
title:'Changed pull request with a long mobile title', state:'open',
|
||||
updated_at:'2026-08-23T05:00:00Z', has_unseen_change:true
|
||||
}]})
|
||||
});
|
||||
globalThis.followingReleaseQueue = attachFollowing(() => {});
|
||||
globalThis.followingReleaseQueue.open();
|
||||
}""")
|
||||
page.locator("#review-following").evaluate("node => node.hidden = false")
|
||||
page.locator("#following-sheet").evaluate("node => node.showModal()")
|
||||
|
||||
expect(page.locator("#following-sheet")).to_be_visible()
|
||||
expect(page.locator(".following-card")).to_be_visible()
|
||||
expect(page.locator(".following-card")).to_contain_text("New activity")
|
||||
expect(page.locator(".following-card")).to_contain_text("Pull request")
|
||||
expect(page.locator("#review-following")).to_have_text("Review new activity")
|
||||
assert page.locator("#review-following").bounding_box()["height"] >= 44
|
||||
assert page.locator(".following-card").bounding_box()["height"] >= 44
|
||||
@@ -52,6 +66,11 @@ def test_following_queue_is_phone_usable_at_narrow_viewport():
|
||||
expect(retire).to_be_visible()
|
||||
expect(retire).to_have_text("Stop watching & next")
|
||||
assert retire.bounding_box()["height"] >= 44
|
||||
page.evaluate("""() => renderSearchPreviewWatch(
|
||||
{repository:'stackchain/api', number:42, kind:'pull', state:'open', watching:false},
|
||||
{status:'ready'}, document.querySelector('#watch-search-result'))""")
|
||||
expect(retire).to_have_text("Watch pull request")
|
||||
assert retire.bounding_box()["height"] >= 44
|
||||
overflow = page.evaluate("document.documentElement.scrollWidth > document.documentElement.clientWidth")
|
||||
assert overflow is False
|
||||
browser.close()
|
||||
Reference in new issue
Block a user