web: fix failing tests

This commit is contained in:
Abdullah Atta
2022-09-18 16:37:33 +05:00
parent 7cc8b74a7a
commit 02a0ccebee
4 changed files with 13 additions and 4 deletions

View File

@@ -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();

View File

@@ -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(

View File

@@ -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);

View File

@@ -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();
}
}