Skip to content

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

web: reduce tests flakiness

Abdullah Atta53047f035ef3
diff --git a/.github/workflows/web.tests.yml b/.github/workflows/web.tests.yml
index 2841ea971..5633789af 100644
--- a/.github/workflows/web.tests.yml
+++ b/.github/workflows/web.tests.yml
@@ -15,7 +15,7 @@ on:
- "opened"
jobs:
- build:
+ test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
diff --git a/apps/web/__e2e__/checkout.test.js b/apps/web/__e2e__/checkout.test.js
index 29d8b40f5..3205930fe 100644
--- a/apps/web/__e2e__/checkout.test.js
+++ b/apps/web/__e2e__/checkout.test.js
@@ -22,15 +22,27 @@ const { getTestId, loginUser } = require("./utils");
test.setTimeout(45 * 1000);
/**
- * @type {Page}
+ * @type {import('@playwright/test').Page}
*/
var page = null;
global.page = null;
-test.beforeEach(async ({ page: _page, baseURL }) => {
+
+test.describe.configure({ mode: "serial" });
+
+test.beforeAll(async ({ browser, baseURL }) => {
+ // Create page yourself and sign in.
+ const _page = await browser.newPage();
global.page = _page;
page = _page;
+
await page.goto(baseURL);
await page.waitForSelector(getTestId("routeHeader"));
+
+ await loginUser();
+});
+
+test.afterAll(async () => {
+ await page.close();
});
const plans = [
@@ -58,8 +70,9 @@ async function getPrices() {
*/
function roundOffPrices(prices) {
return prices.replaceAll(/(\d+.\d+)/gm, (str, price) => {
- price = parseFloat(price);
- return isNaN(price) ? 0 : Math.ceil(Math.round(price) / 10) * 10;
+ const digits = "0".repeat(price.length - 1);
+ return isNaN(parseFloat(price)) ? 0 : `${price[0]}${digits}`;
+ // Math.ceil(Math.round(price) / 10) * 10;
});
}
@@ -120,11 +133,7 @@ async function forEachPlan(action) {
}
}
-test("change plans", async ({ page }, info) => {
- info.setTimeout(0);
-
- await loginUser();
-
+test("change plans", async () => {
await page.goto("/notes/#/buy/");
await page.waitForSelector(getTestId("see-all-plans"));
@@ -138,11 +147,7 @@ test("change plans", async ({ page }, info) => {
});
});
-test("confirm plan prices", async ({ page }, info) => {
- info.setTimeout(0);
-
- await loginUser();
-
+test("confirm plan prices", async () => {
await page.goto("/#/buy/");
await page.waitForSelector(getTestId("see-all-plans"));
@@ -155,11 +160,7 @@ test("confirm plan prices", async ({ page }, info) => {
});
});
-test("changing locale should show localized prices", async ({ page }, info) => {
- info.setTimeout(0);
-
- await loginUser();
-
+test("changing locale should show localized prices", async () => {
await page.goto("/#/buy/");
await page.waitForSelector(getTestId("see-all-plans"));
@@ -176,13 +177,7 @@ test("changing locale should show localized prices", async ({ page }, info) => {
});
});
-test("applying coupon should change discount & total price", async ({
- page
-}, info) => {
- info.setTimeout(0);
-
- await loginUser();
-
+test("applying coupon should change discount & total price", async () => {
await page.goto("/#/buy/");
await page.waitForSelector(getTestId("see-all-plans"));
@@ -209,10 +204,7 @@ test("applying coupon should change discount & total price", async ({
});
});
-test("apply coupon through url", async ({ page }, info) => {
- info.setTimeout(0);
- await loginUser();
-
+test("apply coupon through url", async () => {
for (let plan of plans) {
await page.goto(`/#/buy/${plan.key}/${plan.coupon}`);
@@ -229,11 +221,7 @@ test("apply coupon through url", async ({ page }, info) => {
}
});
-test("apply coupon after changing country", async ({ page }, info) => {
- info.setTimeout(0);
-
- await loginUser();
-
+test("apply coupon after changing country", async () => {
await page.goto("/#/buy/");
await page.waitForSelector(getTestId("see-all-plans"));
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-discounted-prices-Chromium-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-discounted-prices-Chromium-linux.txt
index 9a77974a9..756dfab45 100644
--- a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-discounted-prices-Chromium-linux.txt
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-discounted-prices-Chromium-linux.txt
@@ -1,5 +1,5 @@
-subtotal: ₹370
-tax: ₹70
-discount: -₹220
-total: ₹220
-first month then ₹440/mo
\ No newline at end of file
+subtotal: ₹300000
+tax: ₹60000
+discount: -₹200000
+total: ₹200000
+first month then ₹400000/mo
\ No newline at end of file
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-discounted-prices-Firefox-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-discounted-prices-Firefox-linux.txt
new file mode 100644
index 000000000..756dfab45
--- /dev/null
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-discounted-prices-Firefox-linux.txt
@@ -0,0 +1,5 @@
+subtotal: ₹300000
+tax: ₹60000
+discount: -₹200000
+total: ₹200000
+first month then ₹400000/mo
\ No newline at end of file
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-discounted-prices-WebKit-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-discounted-prices-WebKit-linux.txt
new file mode 100644
index 000000000..c1e09ab16
--- /dev/null
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-discounted-prices-WebKit-linux.txt
@@ -0,0 +1,5 @@
+subtotal: ₹300000
+tax: ₹60000
+discount: -₹200000
+total: ₹200000
+first month then ₹400000/mo
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-prices-Chromium-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-prices-Chromium-linux.txt
index a9ae67d89..e05da96b6 100644
--- a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-prices-Chromium-linux.txt
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-prices-Chromium-linux.txt
@@ -1,5 +1,5 @@
-subtotal: ₹370
-tax: ₹70
-discount: ₹0
-total: ₹440/mo
+subtotal: ₹300000
+tax: ₹60000
+discount: ₹0000
+total: ₹400000/mo
forever
\ No newline at end of file
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-prices-Firefox-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-prices-Firefox-linux.txt
new file mode 100644
index 000000000..e05da96b6
--- /dev/null
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-prices-Firefox-linux.txt
@@ -0,0 +1,5 @@
+subtotal: ₹300000
+tax: ₹60000
+discount: ₹0000
+total: ₹400000/mo
+forever
\ No newline at end of file
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-prices-WebKit-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-prices-WebKit-linux.txt
new file mode 100644
index 000000000..9f4c6f36f
--- /dev/null
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-IN-prices-WebKit-linux.txt
@@ -0,0 +1,5 @@
+subtotal: ₹300000
+tax: ₹60000
+discount: ₹0000
+total: ₹400000/mo
+forever
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-discounted-prices-Chromium-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-discounted-prices-Chromium-linux.txt
index 6cd6c887b..8cf272388 100644
--- a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-discounted-prices-Chromium-linux.txt
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-discounted-prices-Chromium-linux.txt
@@ -1,5 +1,5 @@
-subtotal: $10
-tax: $0
-discount: -$10
-total: $10
-first month then $10/mo
\ No newline at end of file
+subtotal: $4000
+tax: $0000
+discount: -$2000
+total: $2000
+first month then $4000/mo
\ No newline at end of file
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-discounted-prices-Firefox-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-discounted-prices-Firefox-linux.txt
new file mode 100644
index 000000000..8cf272388
--- /dev/null
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-discounted-prices-Firefox-linux.txt
@@ -0,0 +1,5 @@
+subtotal: $4000
+tax: $0000
+discount: -$2000
+total: $2000
+first month then $4000/mo
\ No newline at end of file
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-discounted-prices-WebKit-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-discounted-prices-WebKit-linux.txt
new file mode 100644
index 000000000..b95202fe8
--- /dev/null
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-discounted-prices-WebKit-linux.txt
@@ -0,0 +1,5 @@
+subtotal: $4000
+tax: $0000
+discount: -$2000
+total: $2000
+first month then $4000/mo
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-prices-Chromium-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-prices-Chromium-linux.txt
index 6da5a0a77..855b0ae04 100644
--- a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-prices-Chromium-linux.txt
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-prices-Chromium-linux.txt
@@ -1,5 +1,5 @@
-subtotal: $10
-tax: $0
-discount: $0
-total: $10/mo
+subtotal: $4000
+tax: $0000
+discount: $0000
+total: $4000/mo
forever
\ No newline at end of file
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-prices-Firefox-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-prices-Firefox-linux.txt
new file mode 100644
index 000000000..855b0ae04
--- /dev/null
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-prices-Firefox-linux.txt
@@ -0,0 +1,5 @@
+subtotal: $4000
+tax: $0000
+discount: $0000
+total: $4000/mo
+forever
\ No newline at end of file
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-prices-WebKit-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-prices-WebKit-linux.txt
new file mode 100644
index 000000000..b95e0f69a
--- /dev/null
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-monthly-prices-WebKit-linux.txt
@@ -0,0 +1,5 @@
+subtotal: $4000
+tax: $0000
+discount: $0000
+total: $4000/mo
+forever
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-discounted-prices-Chromium-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-discounted-prices-Chromium-linux.txt
index 7bb226011..c0561f6db 100644
--- a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-discounted-prices-Chromium-linux.txt
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-discounted-prices-Chromium-linux.txt
@@ -1,5 +1,5 @@
-subtotal: ₹4070
-tax: ₹740
-discount: -₹720
-total: ₹4080
-first year then ₹4800/yr
\ No newline at end of file
+subtotal: ₹4000000
+tax: ₹700000
+discount: -₹700000
+total: ₹4000000
+first year then ₹4000000/yr
\ No newline at end of file
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-discounted-prices-Firefox-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-discounted-prices-Firefox-linux.txt
new file mode 100644
index 000000000..c0561f6db
--- /dev/null
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-discounted-prices-Firefox-linux.txt
@@ -0,0 +1,5 @@
+subtotal: ₹4000000
+tax: ₹700000
+discount: -₹700000
+total: ₹4000000
+first year then ₹4000000/yr
\ No newline at end of file
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-discounted-prices-WebKit-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-discounted-prices-WebKit-linux.txt
new file mode 100644
index 000000000..ca5b21965
--- /dev/null
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-discounted-prices-WebKit-linux.txt
@@ -0,0 +1,5 @@
+subtotal: ₹4000000
+tax: ₹700000
+discount: -₹700000
+total: ₹4000000
+first year then ₹4000000/yr
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-prices-Chromium-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-prices-Chromium-linux.txt
index 35b33c0ca..6229c18fc 100644
--- a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-prices-Chromium-linux.txt
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-prices-Chromium-linux.txt
@@ -1,5 +1,5 @@
-subtotal: ₹4070
-tax: ₹740
-discount: ₹0
-total: ₹4800/yr
+subtotal: ₹4000000
+tax: ₹700000
+discount: ₹0000
+total: ₹4000000/yr
forever
\ No newline at end of file
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-prices-Firefox-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-prices-Firefox-linux.txt
new file mode 100644
index 000000000..6229c18fc
--- /dev/null
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-prices-Firefox-linux.txt
@@ -0,0 +1,5 @@
+subtotal: ₹4000000
+tax: ₹700000
+discount: ₹0000
+total: ₹4000000/yr
+forever
\ No newline at end of file
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-prices-WebKit-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-prices-WebKit-linux.txt
new file mode 100644
index 000000000..1a2edfe51
--- /dev/null
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-IN-prices-WebKit-linux.txt
@@ -0,0 +1,5 @@
+subtotal: ₹4000000
+tax: ₹700000
+discount: ₹0000
+total: ₹4000000/yr
+forever
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-discounted-prices-Chromium-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-discounted-prices-Chromium-linux.txt
index 0944b8aa8..056911535 100644
--- a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-discounted-prices-Chromium-linux.txt
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-discounted-prices-Chromium-linux.txt
@@ -1,5 +1,5 @@
-subtotal: $50
-tax: $0
-discount: -$10
-total: $50
-first year then $50/yr
\ No newline at end of file
+subtotal: $40000
+tax: $0000
+discount: -$7000
+total: $40000
+first year then $40000/yr
\ No newline at end of file
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-discounted-prices-Firefox-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-discounted-prices-Firefox-linux.txt
new file mode 100644
index 000000000..056911535
--- /dev/null
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-discounted-prices-Firefox-linux.txt
@@ -0,0 +1,5 @@
+subtotal: $40000
+tax: $0000
+discount: -$7000
+total: $40000
+first year then $40000/yr
\ No newline at end of file
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-discounted-prices-WebKit-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-discounted-prices-WebKit-linux.txt
new file mode 100644
index 000000000..06761934c
--- /dev/null
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-discounted-prices-WebKit-linux.txt
@@ -0,0 +1,5 @@
+subtotal: $40000
+tax: $0000
+discount: -$7000
+total: $40000
+first year then $40000/yr
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-prices-Chromium-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-prices-Chromium-linux.txt
index 46d69a7aa..a5b5a89e9 100644
--- a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-prices-Chromium-linux.txt
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-prices-Chromium-linux.txt
@@ -1,5 +1,5 @@
-subtotal: $50
-tax: $0
-discount: $0
-total: $50/yr
+subtotal: $40000
+tax: $0000
+discount: $0000
+total: $40000/yr
forever
\ No newline at end of file
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-prices-Firefox-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-prices-Firefox-linux.txt
new file mode 100644
index 000000000..a5b5a89e9
--- /dev/null
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-prices-Firefox-linux.txt
@@ -0,0 +1,5 @@
+subtotal: $40000
+tax: $0000
+discount: $0000
+total: $40000/yr
+forever
\ No newline at end of file
diff --git a/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-prices-WebKit-linux.txt b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-prices-WebKit-linux.txt
new file mode 100644
index 000000000..b80dd2c95
--- /dev/null
+++ b/apps/web/__e2e__/checkout.test.js-snapshots/checkout-yearly-prices-WebKit-linux.txt
@@ -0,0 +1,5 @@
+subtotal: $40000
+tax: $0000
+discount: $0000
+total: $40000/yr
+forever
diff --git a/apps/web/__e2e__/editor.test.js b/apps/web/__e2e__/editor.test.js
index b30c1fd7e..7203a4626 100644
--- a/apps/web/__e2e__/editor.test.js
+++ b/apps/web/__e2e__/editor.test.js
@@ -251,7 +251,7 @@ test.skip("last line doesn't get saved if it's font is different", async () => {
expect(content).toMatchSnapshot(`last-line-with-different-font.txt`);
});
-test("editing a note and switching immediately to another note and making an edit shouldn't overlap both notes", async ({
+test.only("editing a note and switching immediately to another note and making an edit shouldn't overlap both notes", async ({
page
}) => {
await createNoteAndCheckPresence({
@@ -270,13 +270,11 @@ test("editing a note and switching immediately to another note and making an edi
for (let i = 0; i < 10; ++i) {
await page.click(selector2);
- await editNote(null, `Test note 1 (${i}) `, true);
+ await editNote(null, `Test note 1 (${i}) `);
- await page.click(selector1);
-
- await editNote(null, `Test note 2 (${i})`, true);
+ await page.click(selector2);
- await page.waitForTimeout(100);
+ await editNote(null, `Test note 2 (${i})`);
}
await page.click(selector1);
@@ -310,9 +308,11 @@ test("editing a note and switching immediately to another note and editing the t
for (let i = 0; i < 10; ++i) {
await page.click(selector2);
- await editNote(`Test note 2 (${i})`, null, true);
+ await editNote(`Test note 1 (${i})`, null, true);
- await page.click(selector1);
+ await page.waitForTimeout(100);
+
+ await page.click(selector2);
await editNote(`Test note 2 (${i})`, null, true);
diff --git a/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-1-Firefox-linux.txt b/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-1-Firefox-linux.txt
new file mode 100644
index 000000000..c5c3d9a70
--- /dev/null
+++ b/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-1-Firefox-linux.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.js-snapshots/fast-switch-and-edit-note-1-WebKit-linux.txt b/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-1-WebKit-linux.txt
new file mode 100644
index 000000000..c5c3d9a70
--- /dev/null
+++ b/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-1-WebKit-linux.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.js-snapshots/fast-switch-and-edit-note-2-Firefox-linux.txt b/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-2-Firefox-linux.txt
new file mode 100644
index 000000000..0365eeded
--- /dev/null
+++ b/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-2-Firefox-linux.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.js-snapshots/fast-switch-and-edit-note-2-WebKit-linux.txt b/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-2-WebKit-linux.txt
new file mode 100644
index 000000000..0365eeded
--- /dev/null
+++ b/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-2-WebKit-linux.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.js-snapshots/fast-switch-and-edit-note-title-1-Chromium-linux.txt b/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-title-1-Chromium-linux.txt
index c8a4b6fd3..3dbe7be90 100644
--- a/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-title-1-Chromium-linux.txt
+++ b/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-title-1-Chromium-linux.txt
@@ -1 +1 @@
-Test note 2 (9)
\ No newline at end of file
+Test note 1 (9)
\ No newline at end of file
diff --git a/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-title-1-Firefox-linux.txt b/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-title-1-Firefox-linux.txt
index c8a4b6fd3..3dbe7be90 100644
--- a/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-title-1-Firefox-linux.txt
+++ b/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-title-1-Firefox-linux.txt
@@ -1 +1 @@
-Test note 2 (9)
\ No newline at end of file
+Test note 1 (9)
\ No newline at end of file
diff --git a/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-title-1-WebKit-linux.txt b/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-title-1-WebKit-linux.txt
index f9d2c80fb..3dbe7be90 100644
--- a/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-title-1-WebKit-linux.txt
+++ b/apps/web/__e2e__/editor.test.js-snapshots/fast-switch-and-edit-note-title-1-WebKit-linux.txt
@@ -1 +1 @@
-Test note 2 (8)
\ No newline at end of file
+Test note 1 (9)
\ No newline at end of file
diff --git a/apps/web/__e2e__/editor.test.js-snapshots/readonly-edited-note-Firefox-linux.txt b/apps/web/__e2e__/editor.test.js-snapshots/readonly-edited-note-Firefox-linux.txt
new file mode 100644
index 000000000..8fdeb8f1c
--- /dev/null
+++ b/apps/web/__e2e__/editor.test.js-snapshots/readonly-edited-note-Firefox-linux.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__/editor.test.js-snapshots/readonly-edited-note-WebKit-linux.txt b/apps/web/__e2e__/editor.test.js-snapshots/readonly-edited-note-WebKit-linux.txt
new file mode 100644
index 000000000..8fdeb8f1c
--- /dev/null
+++ b/apps/web/__e2e__/editor.test.js-snapshots/readonly-edited-note-WebKit-linux.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__/notehistory.test.js b/apps/web/__e2e__/notehistory.test.js
index 8bb3797f7..982196880 100644
--- a/apps/web/__e2e__/notehistory.test.js
+++ b/apps/web/__e2e__/notehistory.test.js
@@ -63,12 +63,16 @@ test("switching sessions should change editor content", async () => {
await page.click(List.new("session").atIndex(1).build());
+ await page.waitForTimeout(500);
+
expect(await getEditorContent()).toBe(NOTE.content);
await page.click(getTestId("properties"));
await page.click(List.new("session").atIndex(0).build());
+ await page.waitForTimeout(500);
+
expect(await getEditorContent()).toBe(`Some edited text.${NOTE.content}`);
});
@@ -79,10 +83,14 @@ test("cancelling session restore should bring editor content back to original",
await page.click(List.new("session").atIndex(1).build());
+ await page.waitForTimeout(500);
+
expect(await getEditorContent()).toBe(NOTE.content);
await page.click(getTestId("editor-notice-cancel"));
+ await page.waitForTimeout(500);
+
expect(await getEditorContent()).toBe(`Some edited text.${NOTE.content}`);
});
@@ -93,10 +101,14 @@ test("restoring a session should change note's content", async () => {
await page.click(List.new("session").atIndex(1).build());
+ await page.waitForTimeout(500);
+
expect(await getEditorContent()).toBe(NOTE.content);
await page.click(getTestId("editor-notice-action"));
+ await page.waitForTimeout(500);
+
expect(await getEditorContent()).toBe(NOTE.content);
await page.click(getTestId("notes-action-button"));
diff --git a/apps/web/__e2e__/notes.test.js b/apps/web/__e2e__/notes.test.js
index 839156597..e46528a5f 100644
--- a/apps/web/__e2e__/notes.test.js
+++ b/apps/web/__e2e__/notes.test.js
@@ -401,6 +401,8 @@ test.describe("run tests independently", () => {
await lockUnlockNote(noteSelector, "unlock");
+ await page.waitForTimeout(1000);
+
await expect(
isAbsent(List.new("note").grouped().atIndex(0).locked().build())
).resolves.toBeTruthy();
diff --git a/apps/web/__e2e__/notes.test.js-snapshots/export-html-Firefox-linux.txt b/apps/web/__e2e__/notes.test.js-snapshots/export-html-Firefox-linux.txt
index 37d8c31e6..69f5d5dfa 100644
--- a/apps/web/__e2e__/notes.test.js-snapshots/export-html-Firefox-linux.txt
+++ b/apps/web/__e2e__/notes.test.js-snapshots/export-html-Firefox-linux.txt
@@ -11,7 +11,7 @@
</head>
<body>
<h1>Test 1</h1>
- <p dir="ltr">This is Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1</p>
+ <p dir="ltr" data-spacing="double">This is Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1</p>
<br/>
Created on: <b>xxx</b><br/>
Edited on: <b>xxx</b>
diff --git a/apps/web/__e2e__/notes.test.js-snapshots/export-html-WebKit-linux.txt b/apps/web/__e2e__/notes.test.js-snapshots/export-html-WebKit-linux.txt
index 37d8c31e6..69f5d5dfa 100644
--- a/apps/web/__e2e__/notes.test.js-snapshots/export-html-WebKit-linux.txt
+++ b/apps/web/__e2e__/notes.test.js-snapshots/export-html-WebKit-linux.txt
@@ -11,7 +11,7 @@
</head>
<body>
<h1>Test 1</h1>
- <p dir="ltr">This is Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1</p>
+ <p dir="ltr" data-spacing="double">This is Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1</p>
<br/>
Created on: <b>xxx</b><br/>
Edited on: <b>xxx</b>
diff --git a/apps/web/__e2e__/tags.test.js b/apps/web/__e2e__/tags.test.js
index d76f31d98..885133417 100644
--- a/apps/web/__e2e__/tags.test.js
+++ b/apps/web/__e2e__/tags.test.js
@@ -192,6 +192,8 @@ test("create a shortcut of a tag", async ({ page }) => {
await clickMenuItem("shortcut");
});
+ await page.waitForTimeout(1000);
+
expect(
await page.isVisible(new Menu("navitem").item("helloworld").build())
).toBe(true);
diff --git a/apps/web/playwright.config.js b/apps/web/playwright.config.js
index 554571a1a..4734ce416 100644
--- a/apps/web/playwright.config.js
+++ b/apps/web/playwright.config.js
@@ -25,9 +25,15 @@ const projects = IS_CI
name: "Firefox",
use: { browserName: "firefox" }
},
+ // {
+ // name: "WebKit",
+ // use: { browserName: "webkit" }
+ // },
{
- name: "WebKit",
- use: { browserName: "webkit" }
+ name: "Chromium",
+ use: {
+ browserName: "chromium"
+ }
}
]
: [
@@ -39,12 +45,12 @@ const projects = IS_CI
}
// {
// name: "Firefox",
- // use: { browserName: "firefox" },
+ // use: { browserName: "firefox" }
// },
// {
// name: "WebKit",
- // use: { browserName: "webkit" },
- // },
+ // use: { browserName: "webkit" }
+ // }
];
module.exports = {
@@ -58,10 +64,11 @@ module.exports = {
testDir: "__e2e__",
// Each test is given 30 seconds
- timeout: 30000,
- workers: IS_CI ? 3 : 4,
+ timeout: 45000,
+ workers: IS_CI ? 3 : 6,
reporter: "list",
- retries: IS_CI ? 3 : 0,
+ retries: IS_CI ? 1 : 0,
+ fullyParallel: true,
use: {
headless: true,
acceptDownloads: true,
diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js
index 5b3d2c8dd..c6f619fa5 100644
--- a/apps/web/src/stores/editor-store.js
+++ b/apps/web/src/stores/editor-store.js
@@ -141,7 +141,7 @@ class EditorStore extends BaseStore {
saveSession = async (sessionId, session) => {
const currentSession = this.get().session;
if (currentSession.readonly && session.readonly !== false) return; // do not allow saving of readonly session
- if (currentSession.saveState === 0 || (currentSession.id && !sessionId))
+ if (currentSession.saveState === 0 && !currentSession.id && !sessionId)
return;
this.setSaveState(0);
@@ -325,3 +325,7 @@ class EditorStore extends BaseStore {
*/
const [useStore, store] = createStore(EditorStore);
export { useStore, store, SESSION_STATES };
+
+function delay(ms) {
+ return new Promise((resolve) => setTimeout(resolve, ms));
+}