| 1234567891011121314151617181920212223 |
- import { chromium } from 'playwright';
- const b = await chromium.launch({ executablePath: 'C:/Program Files/Google/Chrome/Application/chrome.exe' });
- const p = await (await b.newContext({ viewport: { width: 1440, height: 900 } })).newPage();
- const clear = () => p.evaluate(() => document.querySelectorAll('vite-error-overlay').forEach(e=>e.remove()));
- await p.goto('http://localhost:4200/login', { waitUntil: 'networkidle' });
- await clear(); await p.waitForTimeout(800);
- const ins = await p.locator('ui-input input').all();
- await ins[0].fill('13800138000'); await ins[1].fill('123456');
- await p.getByText('登 录', { exact: false }).first().click();
- await p.waitForTimeout(3000);
- await p.goto('http://localhost:4200/desktop/mine', { waitUntil: 'networkidle' });
- await clear(); await p.waitForTimeout(2200);
- await p.screenshot({ path: '../../.shots/v3-mine.png', fullPage: true });
- const r = await p.evaluate(() => {
- const lay = document.querySelector('.settings-layout');
- return {
- cols: lay ? getComputedStyle(lay).gridTemplateColumns : null,
- pageW: document.querySelector('.page')?.getBoundingClientRect().width,
- cards: document.querySelectorAll('ui-card').length,
- };
- });
- console.log(JSON.stringify(r, null, 2));
- await b.close();
|