diff --git a/tests/browser_test.mjs b/tests/browser_test.mjs index 9b0eb65..a2648aa 100644 --- a/tests/browser_test.mjs +++ b/tests/browser_test.mjs @@ -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`); diff --git a/web/checkout.js b/web/checkout.js index 293348f..30e3025 100644 --- a/web/checkout.js +++ b/web/checkout.js @@ -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'));