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.
24 lines
852 B
24 lines
852 B
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();
|