- Playwright E2E tests for OpenPencil: draw, move, delete, undo shapes - Visual screenshot baselines with toHaveScreenshot() - SwiftShader for headless WebGL/CanvasKit rendering - Figma CDP helper for reference tests (connect to Figma Desktop) - ?test URL param for clean canvas without demo shapes - Scripts: test, test:update, test:figma, figma:debug
31 lines
676 B
TypeScript
31 lines
676 B
TypeScript
import { test, expect } from '@playwright/test'
|
|
|
|
import { FigmaHelper } from '../helpers/figma'
|
|
|
|
test.describe('figma reference: create shapes', () => {
|
|
let figma: FigmaHelper
|
|
|
|
test.beforeAll(async () => {
|
|
figma = new FigmaHelper()
|
|
await figma.connect()
|
|
})
|
|
|
|
test.afterAll(async () => {
|
|
await figma.disconnect()
|
|
})
|
|
|
|
test.beforeEach(async () => {
|
|
await figma.deleteSelection()
|
|
await figma.waitForRender()
|
|
})
|
|
|
|
test('empty canvas', async () => {
|
|
await expect(figma.canvas).toHaveScreenshot()
|
|
})
|
|
|
|
test('draw rectangle', async () => {
|
|
await figma.drawRect(200, 200, 200, 150)
|
|
await expect(figma.canvas).toHaveScreenshot()
|
|
})
|
|
})
|