mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-24 07:29:30 +01:00
web: fix all other failing tests
This commit is contained in:
committed by
Abdullah Atta
parent
a74b910478
commit
f254fc5c58
@@ -36,7 +36,14 @@ export class ItemModel extends BaseItemModel {
|
||||
return new NotesViewModel(this.page, "notes");
|
||||
}
|
||||
|
||||
async delete(deleteContainedNotes = false) {
|
||||
async delete() {
|
||||
await this.contextMenu.open(this.locator);
|
||||
await this.contextMenu.clickOnItem("delete");
|
||||
|
||||
await this.waitFor("detached");
|
||||
}
|
||||
|
||||
async deleteWithNotes(deleteContainedNotes = false) {
|
||||
await this.contextMenu.open(this.locator);
|
||||
await this.contextMenu.clickOnItem("delete");
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import { Locator, Page } from "@playwright/test";
|
||||
import { getTestId } from "../utils";
|
||||
import { BaseViewModel } from "./base-view.model";
|
||||
import { ItemModel } from "./item.model";
|
||||
import { SearchViewModel } from "./search-view-model";
|
||||
import { Item } from "./types";
|
||||
import { fillItemDialog } from "./utils";
|
||||
|
||||
|
||||
@@ -29,7 +29,9 @@ export class NotebooksViewModel extends BaseViewModel {
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, "notebooks");
|
||||
this.createButton = this.list.locator(getTestId("notebooks-action-button"));
|
||||
this.createButton = page
|
||||
.locator(getTestId("notebooks-action-button"))
|
||||
.first();
|
||||
}
|
||||
|
||||
async createNotebook(notebook: Notebook) {
|
||||
|
||||
@@ -34,7 +34,7 @@ export class NotesViewModel extends BaseViewModel {
|
||||
|
||||
constructor(page: Page, pageId: "home" | "notes") {
|
||||
super(page, pageId);
|
||||
this.createButton = this.list.locator(getTestId("notes-action-button"));
|
||||
this.createButton = page.locator(getTestId("notes-action-button"));
|
||||
this.editor = new EditorModel(page);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ test("delete a topic", async ({ page }) => {
|
||||
const topics = await notebook?.openNotebook();
|
||||
const topic = await topics?.findItem({ title: NOTEBOOK.topics[0] });
|
||||
|
||||
await topic?.delete();
|
||||
await topic?.deleteWithNotes();
|
||||
|
||||
expect(await app.toasts.waitForToast("1 topic deleted")).toBe(true);
|
||||
expect(await topics?.findItem({ title: NOTEBOOK.topics[0] })).toBeUndefined();
|
||||
@@ -109,7 +109,7 @@ test("delete all notes within a topic", async ({ page }) => {
|
||||
}
|
||||
await app.goBack();
|
||||
|
||||
await topic?.delete(true);
|
||||
await topic?.deleteWithNotes(true);
|
||||
|
||||
notes = await app.goToNotes();
|
||||
expect(await notes.isEmpty()).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user