Skip to content

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

test: add editor focus mode test

thecodrr45323ced12ab
diff --git a/apps/web/__e2e__/editor.test.js b/apps/web/__e2e__/editor.test.js
new file mode 100644
index 000000000..fed10525a
--- /dev/null
+++ b/apps/web/__e2e__/editor.test.js
@@ -0,0 +1,24 @@
+const { Page, test, expect } = require("@playwright/test");
+const { createNote, NOTE, getTestId } = require("./utils");
+/**
+ * @type {Page}
+ */
+var page = null;
+global.page = null;
+test.beforeEach(async ({ page: _page }) => {
+ global.page = _page;
+ page = _page;
+ await page.goto("http://localhost:3000/");
+});
+
+test("focus mode", async () => {
+ await createNote(NOTE, "notes");
+
+ await page.click(getTestId("focus-mode"));
+
+ await page.waitForTimeout(1000);
+
+ expect(
+ await page.screenshot({ fullPage: true, quality: 100, type: "jpeg" })
+ ).toMatchSnapshot("focus-mode.jpg", { threshold: 99 });
+});
diff --git a/apps/web/__e2e__/editor.test.js-snapshots/focus-mode-Chromium-linux.jpg b/apps/web/__e2e__/editor.test.js-snapshots/focus-mode-Chromium-linux.jpg
new file mode 100644
index 000000000..f91abfb4d
Binary files /dev/null and b/apps/web/__e2e__/editor.test.js-snapshots/focus-mode-Chromium-linux.jpg differ
diff --git a/apps/web/__e2e__/editor.test.js-snapshots/focus-mode-Firefox-linux.jpg b/apps/web/__e2e__/editor.test.js-snapshots/focus-mode-Firefox-linux.jpg
new file mode 100644
index 000000000..a910e68d9
Binary files /dev/null and b/apps/web/__e2e__/editor.test.js-snapshots/focus-mode-Firefox-linux.jpg differ
diff --git a/apps/web/__e2e__/editor.test.js-snapshots/focus-mode-WebKit-linux.jpg b/apps/web/__e2e__/editor.test.js-snapshots/focus-mode-WebKit-linux.jpg
new file mode 100644
index 000000000..63d65fd2f
Binary files /dev/null and b/apps/web/__e2e__/editor.test.js-snapshots/focus-mode-WebKit-linux.jpg differ
diff --git a/apps/web/__e2e__/notes.test.js b/apps/web/__e2e__/notes.test.js
index 93dec90bd..4d7385100 100644
--- a/apps/web/__e2e__/notes.test.js
+++ b/apps/web/__e2e__/notes.test.js
@@ -3,7 +3,8 @@
/**
* TODO: We are still not checking if toast appears on delete/restore or not.
- */ const { test, expect } = require("@playwright/test");
+ */
+const { Page, test, expect } = require("@playwright/test");
const {
getTestId,
createNote,