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: add more tests for reminders
Abdullah Attaffacb8818c23
diff --git a/apps/web/__e2e__/models/navigation-menu.model.ts b/apps/web/__e2e__/models/navigation-menu.model.tsindex bd45653d0..029bfb21f 100644--- a/apps/web/__e2e__/models/navigation-menu.model.ts+++ b/apps/web/__e2e__/models/navigation-menu.model.ts@@ -57,13 +57,12 @@ export class NavigationMenuModel {}class NavigationItemModel {- private readonly title: Locator;+ // private readonly title: Locator;private readonly shortcut: Locator;private readonly menu: ContextMenuModel;private readonly page: Page;constructor(private readonly locator: Locator) {this.page = locator.page();- this.title = locator.locator(getTestId("title"));this.shortcut = locator.locator(getTestId("shortcut"));this.menu = new ContextMenuModel(this.page);}@@ -77,7 +76,7 @@ class NavigationItemModel {}async getTitle() {- return await this.title.textContent();+ return await this.locator.getAttribute("title");}async renameColor(alias: string) {diff --git a/apps/web/__e2e__/models/reminders-view.model.ts b/apps/web/__e2e__/models/reminders-view.model.tsindex 89a5ea19c..61a61704a 100644--- a/apps/web/__e2e__/models/reminders-view.model.ts+++ b/apps/web/__e2e__/models/reminders-view.model.ts@@ -38,6 +38,10 @@ export class RemindersViewModel extends BaseViewModel {await this.createButton.click();await fillReminderDialog(this.page, reminder);+ }++ async createReminderAndWait(reminder: Partial<Reminder>) {+ await this.createReminder(reminder);if (reminder.title) await this.waitForItem(reminder.title);return await this.findReminder(reminder);diff --git a/apps/web/__e2e__/reminders.test.ts b/apps/web/__e2e__/reminders.test.tsindex 8169895a4..a6008aaaf 100644--- a/apps/web/__e2e__/reminders.test.ts+++ b/apps/web/__e2e__/reminders.test.ts@@ -36,7 +36,7 @@ test("add a one-time reminder", async ({ page }, info) => {await app.goto();const reminders = await app.goToReminders();- const reminder = await reminders.createReminder(ONE_TIME_REMINDER);+ const reminder = await reminders.createReminderAndWait(ONE_TIME_REMINDER);expect(reminder).toBeDefined();@@ -44,13 +44,34 @@ test("add a one-time reminder", async ({ page }, info) => {await page.waitForEvent("dialog");});+test("adding a one-time reminder before current time should not be possible", async ({+ page+}, info) => {+ info.setTimeout(90 * 1000);++ const app = new AppModel(page);+ await app.goto();+ const reminders = await app.goToReminders();++ await reminders.createReminder({+ ...ONE_TIME_REMINDER,+ date: 0+ });++ expect(+ await app.toasts.waitForToast(+ "Reminder time cannot be earlier than the current time."+ )+ ).toBeTruthy();+});+for (const recurringMode of ["Daily", "Weekly", "Monthly"] as const) {test(`add a recurring reminder (${recurringMode})`, async ({ page }) => {const app = new AppModel(page);await app.goto();const reminders = await app.goToReminders();- const reminder = await reminders.createReminder({+ const reminder = await reminders.createReminderAndWait({...ONE_TIME_REMINDER,mode: "repeat",recurringMode:@@ -67,11 +88,26 @@ for (const recurringMode of ["Daily", "Weekly", "Monthly"] as const) {});}+test(`add a recurring reminder before current time`, async ({ page }) => {+ const app = new AppModel(page);+ await app.goto();+ const reminders = await app.goToReminders();++ const reminder = await reminders.createReminderAndWait({+ ...ONE_TIME_REMINDER,+ mode: "repeat",+ recurringMode: "day",+ date: 0+ });++ expect(reminder).toBeDefined();+});+test("delete a reminder", async ({ page }) => {const app = new AppModel(page);await app.goto();const reminders = await app.goToReminders();- const reminder = await reminders.createReminder(ONE_TIME_REMINDER);+ const reminder = await reminders.createReminderAndWait(ONE_TIME_REMINDER);await reminder?.delete();@@ -89,7 +125,7 @@ test("edit a reminder", async ({ page }) => {const app = new AppModel(page);await app.goto();const reminders = await app.goToReminders();- const reminder = await reminders.createReminder(ONE_TIME_REMINDER);+ const reminder = await reminders.createReminderAndWait(ONE_TIME_REMINDER);const beforeReminderTime = await reminder?.getReminderTime();const beforeDescription = await reminder?.getDescription();const beforeTitle = await reminder?.getTitle();@@ -109,7 +145,7 @@ test("disable a reminder", async ({ page }) => {const app = new AppModel(page);await app.goto();const reminders = await app.goToReminders();- const reminder = await reminders.createReminder(ONE_TIME_REMINDER);+ const reminder = await reminders.createReminderAndWait(ONE_TIME_REMINDER);await reminder?.toggle();@@ -122,7 +158,7 @@ test("enable a disabled reminder", async ({ page }) => {const app = new AppModel(page);await app.goto();const reminders = await app.goToReminders();- const reminder = await reminders.createReminder(ONE_TIME_REMINDER);+ const reminder = await reminders.createReminderAndWait(ONE_TIME_REMINDER);await reminder?.toggle();await reminder?.toggle();