mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 19:57:52 +01:00
web: fix failing tests
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -126,7 +126,7 @@ export class EditorModel {
|
||||
});
|
||||
}
|
||||
|
||||
private async editAndWait(action: () => Promise<void>) {
|
||||
async editAndWait(action: () => Promise<void>) {
|
||||
const oldDateEdited = await this.getDateEdited();
|
||||
await action();
|
||||
await this.page.waitForFunction(
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user