From bbb43bc8b455fa585a4fe6bd1c271bf14b771a0c Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Mon, 5 Jun 2023 15:28:20 +0500 Subject: [PATCH] web: replace date-time in test snapshot with xxx --- apps/web/__e2e__/models/note-properties.model.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/apps/web/__e2e__/models/note-properties.model.ts b/apps/web/__e2e__/models/note-properties.model.ts index ae2125bf0..76ecf1086 100644 --- a/apps/web/__e2e__/models/note-properties.model.ts +++ b/apps/web/__e2e__/models/note-properties.model.ts @@ -234,18 +234,17 @@ export class NoteContextMenuModel extends BaseProperties { await this.open(); await this.menu.clickOnItem("export"); - // we need to override date time so - // date created & date edited remain fixed. - await this.noteLocator.evaluate(() => { - // eslint-disable-next-line no-extend-native - Date.prototype.toLocaleString = () => "xxx"; - }); - - return await downloadAndReadFile( + const content = await downloadAndReadFile( this.noteLocator.page(), this.menu.getItem(format), "utf-8" ); + if (format === "html") { + return content + .replace(/(name="created-on" content=")(.+?)"/, '$1xxx"') + .replace(/(name="last-edited-on" content=")(.+?)"/, '$1xxx"'); + } + return content; } async addToNotebook(notebook: Notebook) {