← back to Majilite Jewelry Cases

hoverproof.mjs

20 lines

import { chromium } from 'playwright-core';
const EXE = '/Users/macstudio3/Library/Caches/ms-playwright/chromium-1234/chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing';
const b = await chromium.launch({ executablePath: EXE });
try {
  const p = await b.newPage({ viewport: { width: 1280, height: 1000 } });
  await p.goto('https://novasuede.com/', { waitUntil: 'networkidle', timeout: 30000 });
  await p.waitForSelector('.color-item', { timeout: 20000 });
  const item = p.locator('.color-item').nth(8);
  await item.scrollIntoViewIfNeeded(); await p.waitForTimeout(400);
  await item.locator('.color-swatch').screenshot({ path: 'output/_proof/LIVE-before.png' });
  await item.hover(); await p.waitForTimeout(900);
  const op = await item.locator('.jewel').evaluate(el => getComputedStyle(el).opacity).catch(()=>'no-jewel');
  const src = await item.locator('.jewel').getAttribute('src').catch(()=>null);
  const nat = await item.locator('.jewel').evaluate(el=>el.naturalWidth).catch(()=>0);
  console.log('LIVE hover -> jewel opacity:', op, '| naturalWidth:', nat, '| src:', src);
  await item.locator('.color-swatch').screenshot({ path: 'output/_proof/LIVE-hover.png' });
} finally {
  await b.close();
}