Skip to content
File

Blob: tests/e2e/specs/01-auth-edit-persist.spec.ts

typescript33 lines
1import { test, expect, createTestPage, waitForDocEditorReady } from "../fixtures/bland-test";
2 
3test.describe("auth + edit + persist", () => {
4 test("login, type in editor, reload, verify text persisted", async ({
5 authenticatedPage: { page, accessToken },
6 e2eWorkspace,
7 }) => {
8 const testPage = await createTestPage(page, accessToken, "Persist Test", e2eWorkspace);
9 
10 await page.goto(`/${testPage.workspaceSlug}/${testPage.pageId}`);
11 
12 // Wait for the editor to mount and become editable
13 const editor = await waitForDocEditorReady(page, { editable: true });
14 
15 // Click into the editor and type
16 await editor.click();
17 await page.keyboard.type("Hello Playwright");
18 
19 // Wait for typed content to be visible in the editor
20 await expect(editor).toContainText("Hello Playwright");
21 
22 // Wait for WebSocket sync by checking the sync status indicator
23 await waitForDocEditorReady(page, { editable: true, connected: true });
24 
25 // Reload and verify persistence
26 await page.reload();
27 const editorAfterReload = page.locator(".tiptap");
28 await editorAfterReload.waitFor({ timeout: 30_000 });
29 
30 await expect(editorAfterReload).toContainText("Hello Playwright");
31 });
32});