From 16400425e43ddcaa031c0b356d208bb05d40e119 Mon Sep 17 00:00:00 2001 From: pavlov346346-source Date: Sat, 19 Sep 2026 09:51:41 +0300 Subject: [PATCH] Capture promotion screenshots without holding a row replaced by the normal save refresh --- tests/production-ui-smoke.mjs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/production-ui-smoke.mjs b/tests/production-ui-smoke.mjs index 70730f2..1e37958 100644 --- a/tests/production-ui-smoke.mjs +++ b/tests/production-ui-smoke.mjs @@ -81,7 +81,7 @@ try{ await expect(clients).toHaveCount(24); const clientSize=await clients.first().boundingBox(); assert(clientSize.height<=96); - await page.screenshot({path:`${output}/clients-${width}.png`}); + await page.screenshot({path:`${output}/clients-${width}.png`,animations:'disabled'}); await nav.getByRole('button',{name:'Меню',exact:true}).click(); await page.locator('[data-menu-item-v1762="ui-smoke-box"]').click(); await page.locator('#ctPromotionEnabled').check(); @@ -93,7 +93,11 @@ try{ const row=page.locator('[data-menu-item-v1762="ui-smoke-box"]'); await expect(row).toContainText('850 ₽'); await expect(row.locator('.ct-promotion-badge')).toHaveText('Акция'); - await row.screenshot({path:`${output}/promotion-card-${width}.png`}); + // Saving normally redraws the menu list on a queued task. A viewport + // screenshot does not retain an element handle that may detach meanwhile. + // Keep the price/badge checks above and the expiry/order checks below. + await row.scrollIntoViewIfNeeded(); + await page.screenshot({path:`${output}/promotion-card-${width}.png`,animations:'disabled'}); const beforeOrders=await page.evaluate(()=>localStorage.sunOrders); const promo=await page.evaluate(()=>JSON.parse(localStorage.sunBoxes)[0]); assert.equal(promo.price,1000);