openpencil/tests/e2e/tools/section.spec.ts
Danila Poyarkov 11e38b626a test(e2e): extract shared editor setup fixture
- useEditorSetup() / useEditorSetupWithClear() in tests/e2e/fixtures.ts
- Migrated 17 specs to shared fixture, removing ~300 lines of boilerplate
- Moved getSelectedNode/getSelectedNodes to shared store helpers
- Replaced inline getSelectedNode in 4 specs with shared import
- Test duplication: 329 → 308 clones (10.12% → 9.08%)
2026-05-16 16:19:03 +03:00

21 lines
683 B
TypeScript

import { expect, test, useEditorSetupWithClear } from '#tests/e2e/fixtures'
const editor = useEditorSetupWithClear('/?test')
test('draw section in full editor without browser errors', async () => {
await editor.canvas.drawSection(100, 100, 240, 160)
await expect(editor.page.getByTestId('design-node-header')).toContainText('SECTION')
await expect
.poll(async () => {
return editor.page.evaluate(() => {
const store = window.openPencil?.getStore?.()
const selectedId = [...store.state.selectedIds][0]
return selectedId ? store.graph.getNode(selectedId)?.type : null
})
})
.toBe('SECTION')
editor.canvas.assertNoErrors()
})