dailykart-testing/tests/inconsistent-hover.spec.ts

20 lines
713 B
TypeScript

import { test, expect } from '@playwright/test';
test('#3 Product card should not resize or break styling on hover', async ({ page }) => {
await page.goto('https://uat.dailykart.net/shop', { waitUntil: 'load' });
// ✅ Use correct class selector from actual HTML
const productCard = page.locator('.product__box').first();
await expect(productCard).toBeVisible({ timeout: 60000 });
await productCard.scrollIntoViewIfNeeded();
const initialSize = await productCard.boundingBox();
await productCard.hover();
const hoverSize = await productCard.boundingBox();
expect(hoverSize?.width).toBeCloseTo(initialSize?.width!, 5);
expect(hoverSize?.height).toBeCloseTo(initialSize?.height!, 5);
});