fix(h5): use replacement flip icon on report scanning screen

This commit is contained in:
xsl
2026-10-13 18:04:32 +08:00
parent 7381306139
commit 84a92137aa
6 changed files with 24 additions and 12 deletions
+7
View File
@@ -64,6 +64,10 @@ try {
assert.equal(await page.locator('#scan-photo').count(), 0, 'no user photo element');
await capture();
await page.waitForSelector('#p-analyzing.scan-artwork-ready');
await page.waitForFunction(() => { const i = document.querySelector('.scan-flip-icon img'); return i.complete && i.naturalWidth === 80 && i.naturalHeight === 80; });
assert.equal(await page.locator('.scan-flip-icon img').getAttribute('src'), await page.locator('.cam-flip img').getAttribute('src'), 'scan and camera share replacement icon');
assert.equal(await page.locator('.scan-flip-icon').evaluate(el => getComputedStyle(el).pointerEvents), 'none');
assert.equal(await page.locator('.scan-flip-icon [data-action], button.scan-flip-icon').count(), 0, 'scan flip stays decorative');
assert((await page.locator('#scan-face').evaluate(el => getComputedStyle(el).maskImage)).includes('scan-face-mask.png'));
assert.equal(await page.locator('.scan-beam').evaluate(el => getComputedStyle(el).animationName), 'report-scan');
const pixels = await page.locator('#scan-artwork').evaluate(image => {
@@ -75,6 +79,9 @@ try {
for (const [width, height] of [[320, 726], [375, 726], [390, 844], [414, 896], [480, 726], [375, 440]]) {
await page.setViewportSize({ width, height });
const art = await page.locator('#scan-artwork').boundingBox();
const icon = await page.locator('.scan-flip-icon img').boundingBox();
assert(Math.abs(icon.width / art.width - 80 / 1080) < .001, 'icon scales with PSD stage');
assert(Math.abs(icon.height - icon.width) < 1, 'replacement remains square');
assert(art.width <= width + 1 && art.height <= height + 1);
assert(Math.abs(art.width / art.height - 1080 / 2091) < .001, 'PSD is contained without cropping');
assert(Math.abs(art.x - (width - art.width) / 2) < 1 && Math.abs(art.y - (height - art.height) / 2) < 1);