Skip to content

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

web: add test for login & sync

Abdullah Attaf149d6c52348
diff --git a/apps/web/__e2e__/user.test.ts b/apps/web/__e2e__/user.test.ts
index 876f97df0..59b363bd8 100644
--- a/apps/web/__e2e__/user.test.ts
+++ b/apps/web/__e2e__/user.test.ts
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { test, expect } from "@playwright/test";
import { AppModel } from "./models/app.model";
-import { USER } from "./utils";
+import { getTestId, USER } from "./utils";
// async function forceExpireSession() {
// await page.evaluate(() => {
@@ -34,7 +34,8 @@ test("login user", async ({ page }) => {
await app.auth.login(USER.CURRENT);
- expect(await app.isSynced()).toBeTruthy();
+ const settings = await app.goToSettings();
+ expect(await settings.isLoggedIn()).toBeTruthy();
});
test("logout user", async ({ page }) => {
@@ -61,6 +62,20 @@ test("check recovery key of user", async ({ page }) => {
expect(key).toBe(USER.CURRENT.key);
});
+test("login user & wait for sync", async ({ page }, info) => {
+ info.setTimeout(45 * 1000);
+
+ const app = new AppModel(page);
+ await app.auth.goto();
+
+ await app.auth.login(USER.CURRENT);
+
+ await page
+ .locator(getTestId("sync-status-completed"))
+ .waitFor({ state: "visible" });
+ expect(await app.isSynced()).toBeTruthy();
+});
+
// test("login user and change password repeatedly", async ({
// page,
// browserName