mirror of
https://github.com/hasso5703/alzeo.git
synced 2026-12-06 12:54:19 +01:00
cockpit: what the review of the put-away load window found
A code review of681e25afound ten defects, all real, each with a test that fails on681e25a: - Under 1100 px the head hid the job button, the only way back to a load put away: it shows there now (.away), and under 720 px it takes at most a quarter of the screen, since the head's right side never shrinks (at 260 px it ran to 404 px on 375 and 393 px phones; touch-check taps it on three phones now). - Image, video and Decide started while a load ran, and its next step could stop their lane: they refuse now, and busyWhy() names the load, so every control waits with its reason. - A failure brought the window back with the focus on Retry: it goes to Cancel; brought back by the job button while the steps run, it goes to Hide (Go is disabled then). - Under the menu or the image viewer a failure no longer brings the window back underneath them: a toast says what failed and the job button ("Load ...: a step failed") opens it. - The job button opens the load's window only when the job it shows is the load's own, or between steps; another job (the autoheal belt, another browser) opens the dock as before. - Closing or reloading the page while a load is put away asks first (not in a dry run). - waitFor() counts a predicate that throws as not yet: a throw inside its timer left the promise pending and the load running for good; and an error in the chain stops it like a failed step. - A new action or load closes a failed load left put away instead of replacing it silently. - One helper per question (loadRunning, loadAway, reopenJourney, journeyChanged) instead of copies. 17 page checks (16 fail on v1.28.1) and 11 mutants of these fixes; 1019 page and server tests and the four browser checks pass (touch 253/253). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ace5ff28e9
commit
5de8e7e262
7 files changed
+191
-25
No files matched your search
@@ -746,6 +746,7 @@ body.agentmax .view{animation:none}
|
||||
.studio{grid-template-columns:minmax(0,1fr)}
|
||||
.g-7-5, .g-5-7, .g3{grid-template-columns:minmax(0,1fr)}
|
||||
.jobpip{display:none}
|
||||
.jobpip.away{display:flex} /* the way back to a load put away: shown however narrow the head */
|
||||
}
|
||||
@media (max-width:980px){
|
||||
:root{--spine:60px}
|
||||
@@ -775,6 +776,9 @@ body.agentmax .view{animation:none}
|
||||
.serving{padding:5px 6px 5px 12px}
|
||||
.serving .go{display:none}
|
||||
.serving .mark{display:none}
|
||||
/* .spine-right never shrinks: at 260 px the way back to a load widened a phone's page to 490 px
|
||||
(measured 2026-10-13, 320 to 430 px screens); a quarter of the screen fits them all */
|
||||
.jobpip.away{max-width:25vw}
|
||||
.vhead h1{font-size:var(--t-24)}
|
||||
.pool{padding:var(--s-5) var(--s-4) var(--s-4)}
|
||||
.pool-big .v{font-size:var(--t-48)}
|
||||
|
||||
+59
-25
@@ -390,6 +390,7 @@ function noEngineWhy(){
|
||||
}
|
||||
function busyWhy(){
|
||||
if (offline) return 'The cockpit is unreachable: actions wait until the connection is back.';
|
||||
if (loadRunning()) return `A load is running (${TARGET_NAME[SHEET.target]}). Wait for it to finish, or bring its window back with the job button.`;
|
||||
if (F.job && F.job.current) return `Another action is running (${actionPhrase(F.job.current.action, F.job.current.params)}). Wait for it to finish.`;
|
||||
return '';
|
||||
}
|
||||
@@ -425,9 +426,9 @@ let SHEET = null; // {mode: 'one'|'journey', ...}
|
||||
// keyboard had to start again from the top of the page.
|
||||
const OPENER = {sheet: null, menu: null, viewer: null};
|
||||
const giveBack = k => { const e = OPENER[k]; OPENER[k] = null; if (e && e.isConnected && typeof e.focus === 'function') e.focus(); };
|
||||
function openSheet(){
|
||||
function openSheet(focusId = 'sh-go'){
|
||||
const a = document.activeElement; OPENER.sheet = a && !a.closest('#scrim') ? a : OPENER.sheet;
|
||||
$('scrim').hidden = false; setTimeout(() => $('sh-go').focus(), 0);
|
||||
$('scrim').hidden = false; setTimeout(() => $(focusId).focus(), 0);
|
||||
}
|
||||
// A result's screen takes the shape of what it shows: its own proportions, as wide as the
|
||||
// column allows and no taller than most of the window (78vh, through a max-width derived
|
||||
@@ -458,32 +459,41 @@ function closeViewer(){ $('viewer').hidden = true; giveBack('viewer'); }
|
||||
// A load whose steps are running is put away, not closed: its steps go on, the dock follows the step that
|
||||
// runs, and the job button brings the window back. The window held the whole page through a 20-minute
|
||||
// download, and reloading the page to get it back stopped the chain (Hasan, 2026-10-12).
|
||||
// Nothing else starts while a load runs, its window shown or put away: the next step could stop the lane
|
||||
// a generation runs on (one engine at a time), and two chains would race on the same lanes.
|
||||
const loadRunning = () => !!(SHEET && SHEET.running && SHEET.mode === 'journey');
|
||||
const loadAway = () => !!(SHEET && SHEET.mode === 'journey' && SHEET.hidden);
|
||||
const LOAD_RUNNING = 'A load is still running: the job button brings its window back.';
|
||||
function closeSheet(){
|
||||
if (SHEET && SHEET.running){
|
||||
if (SHEET.mode !== 'journey') return; // one action closes its window once the job is accepted
|
||||
SHEET.hidden = true; $('scrim').hidden = true; giveBack('sheet'); renderPip(); return;
|
||||
}
|
||||
$('scrim').hidden = true; const s = SHEET; SHEET = null; if (s && s.onClose) s.onClose(); giveBack('sheet'); renderPip();
|
||||
if (loadRunning()){ SHEET.hidden = true; } // put away: its steps go on
|
||||
else if (SHEET && SHEET.running) return; // one action closes its window once the job is accepted
|
||||
else { const s = SHEET; SHEET = null; if (s && s.onClose) s.onClose(); }
|
||||
$('scrim').hidden = true; giveBack('sheet'); journeyChanged();
|
||||
}
|
||||
// While the steps run the Go button is disabled: the focus goes to Hide. A window brought back by a failure
|
||||
// puts it on Cancel, never on Retry, so a key the person was pressing elsewhere cannot run the step again.
|
||||
function reopenJourney(){
|
||||
if (!(SHEET && SHEET.mode === 'journey' && SHEET.hidden)) return false;
|
||||
SHEET.hidden = false; openSheet(); renderPip(); return true;
|
||||
if (!loadAway()) return false;
|
||||
SHEET.hidden = false; openSheet('sh-cancel'); journeyChanged(); return true;
|
||||
}
|
||||
// The job button: the job that runs, or a load put away while it waits between two steps (a stopped lane
|
||||
// reading down can take 90 s), so the window always has a way back while its steps go on.
|
||||
// reading down can take 90 s) or after a step failed, so the window always has a way back. It shows on a
|
||||
// narrow screen too (.away), where the head has no room for the plain job button.
|
||||
function renderPip(){
|
||||
const pip = $('jobpip'); if (!pip) return;
|
||||
const cur = (F.job || {}).current, away = SHEET && SHEET.mode === 'journey' && SHEET.running && SHEET.hidden;
|
||||
pip.hidden = !(cur || away);
|
||||
if (cur) setText('jobpip-what', describeJob(cur));
|
||||
else if (away) setText('jobpip-what', `Load ${TARGET_NAME[SHEET.target]}: between steps`);
|
||||
const cur = (F.job || {}).current, away = loadAway();
|
||||
pip.hidden = !(cur || away); pip.classList.toggle('away', away);
|
||||
const what = cur ? describeJob(cur) : away ? `Load ${TARGET_NAME[SHEET.target]}: ${SHEET.running ? 'between steps' : 'a step failed'}` : '';
|
||||
setText('jobpip-what', what || '…'); pip.title = what; // cut short on a phone: the whole of it on hover
|
||||
}
|
||||
// Nothing else starts while a load runs, its window shown or put away.
|
||||
const loadRunning = () => !!(SHEET && SHEET.running && SHEET.mode === 'journey');
|
||||
const LOAD_RUNNING = 'A load is still running: the job button brings its window back.';
|
||||
function journeyChanged(){ renderPip(); applyBusy(); }
|
||||
// A page closed or reloaded stops the chain after the step that runs; with the window put away nothing on
|
||||
// screen says so, so the browser asks first. Not in a dry run, whose loads are a walk-through.
|
||||
const leaveWarning = () => loadRunning() && SHEET.hidden && !F.config.dry_run;
|
||||
function askAction(name, params, warns, opts = {}){
|
||||
if (offline) return toast('The cockpit is unreachable right now: nothing can be started.', 'err');
|
||||
if (loadRunning()) return toast(LOAD_RUNNING, 'warn');
|
||||
if (loadAway()) closeSheet(); // a failed load put away: this window replaces it
|
||||
if (NEEDS_ENGINE.has(name) && !textReady()) return toast(noEngineWhy(), 'warn');
|
||||
if (F.job && F.job.current) return toast(busyWhy(), 'warn');
|
||||
if (!$('scrim').hidden) return;
|
||||
@@ -562,6 +572,7 @@ function laneJourneySteps(target){
|
||||
function askJourney(target, opts = {}){
|
||||
if (offline) return toast('The cockpit is unreachable right now: nothing can be started.', 'err');
|
||||
if (loadRunning()) return toast(LOAD_RUNNING, 'warn');
|
||||
if (loadAway()) closeSheet(); // a failed load put away: this window replaces it
|
||||
if (F.job && F.job.current) return toast(busyWhy(), 'warn');
|
||||
if (!$('scrim').hidden) return;
|
||||
const unit = TARGET_UNIT(target);
|
||||
@@ -607,14 +618,21 @@ function jLive(i, text){
|
||||
const jobLast = cur => String((cur.lines || []).slice(-1)[0] || '').replace(/\x1b\[[0-9;]*[A-Za-z]/g, '').trim();
|
||||
async function runJourney(){
|
||||
const S = SHEET; S.running = true;
|
||||
$('sh-go').disabled = true; setText($('sh-cancel'), 'Hide');
|
||||
// a step that fails says why in the window, brought back if it was put away
|
||||
$('sh-go').disabled = true; setText($('sh-cancel'), 'Hide'); journeyChanged();
|
||||
// a step that fails says why in its window: brought back if it was put away, unless the menu or the
|
||||
// image viewer is open over the page (the window would come back under them): then a toast says it,
|
||||
// and the job button keeps the window
|
||||
const stopped = () => {
|
||||
$('sh-go').disabled = false; setText($('sh-cancel'), 'Cancel'); setText($('sh-go'), 'Retry from here');
|
||||
if (S.hidden && SHEET === S){ S.hidden = false; openSheet(); }
|
||||
renderPip();
|
||||
if (S.hidden && SHEET === S){
|
||||
if ($('menu').hidden && $('viewer').hidden) reopenJourney();
|
||||
else toast(`Load ${TARGET_NAME[S.target]}: ${$('sh-status').textContent} The job button opens its window.`, 'err', 9000);
|
||||
}
|
||||
journeyChanged();
|
||||
};
|
||||
try {
|
||||
for (let i = S.idx; i < S.steps.length; i++){
|
||||
S.at = i;
|
||||
const st = S.steps[i]; jStep(i, 'run');
|
||||
setText('sh-status', `Step ${i + 1} of ${S.steps.length}: ${st.title}…`);
|
||||
let r;
|
||||
@@ -626,8 +644,9 @@ async function runJourney(){
|
||||
setText('sh-status', `Step ${i + 1} refused: ` + why + (F.config.dry_run && r.out.reasons ? ' (dry run: the steps above changed nothing on the box, so the gate still reads the state as it was)' : ''));
|
||||
stopped(); return;
|
||||
}
|
||||
const id = r.out.job || r.out.id;
|
||||
const id = r.out.job || r.out.id; S.jobId = id;
|
||||
const res = await waitJob(id, cur => { const last = jobLast(cur); jLive(i, fmtDur(cur.elapsed) + ' so far' + (last ? ': ' + last : '')); });
|
||||
S.jobId = null;
|
||||
if (!res.ok){
|
||||
jStep(i, 'fail'); S.running = false; S.idx = i;
|
||||
$('sh-status').className = 'status err';
|
||||
@@ -645,10 +664,17 @@ async function runJourney(){
|
||||
if (!F.config.dry_run) await waitFor(() => { const e = engines()[st.params.unit]; return !e || UNIT_DOWN.has(e.state); }, 90000);
|
||||
}
|
||||
}
|
||||
} catch (e) { // an error in the page itself: the chain stops where it was, said like a failed step
|
||||
const i = S.at || 0;
|
||||
jStep(i, 'fail'); S.running = false; S.idx = i; S.jobId = null;
|
||||
$('sh-status').className = 'status err';
|
||||
setText('sh-status', `Step ${i + 1} stopped on an error in the page (${e && e.message ? e.message : e}). The Now view and Logs say where the lane is before anything is retried.`);
|
||||
stopped(); return;
|
||||
}
|
||||
S.running = false; setText($('sh-cancel'), 'Cancel');
|
||||
setText('sh-status', 'Done. The lane is booting: the Now view and the dock follow it.');
|
||||
if (S.hidden){ // put away: the page stays where the person went, a toast says it ended
|
||||
if (SHEET === S) closeSheet();
|
||||
if (SHEET === S) closeSheet(); else journeyChanged();
|
||||
toast(`Load ${TARGET_NAME[S.target]}: every step done. The lane is booting; the Now view and the dock follow it.`, 'ok', 7000);
|
||||
return;
|
||||
}
|
||||
@@ -683,7 +709,10 @@ function waitJob(id, onTick){
|
||||
}
|
||||
function waitFor(pred, timeoutMs){
|
||||
const t0 = Date.now();
|
||||
return new Promise(resolve => { const tick = () => { if (pred() || Date.now() - t0 > timeoutMs) return resolve(); setTimeout(tick, 500); }; tick(); });
|
||||
// a predicate that throws (state not read yet after a reconnect) counts as not yet: a throw inside the
|
||||
// timer would leave the promise pending for good, and a load waiting on it running forever
|
||||
const holds = () => { try { return !!pred(); } catch { return false; } };
|
||||
return new Promise(resolve => { const tick = () => { if (holds() || Date.now() - t0 > timeoutMs) return resolve(); setTimeout(tick, 500); }; tick(); });
|
||||
}
|
||||
|
||||
// ── the dock: the job running now, from every view and every browser ─────────
|
||||
@@ -896,7 +925,12 @@ function wireShell(){
|
||||
try { setRailMin(localStorage.getItem('cockpit.rail') === 'min'); } catch { setRailMin(false); }
|
||||
$('railbtn').addEventListener('click', () => setRailMin(!document.body.classList.contains('railmin')));
|
||||
$('serving').addEventListener('click', () => showView('lanes'));
|
||||
$('jobpip').addEventListener('click', () => { if (reopenJourney()) return; dockHidden = null; dockPinned = true; $('dock').hidden = false; });
|
||||
$('jobpip').addEventListener('click', () => {
|
||||
const cur = (F.job || {}).current;
|
||||
if (loadAway() && (!cur || cur.id === SHEET.jobId) && reopenJourney()) return;
|
||||
dockHidden = null; dockPinned = true; $('dock').hidden = false;
|
||||
});
|
||||
window.addEventListener('beforeunload', e => { if (leaveWarning()){ e.preventDefault(); e.returnValue = ''; } });
|
||||
// the sheet
|
||||
$('sh-cancel').addEventListener('click', () => closeSheet());
|
||||
$('sh-go').addEventListener('click', sheetGo);
|
||||
|
||||
@@ -135,6 +135,7 @@ function s1Answer(id, ans){
|
||||
return wrap;
|
||||
}
|
||||
async function s1Run(){
|
||||
if (loadRunning()) return toast(LOAD_RUNNING, 'warn'); // its next step could stop the text lane
|
||||
const problem = s1Problem(); if (problem) return toast(problem, 'warn');
|
||||
s1Running = true; s1Sync(); setText($('s1-run'), 'Asking…');
|
||||
const box = $('s1-answers'); clear(box); clear($('s1-meta')); setText('s1-time', '');
|
||||
|
||||
@@ -281,6 +281,7 @@ function imgRenderLane(){
|
||||
}
|
||||
async function imgRun(){
|
||||
IS.touched = true;
|
||||
if (loadRunning()) return toast(LOAD_RUNNING, 'warn'); // its next step could stop this lane
|
||||
const problem = imgProblem(); if (problem) return toast(problem, 'warn');
|
||||
if (!imgVal('img-prompt')) return toast('Write a prompt first.', 'warn');
|
||||
const editing = imgEditing(), t0 = Date.now();
|
||||
@@ -317,6 +318,7 @@ function imgCancel(){
|
||||
// The sample is a generation like any other: the same frame, the same bar, the same lock.
|
||||
// Its subject is the cookbook's own edit example, so "Local edit" describes what is in it.
|
||||
async function imgSample(){
|
||||
if (loadRunning()) return toast(LOAD_RUNNING, 'warn');
|
||||
if (IS.refs.length >= 10) return toast('Ten references is the maximum.', 'warn');
|
||||
if (IS.inflight || IS.busy) return toast('The lane is already making an image; one at a time.', 'warn');
|
||||
const t0 = Date.now(); IS.inflight = t0; IS.run = {w: 1024, h: 1024, steps: imgTurbo() ? IMG_TURBO_STEPS : 20, n: 1, editing: false};
|
||||
|
||||
@@ -337,6 +337,7 @@ function vidErr(out, status){
|
||||
}
|
||||
async function vidRun(){
|
||||
VS.touched = true; vidSync();
|
||||
if (loadRunning()) return toast(LOAD_RUNNING, 'warn'); // its next step could stop this lane
|
||||
if (VS.inflight || VS.busy) return toast('The lane is already making a video; one at a time.', 'warn');
|
||||
const p = vidProblem(); if (p) return toast(p, 'warn');
|
||||
if (!VS.available) return toast(vidLaneWhy(), 'warn');
|
||||
|
||||
@@ -1293,6 +1293,112 @@ class TheLoadWindowCanBeHiddenWhileItsStepsRun(unittest.TestCase):
|
||||
self.assertFalse(r["pip"], "nothing runs and no load waits: no job button")
|
||||
self.assertIsNone(r["sheet"])
|
||||
|
||||
# The review of 2026-10-13 (681e25a), one test per finding.
|
||||
HIDE = r"""
|
||||
running('j1', 30, 'downloading'); await __advance(1000);
|
||||
$('sh-cancel').click(); await __settle();
|
||||
"""
|
||||
|
||||
def test_on_a_narrow_screen_the_way_back_still_shows(self):
|
||||
r = run(self, self.BODY + self.HIDE + r"""
|
||||
report({away: $('jobpip').classList.contains('away'), hidden: $('jobpip').hidden});
|
||||
""")
|
||||
self.assertEqual(r, {"away": True, "hidden": False})
|
||||
narrow = [(sel, decl) for sel, media, decl in css_rules() if any("max-width:1100px" in m.replace(" ", "") for m in media)]
|
||||
self.assertIn(".jobpip.away", [sel for sel, _ in narrow], "the head hides .jobpip under 1100 px: .away must undo it")
|
||||
self.assertIn("display:flex", dict(narrow)[".jobpip.away"].replace(" ", ""))
|
||||
phone = [(sel, decl) for sel, media, decl in css_rules() if any("max-width:720px" in m.replace(" ", "") for m in media)]
|
||||
self.assertIn("max-width:25vw", dict(phone).get(".jobpip.away", "").replace(" ", ""), "on a phone it must not widen the page")
|
||||
|
||||
def test_no_generation_starts_while_a_load_runs(self):
|
||||
r = run(self, self.BODY + self.HIDE + r"""
|
||||
const toasts = [];
|
||||
for (const f of [imgRun, imgSample, vidRun, s1Run]){ clear($('toasts')); await f(); await __settle(); toasts.push(toastText()); }
|
||||
report({toasts, posts: __fetches.map(x => x.url).filter(u => /generate|systemone/.test(u))});
|
||||
""")
|
||||
self.assertEqual(r["posts"], [], "nothing was sent to a lane")
|
||||
for t in r["toasts"]:
|
||||
self.assertIn("is still running", t)
|
||||
|
||||
def test_every_control_says_it_waits_for_the_load(self):
|
||||
r = run(self, self.BODY + self.HIDE + r"""
|
||||
const b = $('oc-fitbtn');
|
||||
report({disabled: b.disabled, title: b.title});
|
||||
""")
|
||||
self.assertTrue(r["disabled"])
|
||||
self.assertIn("A load is running (27B uncensored, NVFP4)", r["title"])
|
||||
|
||||
def test_a_failure_brings_the_window_back_with_the_focus_on_cancel(self):
|
||||
r = run(self, self.BODY + self.HIDE + r"""
|
||||
job(null, [{id: 'j1', action: 'switch', status: 'failed', rc: 1, elapsed: 31}]);
|
||||
await __advance(2000); await __settle(); await __advance(10);
|
||||
report({back: !$('scrim').hidden, focus: document.activeElement && document.activeElement.id});
|
||||
""")
|
||||
self.assertTrue(r["back"])
|
||||
self.assertEqual(r["focus"], "sh-cancel", "never Retry: a key pressed elsewhere must not run the step again")
|
||||
|
||||
def test_brought_back_while_it_runs_the_focus_is_on_hide(self):
|
||||
r = run(self, self.BODY + self.HIDE + r"""
|
||||
$('jobpip').click(); await __settle(); await __advance(10);
|
||||
report({focus: document.activeElement && document.activeElement.id, label: txt('sh-cancel')});
|
||||
""")
|
||||
self.assertEqual(r, {"focus": "sh-cancel", "label": "Hide"})
|
||||
|
||||
def test_a_failure_under_the_menu_stays_away_and_says_so(self):
|
||||
r = run(self, self.BODY + self.HIDE + r"""
|
||||
$('menu').hidden = false;
|
||||
job(null, [{id: 'j1', action: 'switch', status: 'failed', rc: 1, elapsed: 31}]);
|
||||
await __advance(2000); await __settle();
|
||||
const under = {scrim: $('scrim').hidden, toast: toastText(), pip: txt('jobpip-what')};
|
||||
$('menu').hidden = true; $('jobpip').click(); await __settle();
|
||||
report({under, back: !$('scrim').hidden, go: txt('sh-go')});
|
||||
""")
|
||||
self.assertTrue(r["under"]["scrim"], "the window does not come back under the menu")
|
||||
self.assertIn("Step 1 failed with exit code 1", r["under"]["toast"])
|
||||
self.assertEqual(r["under"]["pip"], "Load 27B uncensored, NVFP4: a step failed")
|
||||
self.assertTrue(r["back"])
|
||||
self.assertEqual(r["go"], "Retry from here")
|
||||
|
||||
def test_another_job_on_the_button_opens_the_dock_not_the_load(self):
|
||||
r = run(self, self.BODY + self.HIDE + r"""
|
||||
job({id: 'auto1', action: 'unit', params: {verb: 'restart', unit: 'qwen38-keepalive.service'}, elapsed: 2, lines: []});
|
||||
await __advance(100);
|
||||
$('jobpip').click(); await __settle();
|
||||
report({scrim: $('scrim').hidden, dock: !$('dock').hidden});
|
||||
""")
|
||||
self.assertEqual(r, {"scrim": True, "dock": True})
|
||||
|
||||
def test_leaving_the_page_asks_first_while_a_load_runs_away(self):
|
||||
r = run(self, self.BODY + r"""
|
||||
const leave = () => { const ev = {returnValue: undefined, prevented: false, preventDefault(){ this.prevented = true; }};
|
||||
(window._listeners.beforeunload || []).forEach(f => f(ev)); return ev.prevented; };
|
||||
const shown = leave();
|
||||
""" + self.HIDE + r"""
|
||||
const away = leave();
|
||||
F.config.dry_run = true; const dry = leave(); F.config.dry_run = false;
|
||||
report({shown, away, dry});
|
||||
""")
|
||||
self.assertEqual(r, {"shown": False, "away": True, "dry": False})
|
||||
|
||||
def test_a_wait_whose_check_throws_still_ends(self):
|
||||
r = run(self, r"""
|
||||
let n = 0, done = false;
|
||||
waitFor(() => { n++; if (n < 3) throw new Error('state not read yet'); return true; }, 90000).then(() => { done = true; });
|
||||
await __advance(2000); await __settle();
|
||||
report({done, n});
|
||||
""")
|
||||
self.assertTrue(r["done"], "a predicate that threw twice, then held, ended the wait")
|
||||
|
||||
def test_a_new_action_closes_a_failed_load_put_away(self):
|
||||
r = run(self, self.BODY + self.HIDE + r"""
|
||||
$('menu').hidden = false;
|
||||
job(null, [{id: 'j1', action: 'switch', status: 'failed', rc: 1, elapsed: 31}]);
|
||||
await __advance(2000); await __settle(); $('menu').hidden = true;
|
||||
askAction('diag_bundle', {}); // needs no engine
|
||||
report({mode: SHEET && SHEET.mode, scrim: !$('scrim').hidden, pip: $('jobpip').hidden});
|
||||
""")
|
||||
self.assertEqual(r, {"mode": "one", "scrim": True, "pip": True})
|
||||
|
||||
def test_the_job_button_brings_a_hidden_load_back(self):
|
||||
r = run(self, self.BODY + r"""
|
||||
running('j1', 30, 'downloading'); await __advance(1000);
|
||||
|
||||
@@ -337,6 +337,24 @@ try {
|
||||
ok('phone: every stacked line carries its column name', rc.unlabelled === 0, JSON.stringify(rc));
|
||||
}
|
||||
|
||||
// ── a load put away: its way back fits the head of every phone and answers a finger ──
|
||||
// The head hides the job button under 1100 px and its right side never shrinks: the way back to a
|
||||
// load put away was out of sight there, then, shown, widened a phone's page to 490 px (2026-10-13).
|
||||
for (const d of PHONES.slice(0, 3)) {
|
||||
await device(d, true);
|
||||
await evalJs("(showView('library'), 1)"); await sleep(200);
|
||||
const pa = await evalJs(`(() => { SHEET = {mode: 'journey', target: 'uncensored', steps: [], idx: 0, running: true, hidden: true}; renderPip();
|
||||
const vw = innerWidth, e = document.getElementById('jobpip'), r = e.getBoundingClientRect();
|
||||
return JSON.stringify({ overflow: document.documentElement.scrollWidth - vw, left: Math.round(r.left), right: Math.round(r.right),
|
||||
shown: getComputedStyle(e).display !== 'none' && r.width > 0 }); })()`).then(JSON.parse);
|
||||
ok(`${d.name}: a load put away keeps its way back in the head, on screen`, pa.shown && pa.overflow <= 1 && pa.left >= 0 && pa.right <= d.w + 1, JSON.stringify(pa));
|
||||
const at = await aim('#jobpip');
|
||||
if (at && at.self) await tapXY(at.x, at.y);
|
||||
await sleep(300);
|
||||
ok(`${d.name}: a finger on it brings the load window back`, !!(at && at.self) && await evalJs("!document.getElementById('scrim').hidden"), JSON.stringify(at));
|
||||
await evalJs("(SHEET && (SHEET.running = false), closeSheet(), 1)"); await sleep(100);
|
||||
}
|
||||
|
||||
// ── an iPhone's safe areas: the notch in landscape, the home indicator at the foot ──
|
||||
const inset = await cdp('Emulation.setSafeAreaInsetsOverride', { insets: { top: 0, left: 59, right: 59, bottom: 21 } });
|
||||
ok('this browser can emulate safe-area insets', !inset.error, JSON.stringify(inset.error || ''));
|
||||
|
||||
Reference in new issue
Block a user