feat: open focused blockers from Today HUD (Closes #1070)
This commit is contained in:
1 parent
027ded1f8f
commit
f710b2ce1d
5 files changed
+135
-13
No files matched your search
@@ -87,6 +87,26 @@ def test_release_artifact_plans_hands_off_and_opens_next_mobile_issue(tmp_path:
|
||||
if page.locator("#plan-today-sheet").is_visible():
|
||||
page.locator("#cancel-plan-today").click()
|
||||
expect(page.locator("[data-mobile-today-hud]")).to_be_visible()
|
||||
blocked = page.locator("[data-mobile-today-blocked]")
|
||||
expect(blocked).to_be_visible()
|
||||
blocked_bounds = blocked.bounding_box()
|
||||
assert blocked_bounds and blocked_bounds["height"] >= 44
|
||||
blocked.click()
|
||||
expect(page.locator("#today-progress-sheet")).to_be_visible()
|
||||
expect(page.locator("#today-progress-title")).to_have_text("Report blocker")
|
||||
expect(page.locator("#today-progress-target")).to_contain_text("Ship mobile capture")
|
||||
expect(page.locator("#today-progress-body")).to_be_focused()
|
||||
expect(page.locator("#today-progress-activity")).to_be_hidden()
|
||||
expect(page.locator(".today-progress-evidence")).to_be_hidden()
|
||||
for control in page.locator(".today-blocker-presets button, #post-today-blocker").all():
|
||||
bounds = control.bounding_box()
|
||||
assert bounds and bounds["height"] >= 44
|
||||
page.locator('[data-today-blocker-preset="later-today"]').click()
|
||||
assert page.locator("#today-blocker-return-at").input_value()
|
||||
assert page.evaluate("document.documentElement.scrollWidth <= window.innerWidth")
|
||||
page.locator("#cancel-today-progress").click()
|
||||
expect(page.locator("#today-progress-sheet")).to_be_hidden()
|
||||
expect(page.locator("[data-mobile-today-hud]")).to_contain_text("Ship mobile capture")
|
||||
fake.activity_comments = {
|
||||
41: [{
|
||||
"id": 701,
|
||||
|
||||
@@ -329,6 +329,65 @@ const view=createView({{
|
||||
}
|
||||
|
||||
|
||||
def test_blocked_hud_opens_a_focused_flow_with_quick_return_choices():
|
||||
script = f"""
|
||||
const {{createView}}=require({json.dumps(str(TODAY_PROGRESS))});
|
||||
class Element {{
|
||||
constructor() {{
|
||||
this.hidden=false;this.value='';this.textContent='';this.open=false;this.focused=false;this.listeners={{}};
|
||||
const names=new Set();
|
||||
this.classList={{add:name=>names.add(name),remove:name=>names.delete(name),contains:name=>names.has(name)}};
|
||||
}}
|
||||
addEventListener(name,callback) {{ this.listeners[name]=callback; }}
|
||||
click() {{ return this.listeners.click?.(); }}
|
||||
showModal() {{ this.open=true; }} close() {{ this.open=false; }} focus() {{ this.focused=true; }}
|
||||
}}
|
||||
const selectors=['#today-progress-sheet','.today-progress-panel','#today-progress-title','#today-progress-body',
|
||||
'#today-progress-status','[data-mobile-today-update]','[data-mobile-today-blocked]',
|
||||
'#today-progress-target','#cancel-today-progress','#save-today-progress','#post-today-progress',
|
||||
'#today-blocker-return-at','#post-today-blocker','[data-today-blocker-preset="later-today"]',
|
||||
'[data-today-blocker-preset="tomorrow"]','[data-today-blocker-custom]'];
|
||||
const elements=Object.fromEntries(selectors.map(selector=>[selector,new Element()]));
|
||||
const target={{identity:'issue:stackchain/dashboard:1070:',kind:'issue',repository:'stackchain/dashboard',number:1070,label:'#1070',title:'Focused blocker'}};
|
||||
const calls=[];
|
||||
const view=createView({{
|
||||
progress:{{load:()=> 'Waiting for access',save:()=>true}},currentTarget:()=>target,qs:selector=>elements[selector],
|
||||
voice:{{open:async()=>calls.push('voice')}},photos:{{open:async()=>calls.push('photos')}},
|
||||
activity:{{open:async()=>calls.push('activity')}},now:()=>new Date('2026-08-18T10:15:00Z'),
|
||||
}});
|
||||
(async()=>{{
|
||||
const availability={{update:elements['[data-mobile-today-update]'].hidden,blocked:elements['[data-mobile-today-blocked]'].hidden}};
|
||||
await elements['[data-mobile-today-blocked]'].click();
|
||||
const opened={{
|
||||
title:elements['#today-progress-title'].textContent,target:elements['#today-progress-target'].textContent,
|
||||
focused:elements['#today-progress-body'].focused,mode:elements['.today-progress-panel'].classList.contains('blocker-mode'),
|
||||
calls:[...calls],sheet:elements['#today-progress-sheet'].open,
|
||||
}};
|
||||
await elements['[data-today-blocker-preset="later-today"]'].click();
|
||||
const laterToday=elements['#today-blocker-return-at'].value;
|
||||
await elements['[data-today-blocker-preset="tomorrow"]'].click();
|
||||
const tomorrow=elements['#today-blocker-return-at'].value;
|
||||
elements['#today-blocker-return-at'].focused=false;
|
||||
await elements['[data-today-blocker-custom]'].click();
|
||||
process.stdout.write(JSON.stringify({{availability,opened,laterToday,tomorrow,customFocused:elements['#today-blocker-return-at'].focused}}));
|
||||
}})().catch(error=>{{console.error(error);process.exit(1);}});
|
||||
"""
|
||||
assert run_node(script) == {
|
||||
"availability": {"update": False, "blocked": False},
|
||||
"opened": {
|
||||
"title": "Report blocker",
|
||||
"target": "#1070 · Focused blocker",
|
||||
"focused": True,
|
||||
"mode": True,
|
||||
"calls": [],
|
||||
"sheet": True,
|
||||
},
|
||||
"laterToday": "2026-08-18T14:15",
|
||||
"tomorrow": "2026-08-19T09:00",
|
||||
"customFocused": True,
|
||||
}
|
||||
|
||||
|
||||
def test_progress_sheet_dismisses_mentions_when_opened_switched_or_closed():
|
||||
script = f"""
|
||||
const {{createView}}=require({json.dumps(str(TODAY_PROGRESS))});
|
||||
|
||||
Reference in new issue
Block a user