Fix broken tests

This commit is contained in:
Jonatan Heyman 2024-07-15 13:13:25 +02:00
parent 2e262241c9
commit d317ac59a6

View File

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