diff --git a/tests/browser_test.mjs b/tests/browser_test.mjs index 79aea87..11fd122 100644 --- a/tests/browser_test.mjs +++ b/tests/browser_test.mjs @@ -159,6 +159,17 @@ try{ const oid=await kanban.eval(`board.orders.find(o=>o.quote_id===${JSON.stringify(qid)}).id`); assert.deepEqual(await kanban.eval(`(()=>{const spec=board.orders.find(o=>o.id===${JSON.stringify(oid)}).snapshot.items[0].production;const source=spec.sources[0];return {kind:source.kind,copies:source.copies,length:Number(source.length_cm),height:Number(spec.height_cm),placed:spec.placements.length}})()`), {kind:'sheet',copies:1,length:101,height:101,placed:1}); + // The print queue's folder, switched on in Integrações. The native picker + // cannot be driven headless: it answers with a folder in the browser's own + // storage, which has the same file API. + await kanban.click('[data-tab="integrations"]'); + await waitFor(()=>kanban.eval('!!document.getElementById("folder-card")'),'folder card'); + await kanban.eval(`(async()=>{const root=await navigator.storage.getDirectory(); + window.picked=await root.getDirectoryHandle('fila-'+Date.now(),{create:true}); + window.showDirectoryPicker=async()=>window.picked;FOLDER.mode='folder';renderIntegrations(); + [...document.querySelectorAll('#folder-card button')].find(b=>b.textContent==='Escolher pasta').click();})()`); + await waitFor(()=>kanban.eval('folderActive()&&!FOLDER.busy'),'folder chosen'); + const savedFiles=()=>kanban.eval(`(async()=>{const out=[];for await(const [name] of window.picked.entries())out.push(name);return out;})()`); // Open the order's panel from its card, then click the real transition // buttons there, including the rerender after each move. await kanban.click('[data-tab="board"]'); @@ -183,6 +194,12 @@ try{ await waitFor(()=>kanban.eval(`!!document.querySelector('[data-order="${oid}"] [data-move="${state}"]')`),'move to '+title); await kanban.click(`[data-order="${oid}"] [data-move="${state}"]`); await waitFor(()=>kanban.eval(`board.orders.find(o=>o.id==='${oid}').state==='${state}'`),'transition '+state); + if(state==='fil'){ + // Entering the queue saves its final file there, whole and named after the order. + const prefix='pedido-'+await kanban.eval(`board.orders.find(o=>o.id==='${oid}').number`)+'-item-1'; + await waitFor(async()=>(await savedFiles()).some(n=>n.startsWith(prefix)&&!n.endsWith('.baixando')),'final file saved in the folder',45000); + assert.equal((await savedFiles()).some(n=>n.endsWith('.baixando')),false); + } } // Undo a mistaken move from the panel: one stage back with an internal reason. await waitFor(()=>kanban.eval(`!!document.querySelector('[data-order="${oid}"] [data-back="imp"]')`),'back button'); diff --git a/web/kanban.css b/web/kanban.css index 1219005..69a8cff 100644 --- a/web/kanban.css +++ b/web/kanban.css @@ -249,7 +249,7 @@ main{padding:0 24px 24px} .charttable summary{cursor:pointer} .charttable table{margin-top:8px} #stats-stages .swatch{display:inline-block;width:10px;height:10px;border-radius:3px;background:var(--c);margin-right:8px} -.grid4{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px} +.grid4{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:12px} .integration{display:flex;flex-direction:column;gap:10px;padding:16px;border-radius:12px;border:1px solid var(--line2);background:var(--card)} .integration .head{display:flex;align-items:center;gap:8px} .integration .head b{font-size:15px} @@ -257,6 +257,7 @@ main{padding:0 24px 24px} .integration .head em{margin-left:auto;font-style:normal;font-size:13.5px;font-weight:700;color:var(--dotx,var(--muted))} .integration p{margin:0;font-size:14px;color:var(--muted)} .integration .buttons{margin-top:auto} +.integration code.flag{font-size:13px;padding:6px 8px;border-radius:8px;background:var(--card2);color:var(--tx2);user-select:all;overflow-wrap:anywhere} table.log{width:100%;border-collapse:collapse;font-size:14px} table.log th{text-align:left;color:var(--faint);font-weight:600;padding:8px 12px;border-bottom:1px solid var(--line)} table.log td{padding:10px 12px;border-bottom:1px solid #1E2226;vertical-align:top} @@ -444,12 +445,6 @@ a.zap{display:inline-flex;align-items:center;gap:4px;vertical-align:bottom} .danger-text{color:var(--bad)} .machine-select{height:36px;padding:0 10px;border-radius:8px;border:1px solid var(--line3);background:var(--bg);color:var(--tx);font:inherit;font-size:14px} .card .machine{color:var(--accent-tx)} -/* Fila de impressão's tools: Baixar, and the automatic folder (grey off, green saving, orange to release). */ +/* Fila de impressão's tools: Baixar. */ .coltools{display:flex;gap:6px;flex-shrink:0} -.autofolder{color:var(--faint);padding:0 8px} -.autofolder.on{color:var(--ok);border-color:rgba(111,209,156,.4)} -.autofolder.warn{color:var(--warn);border-color:rgba(242,179,61,.5)} -.autofolder.busy svg{animation:pulse 1s ease-in-out infinite alternate} -@keyframes pulse{to{opacity:.35}} -.steps-list{margin:0;padding-left:20px;display:flex;flex-direction:column;gap:6px;font-size:14px;color:var(--tx2)} diff --git a/web/kanban.html b/web/kanban.html index 00e03cd..421a35c 100644 --- a/web/kanban.html +++ b/web/kanban.html @@ -21,7 +21,7 @@ - +