From 2a8ec8245fb2db02eedfb6dcf7568ec5048b8c67 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Wed, 17 Dec 2025 13:01:33 +0500 Subject: [PATCH] mobile: fix e2e tests --- apps/mobile/.detoxrc.js | 4 +- .../app/components/dialog/base-dialog.tsx | 10 +-- .../app/components/dialogs/vault/index.jsx | 76 +++++++++---------- apps/mobile/app/screens/notebook/index.tsx | 6 +- apps/mobile/e2e/tests/note.e2e.ts | 2 +- apps/mobile/e2e/tests/notebook.e2e.ts | 6 +- apps/mobile/e2e/tests/sort.e2e.ts | 2 +- apps/mobile/e2e/tests/utils.ts | 6 +- apps/mobile/e2e/tests/vault.e2e.ts | 4 +- apps/mobile/package-lock.json | 12 +-- apps/mobile/package.json | 2 +- .../react-native-gesture-handler+2.28.0.patch | 12 +++ 12 files changed, 80 insertions(+), 62 deletions(-) create mode 100644 apps/mobile/patches/react-native-gesture-handler+2.28.0.patch diff --git a/apps/mobile/.detoxrc.js b/apps/mobile/.detoxrc.js index 10bff8800..5bb53788f 100644 --- a/apps/mobile/.detoxrc.js +++ b/apps/mobile/.detoxrc.js @@ -47,7 +47,7 @@ module.exports = { simulator: { type: "ios.simulator", device: { - type: "iPhone 12" + type: "iPhone 17 Pro Max" } }, attached: { @@ -59,7 +59,7 @@ module.exports = { emulator: { type: "android.emulator", device: { - avdName: "Pixel_5_API_34" + avdName: "Pixel_5_API_36" } } }, diff --git a/apps/mobile/app/components/dialog/base-dialog.tsx b/apps/mobile/app/components/dialog/base-dialog.tsx index f863b39b1..03cad8d60 100644 --- a/apps/mobile/app/components/dialog/base-dialog.tsx +++ b/apps/mobile/app/components/dialog/base-dialog.tsx @@ -136,12 +136,12 @@ const BaseDialog = ({ backgroundColor: background ? background : transparent - ? "transparent" - : "rgba(0,0,0,0.3)" + ? "transparent" + : "rgba(0,0,0,0.3)" }} > diff --git a/apps/mobile/app/components/dialogs/vault/index.jsx b/apps/mobile/app/components/dialogs/vault/index.jsx index 8e4458cf3..291085eb6 100644 --- a/apps/mobile/app/components/dialogs/vault/index.jsx +++ b/apps/mobile/app/components/dialogs/vault/index.jsx @@ -96,22 +96,22 @@ export class VaultDialog extends Component { this.title = !this.state.novault ? strings.createVault() : this.state.fingerprintAccess - ? strings.vaultFingerprintUnlock() - : this.state.revokeFingerprintAccess - ? strings.revokeVaultFingerprintUnlock() - : this.state.changePassword - ? strings.changeVaultPassword() - : this.state.noteLocked - ? this.state.deleteNote - ? strings.deleteNote() - : this.state.share - ? strings.shareNote() - : this.state.copyNote - ? strings.copyNote() - : this.state.goToEditor - ? strings.goToEditor() - : strings.goToEditor() - : strings.lockNote(); + ? strings.vaultFingerprintUnlock() + : this.state.revokeFingerprintAccess + ? strings.revokeVaultFingerprintUnlock() + : this.state.changePassword + ? strings.changeVaultPassword() + : this.state.noteLocked + ? this.state.deleteNote + ? strings.deleteNote() + : this.state.share + ? strings.shareNote() + : this.state.copyNote + ? strings.copyNote() + : this.state.goToEditor + ? strings.goToEditor() + : strings.goToEditor() + : strings.lockNote(); } componentDidMount() { @@ -337,12 +337,13 @@ export class VaultDialog extends Component { ); }); } - eSendEvent("vaultUpdated"); this.setState({ loading: false }); - this.close(); + setTimeout(() => { + this.close(); + }, 100); } else { ToastManager.show({ heading: strings.passwordIncorrect(), @@ -353,9 +354,6 @@ export class VaultDialog extends Component { } catch (e) { console.error(e); } - this.setState({ - loading: false - }); }; clearVault = async () => { @@ -874,24 +872,24 @@ export class VaultDialog extends Component { deleteVault ? strings.delete() : clearVault - ? strings.clear() - : fingerprintAccess - ? strings.enable() - : this.state.revokeFingerprintAccess - ? strings.revoke() - : changePassword - ? strings.change() - : this.state.noteLocked - ? deleteNote - ? strings.delete() - : share - ? strings.share() - : goToEditor - ? strings.open() - : strings.unlock() - : !note.id - ? strings.create() - : strings.lock() + ? strings.clear() + : fingerprintAccess + ? strings.enable() + : this.state.revokeFingerprintAccess + ? strings.revoke() + : changePassword + ? strings.change() + : this.state.noteLocked + ? deleteNote + ? strings.delete() + : share + ? strings.share() + : goToEditor + ? strings.open() + : strings.unlock() + : !note.id + ? strings.create() + : strings.lock() } /> diff --git a/apps/mobile/app/screens/notebook/index.tsx b/apps/mobile/app/screens/notebook/index.tsx index de6c2e043..dfae3fe40 100644 --- a/apps/mobile/app/screens/notebook/index.tsx +++ b/apps/mobile/app/screens/notebook/index.tsx @@ -217,12 +217,12 @@ const NotebookScreen = ({ route, navigation }: NavigationProps<"Notebook">) => { position: "absolute", bottom: 20, right: 20, - gap: DefaultAppStyles.GAP_VERTICAL, alignItems: "center" }} > { Notebooks.present(params.current.item); @@ -230,7 +230,8 @@ const NotebookScreen = ({ route, navigation }: NavigationProps<"Notebook">) => { style={{ position: "relative", right: 0, - bottom: 5 + bottom: 0, + paddingBottom: 10 }} /> ) => { alwaysVisible style={{ position: "relative", + paddingTop: 10, right: 0, bottom: 0 }} diff --git a/apps/mobile/e2e/tests/note.e2e.ts b/apps/mobile/e2e/tests/note.e2e.ts index 19b79e319..c59cf2ec1 100644 --- a/apps/mobile/e2e/tests/note.e2e.ts +++ b/apps/mobile/e2e/tests/note.e2e.ts @@ -134,7 +134,7 @@ describe("NOTE TESTS", () => { .run(); }); - it("Assign colors to a note", async () => { + it.only("Assign colors to a note", async () => { await TestBuilder.create() .prepare() .createNote() diff --git a/apps/mobile/e2e/tests/notebook.e2e.ts b/apps/mobile/e2e/tests/notebook.e2e.ts index 0e25fdb5f..176166346 100644 --- a/apps/mobile/e2e/tests/notebook.e2e.ts +++ b/apps/mobile/e2e/tests/notebook.e2e.ts @@ -121,7 +121,7 @@ describe("NOTEBOOKS", () => { .run(); }); - it.only("Remove note from notebook", async () => { + it("Remove note from notebook", async () => { await TestBuilder.create() .prepare() .openSideMenu() @@ -138,7 +138,8 @@ describe("NOTEBOOKS", () => { .longPressByText(note.body) .wait(500) .waitAndTapById("select-minus") - .isNotVisibleById(note.title) + .wait(500) + .isNotVisibleByText(note.body) .run(); }) .run(); @@ -199,6 +200,7 @@ describe("NOTEBOOKS", () => { .longPressByText("Notebook 1") .wait(500) .waitAndTapByText("Move to trash") + .wait(500) .waitAndTapByText("Delete") .waitAndTapById("tab-home") .waitAndTapByText("Trash") diff --git a/apps/mobile/e2e/tests/sort.e2e.ts b/apps/mobile/e2e/tests/sort.e2e.ts index 2fa37c340..b74b62669 100644 --- a/apps/mobile/e2e/tests/sort.e2e.ts +++ b/apps/mobile/e2e/tests/sort.e2e.ts @@ -34,7 +34,7 @@ describe("Sort & filter", () => { .element(by.web.className("ProseMirror")) .typeText("Edited ", true); }) - .pressBack() + .pressBack(2) .waitAndTapById("icon-sort") .wait(500) .waitAndTapByText("Date created") diff --git a/apps/mobile/e2e/tests/utils.ts b/apps/mobile/e2e/tests/utils.ts index 05d7fbce6..f124e5182 100644 --- a/apps/mobile/e2e/tests/utils.ts +++ b/apps/mobile/e2e/tests/utils.ts @@ -32,7 +32,10 @@ const testvars = { class Element { element: Detox.NativeElement; - constructor(public type: "id" | "text", public value: string) { + constructor( + public type: "id" | "text", + public value: string + ) { if (type == "id") { this.element = element(by.id(value)).atIndex(0); } else { @@ -135,6 +138,7 @@ const Tests = { ); await titleInput.isVisible(); await titleInput.element.typeText(title); + await Tests.sleep(1000); if (description) { await Tests.fromId( notesnook.ids.dialogs.notebook.inputs.description diff --git a/apps/mobile/e2e/tests/vault.e2e.ts b/apps/mobile/e2e/tests/vault.e2e.ts index 4704aafa3..690ac9f31 100644 --- a/apps/mobile/e2e/tests/vault.e2e.ts +++ b/apps/mobile/e2e/tests/vault.e2e.ts @@ -84,7 +84,7 @@ describe("VAULT", () => { .run(); }); - it.only("Change vault password", async () => { + it("Change vault password", async () => { await TestBuilder.create() .prepare() .createNote() @@ -94,7 +94,7 @@ describe("VAULT", () => { .typeTextById(notesnook.ids.dialogs.vault.pwd, "1234") .typeTextById(notesnook.ids.dialogs.vault.changePwd, "2362") .waitAndTapByText("Change") - .pressBack(3) + .pressBack(4) .addStep(async () => await openLockedNote("2362")) .run(); }); diff --git a/apps/mobile/package-lock.json b/apps/mobile/package-lock.json index 42af91cdd..f9c14b8d9 100644 --- a/apps/mobile/package-lock.json +++ b/apps/mobile/package-lock.json @@ -1,12 +1,12 @@ { "name": "@notesnook/mobile", - "version": "3.3.10-beta.5", + "version": "3.3.10-beta.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@notesnook/mobile", - "version": "3.3.10-beta.5", + "version": "3.3.10-beta.6", "hasInstallScript": true, "license": "GPL-3.0-or-later", "dependencies": { @@ -16,7 +16,7 @@ "@ammarahmed/react-native-fingerprint-scanner": "^5.0.1", "@ammarahmed/react-native-share-extension": "^2.9.5", "@ammarahmed/react-native-sodium": "^1.6.8", - "@ammarahmed/react-native-upload": "^6.28.0", + "@ammarahmed/react-native-upload": "^6.29.0", "@azure/core-asynciterator-polyfill": "^1.0.2", "@bam.tech/react-native-image-resizer": "3.0.11", "@callstack/repack": "~5.2.1", @@ -533,9 +533,9 @@ "license": "ISC" }, "node_modules/@ammarahmed/react-native-upload": { - "version": "6.28.0", - "resolved": "https://registry.npmjs.org/@ammarahmed/react-native-upload/-/react-native-upload-6.28.0.tgz", - "integrity": "sha512-0cU6ulbJB2s9KgV2QlQ91//YZ+K5USlKjM6CW9fDHFcGn+Td3tFWB0atnplP35Ih+HeOnYL9t1MuNG4vNzjoFw==", + "version": "6.29.0", + "resolved": "https://registry.npmjs.org/@ammarahmed/react-native-upload/-/react-native-upload-6.29.0.tgz", + "integrity": "sha512-k2FJAVR4Nohx4VhfgHuXzLXQpgEnco/PAv9R080X7oY3O12DTgY0ruDvOFwvQGFW0PDIHlXfLfUiMq2kZc/k1A==", "license": "BSD-3-Clause", "peerDependencies": { "react": "*", diff --git a/apps/mobile/package.json b/apps/mobile/package.json index b6100ead8..ef93a7895 100644 --- a/apps/mobile/package.json +++ b/apps/mobile/package.json @@ -32,7 +32,7 @@ "@ammarahmed/react-native-fingerprint-scanner": "^5.0.1", "@ammarahmed/react-native-share-extension": "^2.9.5", "@ammarahmed/react-native-sodium": "^1.6.8", - "@ammarahmed/react-native-upload": "^6.28.0", + "@ammarahmed/react-native-upload": "^6.29.0", "@azure/core-asynciterator-polyfill": "^1.0.2", "@bam.tech/react-native-image-resizer": "3.0.11", "@callstack/repack": "~5.2.1", diff --git a/apps/mobile/patches/react-native-gesture-handler+2.28.0.patch b/apps/mobile/patches/react-native-gesture-handler+2.28.0.patch new file mode 100644 index 000000000..c0fa890da --- /dev/null +++ b/apps/mobile/patches/react-native-gesture-handler+2.28.0.patch @@ -0,0 +1,12 @@ +diff --git a/node_modules/react-native-gesture-handler/android/build.gradle b/node_modules/react-native-gesture-handler/android/build.gradle +index ac149a0..37f620c 100644 +--- a/node_modules/react-native-gesture-handler/android/build.gradle ++++ b/node_modules/react-native-gesture-handler/android/build.gradle +@@ -187,6 +187,7 @@ android { + exclude "**/libreactnative.so" + exclude "**/libjsi.so" + exclude "**/libc++_shared.so" ++ exclude "**/libfbjni.so" + } + + sourceSets.main {