mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-18 20:49:36 +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 notes = await app.goToNotes();
|
||||||
const note = await notes.createNote(NOTE);
|
const note = await notes.createNote(NOTE);
|
||||||
|
|
||||||
await notes.editor.selectAll();
|
await notes.editor.editAndWait(async () => {
|
||||||
await page.keyboard.press("Backspace");
|
await notes.editor.selectAll();
|
||||||
await notes.editor.waitForSaving();
|
await page.keyboard.press("Backspace");
|
||||||
|
});
|
||||||
|
|
||||||
await notes.newNote();
|
await notes.newNote();
|
||||||
await note?.openNote();
|
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();
|
const oldDateEdited = await this.getDateEdited();
|
||||||
await action();
|
await action();
|
||||||
await this.page.waitForFunction(
|
await this.page.waitForFunction(
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ export class NotePropertiesModel extends BaseProperties {
|
|||||||
async open() {
|
async open() {
|
||||||
await this.propertiesButton.click();
|
await this.propertiesButton.click();
|
||||||
await this.propertiesCloseButton.waitFor();
|
await this.propertiesCloseButton.waitFor();
|
||||||
|
await this.page.waitForTimeout(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
async close() {
|
async close() {
|
||||||
@@ -274,6 +275,8 @@ export class NoteContextMenuModel extends BaseProperties {
|
|||||||
await newItemInput.waitFor({ state: "visible" });
|
await newItemInput.waitFor({ state: "visible" });
|
||||||
await newItemInput.fill(topic);
|
await newItemInput.fill(topic);
|
||||||
await newItemInput.press("Enter");
|
await newItemInput.press("Enter");
|
||||||
|
|
||||||
|
await item.locator(getTestId("topic"), { hasText: topic }).waitFor();
|
||||||
}
|
}
|
||||||
|
|
||||||
const topicItems = item.locator(getTestId("topic"));
|
const topicItems = item.locator(getTestId("topic"));
|
||||||
@@ -320,6 +323,7 @@ class SessionHistoryItemModel {
|
|||||||
async preview(password?: string) {
|
async preview(password?: string) {
|
||||||
await this.properties.open();
|
await this.properties.open();
|
||||||
const isLocked = await this.locked.isVisible();
|
const isLocked = await this.locked.isVisible();
|
||||||
|
|
||||||
await this.locator.click();
|
await this.locator.click();
|
||||||
if (password && isLocked) {
|
if (password && isLocked) {
|
||||||
await fillPasswordDialog(this.page, password);
|
await fillPasswordDialog(this.page, password);
|
||||||
|
|||||||
@@ -58,4 +58,8 @@ export class ToggleModel {
|
|||||||
private getToggleState(locator: Locator, state: TOGGLE_STATES) {
|
private getToggleState(locator: Locator, state: TOGGLE_STATES) {
|
||||||
return locator.locator(getTestId(`toggle-state-${state}`));
|
return locator.locator(getTestId(`toggle-state-${state}`));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
waitFor() {
|
||||||
|
return this.toggle.waitFor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user