A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: make tests more reliable
Abdullah Attad2f39df3bf4d
diff --git a/apps/web/__e2e__/checkout.test.ts b/apps/web/__e2e__/checkout.test.tsindex 1a439fa95..215ae854c 100644--- a/apps/web/__e2e__/checkout.test.ts+++ b/apps/web/__e2e__/checkout.test.ts@@ -40,7 +40,7 @@ test.afterAll(async () => {});test.afterEach(async () => {- await app.goto();+ await app.goto(true);});function roundOffPrices(prices: PriceItem[]) {@@ -142,7 +142,7 @@ test("apply coupon through url", async () => {planPrices[plan] = roundOffPrices(await pricing.getPrices());- await app.goto();+ await app.goto(true);}for (const key in planPrices) {diff --git a/apps/web/__e2e__/keyboard-list-navigation.test.ts b/apps/web/__e2e__/keyboard-list-navigation.test.tsindex 94b3dcb0e..4fba44946 100644--- a/apps/web/__e2e__/keyboard-list-navigation.test.ts+++ b/apps/web/__e2e__/keyboard-list-navigation.test.ts@@ -289,9 +289,7 @@ test("Ctrl+Click to select/unselect notes", async ({ page }, info) => {}await selectedNote.contextMenu.open();- expect(- (await selectedNote.contextMenu.title()) === (await selectedNote.getTitle())- ).toBeTruthy();+ expect(await selectedNote.contextMenu.title()).toBeFalsy();});test("opening a note & right clicking on another note should show note properties menu", async ({@@ -306,7 +304,5 @@ test("opening a note & right clicking on another note should show note propertieawait notesList[0].click();await selectedNote.contextMenu.open();- expect(- (await selectedNote.contextMenu.title()) === (await selectedNote.getTitle())- ).toBeTruthy();+ expect(await selectedNote.contextMenu.title()).toBeFalsy();});diff --git a/apps/web/__e2e__/models/app.model.ts b/apps/web/__e2e__/models/app.model.tsindex 37eeac2c6..dc8283de8 100644--- a/apps/web/__e2e__/models/app.model.ts+++ b/apps/web/__e2e__/models/app.model.ts@@ -48,9 +48,10 @@ export class AppModel {this.routeHeader = this.page.locator(getTestId("routeHeader"));}- async goto() {+ async goto(isLoggedIn = false) {await this.page.goto("/");await this.routeHeader.waitFor({ state: "visible" });+ if (!isLoggedIn) await this.navigation.waitForItem("Login");}goBack() {@@ -101,7 +102,9 @@ export class AppModel {async navigateTo(title: string) {if ((await this.getRouteHeader()) === title) return;const item = await this.navigation.findItem(title);- await item?.click();+ if (!item) throw new Error(`Could not find item to navigate to: ${title}`);++ await item.click();await this.page.waitForTimeout(1000);}diff --git a/apps/web/__e2e__/models/context-menu.model.ts b/apps/web/__e2e__/models/context-menu.model.tsindex 346965abb..f23e971c2 100644--- a/apps/web/__e2e__/models/context-menu.model.ts+++ b/apps/web/__e2e__/models/context-menu.model.ts@@ -29,6 +29,7 @@ export class ContextMenuModel {}async title() {+ if (!(await this.titleText.isVisible())) return null;return await this.titleText.textContent();}diff --git a/apps/web/__e2e__/models/navigation-menu.model.ts b/apps/web/__e2e__/models/navigation-menu.model.tsindex 029bfb21f..0f25d45e8 100644--- a/apps/web/__e2e__/models/navigation-menu.model.ts+++ b/apps/web/__e2e__/models/navigation-menu.model.ts@@ -38,6 +38,12 @@ export class NavigationMenuModel {}}+ waitForItem(title: string) {+ return this.menu+ .locator(getTestId(`navigation-item`), { hasText: title })+ .waitFor();+ }+async getShortcuts() {const shortcuts: string[] = [];for await (const item of this.iterateList()) {