You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
845 B
21 lines
845 B
|
4 months ago
|
import { chromium } from 'playwright';
|
||
|
|
const BASE = process.env.BASE_URL ?? 'http://localhost:5173';
|
||
|
|
const b = await chromium.launch();
|
||
|
|
const ctx = await b.newContext();
|
||
|
|
const p = await ctx.newPage();
|
||
|
|
await p.goto(BASE + '/uix/components/button', { waitUntil: 'networkidle' });
|
||
|
|
await p.waitForTimeout(500);
|
||
|
|
const affirmChip = p.locator('button[data-uix-chip]:has-text("affirm")').first();
|
||
|
|
if (await affirmChip.count() > 0) {
|
||
|
|
await affirmChip.click();
|
||
|
|
await p.waitForTimeout(200);
|
||
|
|
}
|
||
|
|
const d = await p.locator('[data-button]').first().evaluate((el: Element) => ({
|
||
|
|
dc: el.getAttribute('data-color'),
|
||
|
|
dv: el.getAttribute('data-variant'),
|
||
|
|
bg: getComputedStyle(el).backgroundColor,
|
||
|
|
paletteSolid: getComputedStyle(el).getPropertyValue('--button-palette-solid').trim()
|
||
|
|
}));
|
||
|
|
console.log('button affirm:', JSON.stringify(d));
|
||
|
|
await b.close();
|