| 1234567891011121314151617181920212223242526272829 |
- const { chromium } = require('playwright');
- (async () => {
- const browser = await chromium.launch({ headless: true, executablePath: 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe' });
- const page = await browser.newPage({ viewport: { width: 1365, height: 900 } });
- const errors = [];
- page.on('pageerror', error => errors.push(error.message));
- await page.goto('http://127.0.0.1:8931/AI%E5%BF%AB%E9%80%9F%E6%8A%A5%E4%BB%B7_Demo2.html?v=business-category-test', { waitUntil: 'load' });
- const result = await page.evaluate(() => {
- const names = category => [...document.querySelectorAll('.q-furniture-category[data-category="' + category + '"] .q-furniture-tool')]
- .map(el => el.dataset.furnitureType);
- const standard = qGetCabinetPricingRule({ cabinetType: '餐边柜' }, 2, 2.4);
- const master = qGetCabinetPricingRule({ cabinetType: '主卧衣柜' }, 2, 2.4);
- const kitchen = qGetCabinetPricingRule({ cabinetType: '厨房' }, 4, 2.4);
- const highCabinet = qGetCabinetPricingRule({ cabinetType: '厨房', kitchenItem: '高柜' }, 2, 2.4);
- return {
- wardrobe: names('wardrobe'),
- cabinet: names('cabinet'),
- standard,
- master,
- kitchen,
- highCabinet,
- allKitchenLinear: DEFAULT_RULES.kitchen.every(rule => rule.method === '按延米' && rule.unit === '元/m'),
- legacyPackageRules: DEFAULT_RULES.kitchen.filter(rule => /套餐|超3米/.test(rule.name)).map(rule => rule.name)
- };
- });
- console.log(JSON.stringify({ ...result, errors }));
- await browser.close();
- })().catch(error => { console.error(error); process.exit(1); });
|