← back to Dw Theme Boost Fix
verify/search-probe.mjs
20 lines
import { chromium } from 'playwright';
const b = await chromium.launch();
const p = await b.newPage();
const hits = [];
p.on('response', r => { const u=r.url(); if (u.includes('bc-solutions')||u.includes('mybcapps')) hits.push({u:u.split('?')[0],s:r.status()}); });
await p.goto('https://www.designerwallcoverings.com/search?q=milano+tessile', {waitUntil:'load', timeout:60000});
await p.waitForTimeout(12000);
const products = await p.locator('.boost-sd__product-item, [class*="boost-sd__product"]').count().catch(()=>0);
const noResult = await p.locator('text=/no results|nothing found|0 results/i').count().catch(()=>0);
console.log('search page product elements:', products, '| no-result banners:', noResult);
console.log('staging hits:', hits.filter(h=>h.u.includes('staging')).length, '| prod 200s:', hits.filter(h=>h.u.includes('mybcapps')&&h.s===200).length);
// suggest: type in the header search box
const box = p.locator('input[type="search"], input[name="q"]').first();
await box.click({timeout:8000}).catch(e=>console.log('no search box click:', e.message.split('\n')[0]));
await box.fill('milano').catch(()=>{});
await p.waitForTimeout(5000);
const sugg = await p.locator('[class*="boost-sd__search-suggestion"], [class*="suggestion"] [class*="product"]').count().catch(()=>0);
console.log('suggest dropdown items:', sugg);
await b.close();