openpencil/tests/e2e/fonts/settings.spec.ts
Danila Poyarkov 8ec70330b4 chore(lint): centralize OpenPencil window API
- Route browser globals through src/app/window-api.ts instead of private __OPEN_PENCIL fields
- Move E2E tests to the public window.openPencil test API
- Add an oxlint rule banning direct window.__OPEN_PENCIL* access
2026-05-06 10:38:03 +03:00

27 lines
1.1 KiB
TypeScript

import { expect, test } from '@playwright/test'
import { CanvasHelper } from '#tests/helpers/canvas'
test('font settings popover is available from typography panel', async ({ page }) => {
await page.goto('/')
const canvas = new CanvasHelper(page)
await canvas.waitForInit()
await page.evaluate(() => {
const store = window.openPencil?.store
if (!store) throw new Error('OpenPencil store not initialized')
const id = store.createShape('TEXT', 120, 120, 240, 40)
store.updateNode(id, { characters: 'Font settings smoke' })
store.select([id])
})
await expect(page.locator('[data-test-id="typography-section"]')).toBeVisible()
await page.locator('[data-test-id="font-settings-trigger"]').click()
await expect(page.getByText('Access system fonts')).toBeVisible()
await expect(page.locator('[data-test-id="font-settings-request-access"]')).toBeVisible()
await expect(page.locator('[data-test-id="font-settings-download-fallbacks"]')).toBeVisible()
await expect(page.locator('[data-test-id="font-settings-refresh-cache"]')).toBeVisible()
await expect(page.locator('[data-test-id="font-settings-clear-cache"]')).toBeVisible()
})