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: fix edit creation date test
Abdullah Attaef99b47178a1
diff --git a/apps/web/__e2e__/models/note-properties.model.ts b/apps/web/__e2e__/models/note-properties.model.tsindex 1796db50a..4537fba2a 100644--- a/apps/web/__e2e__/models/note-properties.model.ts+++ b/apps/web/__e2e__/models/note-properties.model.ts@@ -31,7 +31,7 @@ import {iterateList} from "./utils";import { SessionHistoryItemModel } from "./session-history-item-model";-import dayjs from "dayjs";+import { Dayjs } from "dayjs";import { Reminder } from "@notesnook/core";abstract class BaseProperties {@@ -235,7 +235,7 @@ export class NotePropertiesModel extends BaseProperties {return dateCreated;}- async editDateCreated(newDateCreated: number) {+ async editDateCreated(date: Dayjs) {await this.open();const editIcon = this.page.locator(getTestId("edit-date-created"));@@ -253,9 +253,8 @@ export class NotePropertiesModel extends BaseProperties {getTestId("time-created-input"));- const date = new Date(newDateCreated);- await dateInput.fill(dayjs(date).format("DD-MM-YYYY"));- await timeInput.fill(dayjs(date).format("hh:mm A"));+ await dateInput.fill(date.format("MM-DD-YYYY"));+ await timeInput.fill(date.format("hh:mm A"));await confirmDialog(editDateCreatedDialog);diff --git a/apps/web/__e2e__/notes.test.ts b/apps/web/__e2e__/notes.test.tsindex f28680eb5..7a714d995 100644--- a/apps/web/__e2e__/notes.test.ts+++ b/apps/web/__e2e__/notes.test.ts@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/+import dayjs from "dayjs";import { AppModel } from "./models/app.model";import {test,@@ -454,9 +455,11 @@ test("edit note creation date in properties panel", async ({ page }) => {const notes = await app.goToNotes();const note = await notes.createNote(NOTE);- const date = new Date("2020-01-15T10:30:00Z");- await note?.properties.editDateCreated(date.valueOf());+ const date = dayjs().subtract(7, "day");+ await note?.properties.editDateCreated(date);const dateCreated = await note?.properties.getDateCreated();- expect(dateCreated).toBe("15-01-2020 03:30 PM");+ expect(date.format("YYYY-MM-DD HH:mm")).toBe(+ dayjs(dateCreated).format("YYYY-MM-DD HH:mm")+ );});