diff --git a/tests/test-utils.js b/tests/test-utils.js index 9e841c47..b2760cf3 100644 --- a/tests/test-utils.js +++ b/tests/test-utils.js @@ -1,4 +1,5 @@ import { test, expect } from '@playwright/test'; +import { NoteFormat } from '../src/editor/note-format.js'; export function pageErrorGetter(page) { let messages = []; @@ -26,10 +27,15 @@ export class HeynotePage { return await this.page.evaluate(() => window._heynote_editor.getBlocks()) } - async getContent() { + async getBufferData() { return await this.page.evaluate(() => window._heynote_editor.getContent()) } + async getContent() { + const note = NoteFormat.load(await this.getBufferData()) + return note.content + } + async setContent(content) { await expect(this.page.locator("css=.cm-editor")).toBeVisible() await this.page.evaluate((content) => window._heynote_editor.setContent(content), content)