GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — ZPLab/e2e/selectionFrame.spec.ts at main · u8array/ZPLab Expand file tree/ Copy pathselectionFrame.spec.tsMore file actions 53 lines (47 loc) · 1.95 KB / Copy pathselectionFrame.spec.tsFile metadata and controls53 lines (47 loc) · 1.95 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 import { test, expect, type Page } from '@playwright/test'; interface Box { width: number; height: number; } interface Boxes { frame: Box; bars: Box; } const pageErrors: Error[] = []; test.beforeEach(({ page }) => { pageErrors.length = 0; page.on('pageerror', (e) => pageErrors.push(e)); }); /** Transformer box next to the bar image's own box, both in stage px without stroke. */ async function boxes(page: Page): Promise<Boxes | null> { return page.evaluate(() => { interface Node { findOne: (s: string) => Node | undefined; getClientRect: (o: { skipStroke: boolean; skipShadow: boolean }) => Box; } interface Transformer extends Node { nodes: () => Node[]; width: () => number; height: () => number; } const stage = (window as unknown as { Konva?: { stages: Node[] } }).Konva?.stages[0]; const tr = stage?.findOne('Transformer') as Transformer | undefined; const bars = tr?.nodes()[0]?.findOne('Image')?.getClientRect({ skipStroke: true, skipShadow: true }); if (!tr || !bars) return null; const round = (b: Box) => ({ width: Math.round(b.width), height: Math.round(b.height) }); return { frame: round({ width: tr.width(), height: tr.height() }), bars: round(bars) }; }); } /** Needs the real browser: jsdom showed the correct frame before the fix. */ // Code 128 carries its text in the HRI overlay while EAN-13 clips its image to the bars. for (const entry of ['Code 128', 'EAN-13']) { test(`a freshly inserted ${entry} gets the bar box as its selection frame`, async ({ page }) => { await page.goto('/'); await expect(page.getByRole('button', { name: 'File', exact: true })).toBeVisible(); await page.getByText(entry, { exact: true }).first().dblclick(); await expect.poll(() => boxes(page)).not.toBeNull(); const b = (await boxes(page)) as Boxes; expect(b.frame).toEqual(b.bars); expect(pageErrors, pageErrors.map((e) => e.message).join('\n')).toHaveLength(0); }); } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |