- 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%)
21 lines
683 B
TypeScript
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()
|
|
})
|