Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: make sure all tests are passing

Abdullah Atta22bf738d21a3
diff --git a/apps/web/__e2e__/editor.test.ts-snapshots/dark-focus-mode-Chromium-win32.jpg b/apps/web/__e2e__/editor.test.ts-snapshots/dark-focus-mode-Chromium-win32.jpg
new file mode 100644
index 000000000..cd98fa5e8
Binary files /dev/null and b/apps/web/__e2e__/editor.test.ts-snapshots/dark-focus-mode-Chromium-win32.jpg differ
diff --git a/apps/web/__e2e__/editor.test.ts-snapshots/fast-switch-and-edit-note-1-Chromium-win32.txt b/apps/web/__e2e__/editor.test.ts-snapshots/fast-switch-and-edit-note-1-Chromium-win32.txt
new file mode 100644
index 000000000..c5c3d9a70
--- /dev/null
+++ b/apps/web/__e2e__/editor.test.ts-snapshots/fast-switch-and-edit-note-1-Chromium-win32.txt
@@ -0,0 +1 @@
+Test note 1 (9) Test note 1 (8) Test note 1 (7) Test note 1 (6) Test note 1 (5) Test note 1 (4) Test note 1 (3) Test note 1 (2) Test note 1 (1) Test note 1 (0) 53ad8e4e40ebebd0f400498d
\ No newline at end of file
diff --git a/apps/web/__e2e__/editor.test.ts-snapshots/fast-switch-and-edit-note-2-Chromium-win32.txt b/apps/web/__e2e__/editor.test.ts-snapshots/fast-switch-and-edit-note-2-Chromium-win32.txt
new file mode 100644
index 000000000..0365eeded
--- /dev/null
+++ b/apps/web/__e2e__/editor.test.ts-snapshots/fast-switch-and-edit-note-2-Chromium-win32.txt
@@ -0,0 +1 @@
+Test note 2 (9)Test note 2 (8)Test note 2 (7)Test note 2 (6)Test note 2 (5)Test note 2 (4)Test note 2 (3)Test note 2 (2)Test note 2 (1)Test note 2 (0)f054d19e9a2f46eff7b9bb25
\ No newline at end of file
diff --git a/apps/web/__e2e__/editor.test.ts-snapshots/fast-switch-and-edit-note-title-1-Chromium-win32.txt b/apps/web/__e2e__/editor.test.ts-snapshots/fast-switch-and-edit-note-title-1-Chromium-win32.txt
new file mode 100644
index 000000000..1b6dba491
--- /dev/null
+++ b/apps/web/__e2e__/editor.test.ts-snapshots/fast-switch-and-edit-note-title-1-Chromium-win32.txt
@@ -0,0 +1 @@
+Test note 1Test note 1 (0) Test note 1 (1) Test note 1 (2) Test note 1 (3) Test note 1 (4) Test note 1 (5) Test note 1 (6) Test note 1 (7) Test note 1 (8) Test note 1 (9)
\ No newline at end of file
diff --git a/apps/web/__e2e__/editor.test.ts-snapshots/fast-switch-and-edit-note-title-2-Chromium-win32.txt b/apps/web/__e2e__/editor.test.ts-snapshots/fast-switch-and-edit-note-title-2-Chromium-win32.txt
new file mode 100644
index 000000000..92705d03c
--- /dev/null
+++ b/apps/web/__e2e__/editor.test.ts-snapshots/fast-switch-and-edit-note-title-2-Chromium-win32.txt
@@ -0,0 +1 @@
+Test note 2Test note 2 (0)Test note 2 (1)Test note 2 (2)Test note 2 (3)Test note 2 (4)Test note 2 (5)Test note 2 (6)Test note 2 (7)Test note 2 (8)Test note 2 (9)
\ No newline at end of file
diff --git a/apps/web/__e2e__/editor.test.ts-snapshots/focus-mode-Chromium-win32.jpg b/apps/web/__e2e__/editor.test.ts-snapshots/focus-mode-Chromium-win32.jpg
new file mode 100644
index 000000000..8a54081b4
Binary files /dev/null and b/apps/web/__e2e__/editor.test.ts-snapshots/focus-mode-Chromium-win32.jpg differ
diff --git a/apps/web/__e2e__/editor.test.ts-snapshots/light-focus-mode-Chromium-win32.jpg b/apps/web/__e2e__/editor.test.ts-snapshots/light-focus-mode-Chromium-win32.jpg
new file mode 100644
index 000000000..827fc0bd7
Binary files /dev/null and b/apps/web/__e2e__/editor.test.ts-snapshots/light-focus-mode-Chromium-win32.jpg differ
diff --git a/apps/web/__e2e__/editor.test.ts-snapshots/normal-mode-from-focus-mode-Chromium-win32.jpg b/apps/web/__e2e__/editor.test.ts-snapshots/normal-mode-from-focus-mode-Chromium-win32.jpg
new file mode 100644
index 000000000..d2a203f48
Binary files /dev/null and b/apps/web/__e2e__/editor.test.ts-snapshots/normal-mode-from-focus-mode-Chromium-win32.jpg differ
diff --git a/apps/web/__e2e__/editor.test.ts-snapshots/readonly-edited-note-Chromium-win32.txt b/apps/web/__e2e__/editor.test.ts-snapshots/readonly-edited-note-Chromium-win32.txt
new file mode 100644
index 000000000..8fdeb8f1c
--- /dev/null
+++ b/apps/web/__e2e__/editor.test.ts-snapshots/readonly-edited-note-Chromium-win32.txt
@@ -0,0 +1 @@
+An edit I madeThis is Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1
\ No newline at end of file
diff --git a/apps/web/__e2e__/notes.test.ts b/apps/web/__e2e__/notes.test.ts
index af10331a1..3d6d8c2fc 100644
--- a/apps/web/__e2e__/notes.test.ts
+++ b/apps/web/__e2e__/notes.test.ts
@@ -229,7 +229,7 @@ test("add tags to note", async ({ page }) => {
});
for (const format of ["html", "txt", "md"] as const) {
- test.only(`export note as ${format}`, async ({ page }) => {
+ test(`export note as ${format}`, async ({ page }) => {
const app = new AppModel(page);
await app.goto();
const notes = await app.goToNotes();
diff --git a/apps/web/__e2e__/notes.test.ts-snapshots/export-html-Chromium-win32.txt b/apps/web/__e2e__/notes.test.ts-snapshots/export-html-Chromium-win32.txt
index c551305be..8d41c231e 100644
--- a/apps/web/__e2e__/notes.test.ts-snapshots/export-html-Chromium-win32.txt
+++ b/apps/web/__e2e__/notes.test.ts-snapshots/export-html-Chromium-win32.txt
@@ -11,7 +11,7 @@
<meta name="created-on" content="xxx" />
<meta name="last-edited-on" content="xxx" />
- <link rel="stylesheet" href="https://app.notesnook.com/assets/editor-styles.css?d=1690898057761">
+ <link rel="stylesheet" href="https://app.notesnook.com/assets/editor-styles.css?d=0">
<style>
img {
diff --git a/apps/web/src/components/editor/tiptap.tsx b/apps/web/src/components/editor/tiptap.tsx
index e58a74a31..458f08f57 100644
--- a/apps/web/src/components/editor/tiptap.tsx
+++ b/apps/web/src/components/editor/tiptap.tsx
@@ -203,7 +203,6 @@ function TipTap(props: TipTapProps) {
editor.commands.refreshSearch();
},
onUpdate: ({ editor, transaction }) => {
- console.log("UPDATE", transaction);
onContentChange?.();
const preventSave = transaction?.getMeta("preventSave") as boolean;
diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts
index 5b16ba27f..44c169a49 100644
--- a/apps/web/vite.config.ts
+++ b/apps/web/vite.config.ts
@@ -41,7 +41,7 @@ const isTesting =
process.env.TEST === "true" || process.env.NODE_ENV === "development";
const isDesktop = process.env.PLATFORM === "desktop";
const isAnalyzing = process.env.ANALYZING === "true";
-process.env.NN_BUILD_TIMESTAMP = `${Date.now()}`;
+process.env.NN_BUILD_TIMESTAMP = isTesting ? "0" : `${Date.now()}`;
export default defineConfig({
envPrefix: "NN_",
diff --git a/packages/ui/src/components/menu/menu-button.tsx b/packages/ui/src/components/menu/menu-button.tsx
index 4c63353bd..671ac08d2 100644
--- a/packages/ui/src/components/menu/menu-button.tsx
+++ b/packages/ui/src/components/menu/menu-button.tsx
@@ -91,7 +91,10 @@ export function MenuButton(props: MenuButtonProps) {
</Text>
</Flex>
{isChecked || menu || modifier ? (
- <Flex sx={{ ml: 4 }}>
+ <Flex
+ sx={{ ml: 4 }}
+ data-test-id={`toggle-state-${isChecked ? "on" : "off"}`}
+ >
{isChecked && <Icon path={mdiCheck} size={"small"} />}
{menu && <Icon path={mdiChevronRight} size={"small"} />}
{modifier && (