Capture promotion screenshots without holding a row replaced by the normal save refresh

This commit is contained in:
pavlov346346-source 2026-09-19 09:51:41 +03:00
parent 424bf8ce87
commit 16400425e4

View File

@ -81,7 +81,7 @@ try{
await expect(clients).toHaveCount(24); await expect(clients).toHaveCount(24);
const clientSize=await clients.first().boundingBox(); const clientSize=await clients.first().boundingBox();
assert(clientSize.height<=96); 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 nav.getByRole('button',{name:'Меню',exact:true}).click();
await page.locator('[data-menu-item-v1762="ui-smoke-box"]').click(); await page.locator('[data-menu-item-v1762="ui-smoke-box"]').click();
await page.locator('#ctPromotionEnabled').check(); await page.locator('#ctPromotionEnabled').check();
@ -93,7 +93,11 @@ try{
const row=page.locator('[data-menu-item-v1762="ui-smoke-box"]'); const row=page.locator('[data-menu-item-v1762="ui-smoke-box"]');
await expect(row).toContainText('850 ₽'); await expect(row).toContainText('850 ₽');
await expect(row.locator('.ct-promotion-badge')).toHaveText('Акция'); 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 beforeOrders=await page.evaluate(()=>localStorage.sunOrders);
const promo=await page.evaluate(()=>JSON.parse(localStorage.sunBoxes)[0]); const promo=await page.evaluate(()=>JSON.parse(localStorage.sunBoxes)[0]);
assert.equal(promo.price,1000); assert.equal(promo.price,1000);