fix: Kanban pulls and final approvals stop failing on stale or missing context
Sentry DTF-WEB-4..7 (12/11): - Pulling a card with no machine asks which machine takes it (gestão and admins); an operator always pulls to the machine of their session. - The alert before a pull only offers Feito/Adiar to the machine's own operator or management, as the machine sheet does. - A final-file approval from a dialog opened before the same approval went through reloads and says it was already approved, instead of the 409 "O pedido mudou". Built by Prensa; machine cards shared between the two choosers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -227,12 +227,10 @@ try{
|
||||
await waitFor(()=>kanban.eval(`!!document.querySelector('[data-order="${oid}"] [data-move]')`),'order panel');
|
||||
// The Prumo report is on the card before the designer opens the file.
|
||||
await waitFor(()=>kanban.eval(`!!document.querySelector('[data-order="${oid}"] .prumo')`),'Prumo report');
|
||||
// No machine at payment (Dropstar, 2026-11-05): the pull chooses one. It is
|
||||
// the machine this test made after sign-in.
|
||||
// No machine at payment (Dropstar, 2026-11-05): pulling without a session
|
||||
// machine asks which machine takes the card (DTF-WEB-4). It is the machine
|
||||
// this test made after sign-in.
|
||||
const machineId=testMachine;
|
||||
await kanban.eval(`(()=>{const s=document.querySelector('[data-order="${oid}"] select[aria-label="Máquina do pedido"]');
|
||||
s.value=${JSON.stringify(machineId)};s.dispatchEvent(new Event('change',{bubbles:true}));})()`);
|
||||
await waitFor(()=>kanban.eval(`board.orders.find(o=>o.id==='${oid}').machine?.id===${JSON.stringify(machineId)}`),'machine chosen');
|
||||
// Dropstar's flow (2026-10-23): Arte conferida is the queue, Revisão before Finalizado.
|
||||
for(const [title,state] of [['Arte conferida','tra'],['Imprimindo','imp'],['Revisão','rev'],['Finalizado','fin']]){
|
||||
if(state==='tra'){
|
||||
@@ -275,6 +273,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}"]`);
|
||||
if(state==='imp'){
|
||||
// The order has no machine and the session has none: pick it here.
|
||||
await waitFor(()=>kanban.eval(`!!document.querySelector('.mchoice[data-machine="${machineId}"]')`),'machine chooser');
|
||||
await kanban.click(`.mchoice[data-machine="${machineId}"]`);
|
||||
await waitFor(()=>kanban.eval(`board.orders.find(o=>o.id==='${oid}').machine?.id===${JSON.stringify(machineId)}`),'card machine chosen');
|
||||
}
|
||||
await waitFor(()=>kanban.eval(`board.orders.find(o=>o.id==='${oid}').state==='${state}'`),'transition '+state);
|
||||
if(state==='tra'){
|
||||
// The file opens from the card itself, without first expanding the order.
|
||||
|
||||
Reference in New Issue
Block a user