feat: add mobile pull-to-refresh for My Work (Closes #1002)
This commit is contained in:
1 parent
a2606f1dc2
commit
386acda1dc
9 files changed
+356
-1
No files matched your search
@@ -29,6 +29,7 @@ def test_release_artifact_bootstraps_mobile_home_and_returns_from_insights(
|
||||
browser_errors: list[str] = []
|
||||
failed_responses: list[str] = []
|
||||
workspace_requests: list[str] = []
|
||||
live_requests: list[str] = []
|
||||
|
||||
try:
|
||||
with release_server(archives[0], tmp_path, fake_url) as origin, sync_playwright() as playwright:
|
||||
@@ -56,6 +57,12 @@ def test_release_artifact_bootstraps_mobile_home_and_returns_from_insights(
|
||||
if "feature-today-timer-" in request.url
|
||||
else None,
|
||||
)
|
||||
page.on(
|
||||
"request",
|
||||
lambda request: live_requests.append(request.url)
|
||||
if "/api/v1/live" in request.url
|
||||
else None,
|
||||
)
|
||||
|
||||
page.goto(origin + "/", wait_until="networkidle")
|
||||
page.locator('input[name="device_label"]').fill("Home bootstrap release phone")
|
||||
@@ -64,6 +71,29 @@ def test_release_artifact_bootstraps_mobile_home_and_returns_from_insights(
|
||||
page.wait_for_url(origin + "/", wait_until="networkidle")
|
||||
|
||||
expect(page.locator("#my-work-status")).to_contain_text("2")
|
||||
initial_live_requests = len(live_requests)
|
||||
page.evaluate(
|
||||
"""
|
||||
() => {
|
||||
window.scrollTo(0, 0);
|
||||
const surface = document.querySelector('#my-work');
|
||||
surface.setPointerCapture = () => {};
|
||||
surface.releasePointerCapture = () => {};
|
||||
const pointer = (type, y) => surface.dispatchEvent(new PointerEvent(type, {
|
||||
bubbles:true, pointerId:41, pointerType:'touch', clientX:100, clientY:y,
|
||||
}));
|
||||
pointer('pointerdown', 10);
|
||||
pointer('pointermove', 90);
|
||||
}
|
||||
"""
|
||||
)
|
||||
expect(page.locator("#mobile-pull-refresh")).to_have_text("Release to refresh")
|
||||
page.evaluate(
|
||||
"document.querySelector('#my-work').dispatchEvent(new PointerEvent('pointerup', "
|
||||
"{bubbles:true, pointerId:41, pointerType:'touch', clientX:100, clientY:90}))"
|
||||
)
|
||||
expect(page.locator("#mobile-pull-refresh")).to_have_text("My Work is up to date")
|
||||
assert len(live_requests) == initial_live_requests + 1
|
||||
dock = page.locator("#mobile-task-dock")
|
||||
expect(dock).to_be_visible()
|
||||
expect(dock.locator("button")).to_have_count(5)
|
||||
|
||||
Reference in new issue
Block a user