Skip to content

AI-native design editor. Open-source Figma alternative.

test: type the tabs module in the closed-documents spec (#917)

Danila Poyarkov1c66fed8daf7
diff --git a/tests/e2e/app/closed-documents.spec.ts b/tests/e2e/app/closed-documents.spec.ts
index 5215189c1..7648348e6 100644
--- a/tests/e2e/app/closed-documents.spec.ts
+++ b/tests/e2e/app/closed-documents.spec.ts
@@ -2,6 +2,8 @@ import { fileURLToPath } from 'node:url'
import { expect, test } from '@playwright/test'
+import type * as AppTabs from '@/app/tabs'
+
import { CanvasHelper } from '#tests/helpers/canvas'
const FIXTURE = 'gold-preview.fig'
@@ -21,7 +23,8 @@ test('documents closed in tabs are released', async ({ page }) => {
for (let cycle = 0; cycle < 3; cycle++) {
await page.evaluate(async (fixture) => {
- const tabs = await import('/src/app/tabs/index.ts')
+ const tabsURL = '/src/app/tabs/index.ts'
+ const tabs: typeof AppTabs = await import(tabsURL)
const response = await fetch(`/__fixtures/${fixture}`)
await tabs.openFileInNewTab(new File([await response.arrayBuffer()], fixture))
}, FIXTURE)
@@ -34,7 +37,8 @@ test('documents closed in tabs are released', async ({ page }) => {
)
.toBe(true)
await page.evaluate(async () => {
- const tabs = await import('/src/app/tabs/index.ts')
+ const tabsURL = '/src/app/tabs/index.ts'
+ const tabs: typeof AppTabs = await import(tabsURL)
const store = tabs.getActiveStore()
const graphs = Reflect.get(window, '__closedGraphs') as WeakRef<object>[]
graphs.push(new WeakRef(store.graph))