diff --git a/apps/web/__e2e__/editor.test.ts b/apps/web/__e2e__/editor.test.ts index a4bcc7980..becf53fc6 100644 --- a/apps/web/__e2e__/editor.test.ts +++ b/apps/web/__e2e__/editor.test.ts @@ -158,9 +158,10 @@ test("select all & backspace should clear all content in editor", async ({ const notes = await app.goToNotes(); const note = await notes.createNote(NOTE); - await notes.editor.selectAll(); - await page.keyboard.press("Backspace"); - await notes.editor.waitForSaving(); + await notes.editor.editAndWait(async () => { + await notes.editor.selectAll(); + await page.keyboard.press("Backspace"); + }); await notes.newNote(); await note?.openNote(); diff --git a/apps/web/__e2e__/models/editor.model.ts b/apps/web/__e2e__/models/editor.model.ts index 4a066d245..1c4422a1b 100644 --- a/apps/web/__e2e__/models/editor.model.ts +++ b/apps/web/__e2e__/models/editor.model.ts @@ -126,7 +126,7 @@ export class EditorModel { }); } - private async editAndWait(action: () => Promise) { + async editAndWait(action: () => Promise) { const oldDateEdited = await this.getDateEdited(); await action(); await this.page.waitForFunction( diff --git a/apps/web/__e2e__/models/note-properties.model.ts b/apps/web/__e2e__/models/note-properties.model.ts index dcfe94125..dd3f37d61 100644 --- a/apps/web/__e2e__/models/note-properties.model.ts +++ b/apps/web/__e2e__/models/note-properties.model.ts @@ -177,6 +177,7 @@ export class NotePropertiesModel extends BaseProperties { async open() { await this.propertiesButton.click(); await this.propertiesCloseButton.waitFor(); + await this.page.waitForTimeout(1000); } async close() { @@ -274,6 +275,8 @@ export class NoteContextMenuModel extends BaseProperties { await newItemInput.waitFor({ state: "visible" }); await newItemInput.fill(topic); await newItemInput.press("Enter"); + + await item.locator(getTestId("topic"), { hasText: topic }).waitFor(); } const topicItems = item.locator(getTestId("topic")); @@ -320,6 +323,7 @@ class SessionHistoryItemModel { async preview(password?: string) { await this.properties.open(); const isLocked = await this.locked.isVisible(); + await this.locator.click(); if (password && isLocked) { await fillPasswordDialog(this.page, password); diff --git a/apps/web/__e2e__/models/toggle.model.ts b/apps/web/__e2e__/models/toggle.model.ts index ce399d13f..a6e6cc6df 100644 --- a/apps/web/__e2e__/models/toggle.model.ts +++ b/apps/web/__e2e__/models/toggle.model.ts @@ -58,4 +58,8 @@ export class ToggleModel { private getToggleState(locator: Locator, state: TOGGLE_STATES) { return locator.locator(getTestId(`toggle-state-${state}`)); } + + waitFor() { + return this.toggle.waitFor(); + } }