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: silently ignore non-applicable sort options in test
Abdullah Attadb4126fe16c8
diff --git a/apps/web/__e2e__/models/base-view.model.ts b/apps/web/__e2e__/models/base-view.model.tsindex 8a44e258f..daa4d256d 100644--- a/apps/web/__e2e__/models/base-view.model.ts+++ b/apps/web/__e2e__/models/base-view.model.ts@@ -103,17 +103,31 @@ export class BaseViewModel {async sort(sort: SortOptions) {const contextMenu: ContextMenuModel = new ContextMenuModel(this.page);- contextMenu.open(this.sortByButton, "left");+ await contextMenu.open(this.sortByButton, "left");await contextMenu.clickOnItem("groupBy");+ if (!(await contextMenu.hasItem(sort.groupBy))) {+ await contextMenu.close();+ return false;+ }await contextMenu.clickOnItem(sort.groupBy);await contextMenu.open(this.sortByButton, "left");await contextMenu.clickOnItem("sortDirection");+ if (!(await contextMenu.hasItem(sort.orderBy))) {+ await contextMenu.close();+ return false;+ }await contextMenu.clickOnItem(sort.orderBy);- contextMenu.open(this.sortByButton, "left");+ await contextMenu.open(this.sortByButton, "left");await contextMenu.clickOnItem("sortBy");+ if (!(await contextMenu.hasItem(sort.sortBy))) {+ await contextMenu.close();+ return false;+ }await contextMenu.clickOnItem(sort.sortBy);++ return true;}async isEmpty() {diff --git a/apps/web/__e2e__/models/context-menu.model.ts b/apps/web/__e2e__/models/context-menu.model.tsindex 9ff8bd85a..986727217 100644--- a/apps/web/__e2e__/models/context-menu.model.ts+++ b/apps/web/__e2e__/models/context-menu.model.ts@@ -46,6 +46,13 @@ export class ContextMenuModel {return this.page.locator(getTestId(`menuitem-${id}`));}+ async hasItem(id: string) {+ return (+ (await this.getItem(id).isVisible()) &&+ (await this.getItem(id).isEnabled())+ );+ }+async close() {await this.page.keyboard.press("Escape");}diff --git a/apps/web/__e2e__/models/types.ts b/apps/web/__e2e__/models/types.tsindex 613e80a3c..c6e013f38 100644--- a/apps/web/__e2e__/models/types.ts+++ b/apps/web/__e2e__/models/types.ts@@ -34,6 +34,7 @@ export type SortByOptions =| "dateCreated"| "dateEdited"| "dateModified"+ | "dateDeleted"| "title";export type GroupByOptions =| "abc"diff --git a/apps/web/__e2e__/notebooks.test.ts b/apps/web/__e2e__/notebooks.test.tsindex 1318c2a71..2158901c6 100644--- a/apps/web/__e2e__/notebooks.test.ts+++ b/apps/web/__e2e__/notebooks.test.ts@@ -246,11 +246,12 @@ test(`sort notebooks`, async ({ page }, info) => {for (const sortBy of sortByOptions) {for (const orderBy of orderByOptions) {await test.step(`group by ${groupBy}, sort by ${sortBy}, order by ${orderBy}`, async () => {- await notebooks?.sort({+ const sortResult = await notebooks?.sort({groupBy,orderBy,sortBy});+ if (!sortResult) return;expect(await notebooks.isEmpty()).toBeFalsy();});diff --git a/apps/web/__e2e__/notes.test.ts b/apps/web/__e2e__/notes.test.tsindex 8b4df541d..215d6dfae 100644--- a/apps/web/__e2e__/notes.test.ts+++ b/apps/web/__e2e__/notes.test.ts@@ -298,11 +298,12 @@ test(`sort notes`, async ({ page }, info) => {for (const sortBy of sortByOptions) {for (const orderBy of orderByOptions) {await test.step(`group by ${groupBy}, sort by ${sortBy}, order by ${orderBy}`, async () => {- await notes?.sort({+ const sortResult = await notes?.sort({groupBy,orderBy,sortBy});+ if (!sortResult) return;expect(await notes.isEmpty()).toBeFalsy();});diff --git a/apps/web/__e2e__/tags.test.ts b/apps/web/__e2e__/tags.test.tsindex a08d4f500..636c5c324 100644--- a/apps/web/__e2e__/tags.test.ts+++ b/apps/web/__e2e__/tags.test.ts@@ -193,11 +193,12 @@ test(`sort tags`, async ({ page }, info) => {for (const sortBy of sortByOptions) {for (const orderBy of orderByOptions) {await test.step(`group by ${groupBy}, sort by ${sortBy}, order by ${orderBy}`, async () => {- await tags?.sort({+ const sortResult = await tags?.sort({groupBy,orderBy,sortBy});+ if (!sortResult) return;expect(await tags.isEmpty()).toBeFalsy();});diff --git a/apps/web/__e2e__/topics.test.ts b/apps/web/__e2e__/topics.test.tsindex 6a3bcd5ad..19e8f923b 100644--- a/apps/web/__e2e__/topics.test.ts+++ b/apps/web/__e2e__/topics.test.ts@@ -42,11 +42,13 @@ test(`sort topics`, async ({ page }, info) => {for (const sortBy of sortByOptions) {for (const orderBy of orderByOptions) {await test.step(`group by ${groupBy}, sort by ${sortBy}, order by ${orderBy}`, async () => {- await topics?.sort({+ const sortResult = await topics?.sort({groupBy,orderBy,sortBy});+ if (!sortResult) return;+expect(await topics?.isEmpty()).toBeFalsy();});}diff --git a/apps/web/__e2e__/utils/index.ts b/apps/web/__e2e__/utils/index.tsindex 8c2bb8e7d..9ae9909c0 100644--- a/apps/web/__e2e__/utils/index.ts+++ b/apps/web/__e2e__/utils/index.ts@@ -110,7 +110,12 @@ function isTestAll() {}const orderByOptions: OrderByOptions[] = ["asc", "desc"];-const sortByOptions: SortByOptions[] = ["dateCreated", "dateEdited"];+const sortByOptions: SortByOptions[] = [+ "dateCreated",+ "dateEdited",+ "dateModified",+ "dateDeleted"+];const groupByOptions: GroupByOptions[] = ["abc","none",