fix: keep the payment confirmation on screen; only a new checkout drops a paid quote
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 3m3s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m10s

bc1fb60 forgot the paid quote as soon as the confirmation showed, so the next
refresh of the page (the cart emptying) found no quote and replaced "Pagamento
confirmado" with "Nenhum pedido aguardando pagamento". The confirmation keeps
its quote again; the paid one is dropped only when the customer asks to pay a
cart identical to it, which then becomes a new order. The browser test waits
for the confirmation, and checks no "Pedido #" is shown, instead of catching
the momentary "Pedido #N criado" line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-02 17:07:46 -03:00
parent bc1fb60468
commit c3c56a7f21
2 changed files with 6 additions and 5 deletions

View File

@@ -151,7 +151,9 @@ try{
await site.eval('window.dtfCheckout()');
await waitFor(async()=> (await site.text()).includes('Total validado no servidor:'),'approved quote displayed');
await site.eval('[...document.querySelectorAll("button")].find(x=>x.textContent==="Criar pedido de teste").click()');
await waitFor(async()=> (await site.text()).includes('Pedido #'),'test payment');
// The customer is shown a confirmation, never the order's sequential number.
await waitFor(async()=> (await site.text()).includes('Pagamento confirmado'),'test payment');
assert.equal((await site.text()).includes('Pedido #'),false);
await kanban.click('#refresh');
await waitFor(()=>kanban.eval(`board.orders.some(o=>o.quote_id===${JSON.stringify(qid)})`),'paid card');
const oid=await kanban.eval(`board.orders.find(o=>o.quote_id===${JSON.stringify(qid)}).id`);

View File

@@ -326,7 +326,9 @@
await ready;
const quote=await api('/quotes/'+shownId);
if(version!==refreshVersion || draftId!==shownId) return;
// Asked to pay a cart identical to one already paid: that is a new order.
// Asked to pay a cart identical to one already paid (the same test
// repeated): that is a new order, never the paid one shown again. The
// confirmation itself keeps its quote, so it stays on screen.
if (go && quote.status==='paid') { forgetDraft(); return window.dtfCheckout(); }
if (!naPagina()) { message(''); vaiPara(PAGAMENTO); return; }
shownCart=cartSnapshot();
@@ -419,9 +421,6 @@
}
function confirmado(quote) {
clearInterval(waitTimer);
// Paid: the next cart is a new order, even one identical to this (the same
// test repeated), never this quote shown again as already paid.
forgetDraft();
const box=node('div',null,'confirmado');
const titulo=node('h4','Pagamento confirmado');
titulo.insertAdjacentHTML('afterbegin', icone('okCirculo'));