test: the browser walkthrough follows the new final, residue and machine rules
The final file is a 300 DPI PNG; a ready sheet offers the residue acceptance; an oversized PNG is refused; and the pull chooses the machine.
This commit is contained in:
@@ -180,14 +180,13 @@ try{
|
||||
await evaluate(`(()=>{const f=new File(['x'],'oversize.cdr');Object.defineProperty(f,'size',{value:4294967296+1});return sel([f]);})()`);
|
||||
assert.equal(await evaluate(`folhas.length===0 && $('recusa').textContent.includes('4 GB')`),true,
|
||||
'files beyond the 4 GB upload limit are rejected before browser analysis');
|
||||
// A large sheet (here 900 MB) is the normal order: graded from the pixel size in its
|
||||
// header, never decoded. 6732 x 35433 px across 57 cm is 3 m at 300 DPI.
|
||||
// A PNG above the browser's ~32k-pixel height limit cannot be checked here:
|
||||
// it is refused with a clear message instead of being accepted as 0 DPI.
|
||||
await evaluate(`(()=>{const h=new Uint8Array(33);h.set([0x89,0x50,0x4E,0x47,0x0D,0x0A,0x1A,0x0A,0,0,0,13,0x49,0x48,0x44,0x52]);
|
||||
const v=new DataView(h.buffer);v.setUint32(16,6732);v.setUint32(20,35433);h.set([8,6,0,0,0],24);
|
||||
const f=new File([h],'folha-grande.png');Object.defineProperty(f,'size',{value:900*1048576});return sel([f]);})()`);
|
||||
await waitFor(()=>evaluate(`folhas.length===1 && !!folhas[0].an`),'large sheet graded from its header');
|
||||
assert.deepEqual(await evaluate(`({grande:folhas[0].an.grande,dpi:folhas[0].an.dpi,alt:folhas[0].med.alt,preview:!!folhas[0].previewSrc})`),
|
||||
{grande:true,dpi:300,alt:300,preview:false});
|
||||
await waitFor(()=>evaluate(`folhas.length===1 && !!folhas[0].measurementError`),'tall sheet refused');
|
||||
assert.equal(await evaluate(`folhas[0].measurementError.includes('PNG alto')`),true);
|
||||
await evaluate(`folhas=[];pintaFolha()`);
|
||||
await evaluate(`pickTipo('avulsa')`);
|
||||
assert.equal(await evaluate('modo'),'avulsa');
|
||||
@@ -305,13 +304,13 @@ try{
|
||||
await waitFor(()=>evaluate(`$('envios').textContent.includes('Não foi possível enviar folha-montada.png') &&
|
||||
!!$('envios').querySelector('[data-envio]')`),'a failed upload says so under the uploader');
|
||||
assert.deepEqual(await evaluate(`({mode:modo,art:artes.length,title:$('montcabTit').textContent,rate:precoMetro()})`),{mode:'file',art:0,title:'Sua folha',rate:19.9});
|
||||
// One price per product (Dropstar, 2026-10-23): the sheet is graded, and the
|
||||
// grade is shown, but the metre costs the same as for any other grade.
|
||||
// One price per product (Dropstar, 2026-10-23): the sheet is still graded
|
||||
// internally, but the customer's screen no longer shows the /100 score.
|
||||
await waitFor(()=>evaluate('itemAtual?.nota>0'),'graded ready sheet');
|
||||
assert.deepEqual(await evaluate(`({unit:itemAtual.unit,total:itemAtual.total,shown:$('cNota').textContent===itemAtual.nota+'/100',
|
||||
assert.deepEqual(await evaluate(`({unit:itemAtual.unit,total:itemAtual.total,hidden:!document.getElementById('cNota'),
|
||||
metre:$('cMetro').textContent,ladder:!!document.getElementById('cEscada'),
|
||||
discount:/desconto/i.test($('carrLin').textContent+$('resLin').textContent+$('compra').textContent)})`),
|
||||
{unit:19.9,total:19.9,shown:true,metre:'R$ 19,90',ladder:false,discount:false});
|
||||
{unit:19.9,total:19.9,hidden:true,metre:'R$ 19,90',ladder:false,discount:false});
|
||||
assert.deepEqual(await evaluate(`({folha:$('tipoFolhaPreco').textContent,avulsa:$('tipoAvulsaPreco').textContent})`),
|
||||
{folha:'R$ 19,90 /m',avulsa:'R$ 21,90 /m'});
|
||||
assert.equal(await evaluate(`document.querySelectorAll('[data-cm]').length`),0);
|
||||
@@ -350,10 +349,13 @@ try{
|
||||
await waitFor(()=>evaluate(`$('aoVivo').textContent.includes('ponto de recorte') && itemAtual===null`),'residue stops the order');
|
||||
assert.equal(await evaluate(`$('lista').textContent.includes('Sobrou 1 ponto de recorte na sua folha')`),true);
|
||||
await waitFor(()=>evaluate(`folhas[0].previewSrc.startsWith('data:image/webp')`),'residue circled on the preview');
|
||||
// A ready sheet takes no acceptance (Dropstar, 2026-11-03): the designer
|
||||
// cannot clean a closed sheet, so the dot always sends it back.
|
||||
// A ready sheet now offers the same acceptance as loose art (Dropstar,
|
||||
// 2026-11-05): the dots may be part of the art; the customer can take them.
|
||||
assert.deepEqual(await evaluate(`({box:!!document.querySelector('[data-residuo]'),
|
||||
text:$('lista').textContent.includes('Estou ciente'),stopped:itemAtual===null})`),{box:false,text:false,stopped:true});
|
||||
text:$('lista').textContent.includes('Li e concordo'),stopped:itemAtual===null})`),{box:true,text:true,stopped:true});
|
||||
await evaluate(`(()=>{const el=document.querySelector('[data-residuo]');el.checked=true;
|
||||
el.dispatchEvent(new Event('change',{bubbles:true}));})()`);
|
||||
await waitFor(()=>evaluate('itemAtual!==null'),'accepted residue lets the sheet through');
|
||||
await evaluate(`folhas=[];pintaFolha()`);
|
||||
await evaluate('sendSheet({fundo:true})');
|
||||
await waitFor(()=>evaluate(`folhas[0]?.an?.fundoChapado===true && itemAtual===null && $('aoVivo').textContent.includes('fundo transparente')`),'solid background stops the order');
|
||||
|
||||
Reference in New Issue
Block a user