Skip to content

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

add some basic tests

ammarahm-edd7e70655a737
diff --git a/apps/mobile/e2e/firstTest.e2e.js b/apps/mobile/e2e/firstTest.e2e.js
index 93cfacba9..ac7564883 100644
--- a/apps/mobile/e2e/firstTest.e2e.js
+++ b/apps/mobile/e2e/firstTest.e2e.js
@@ -1,10 +1,12 @@
-
- it('app loaded', async () => {
- await expect(element(by.id('mobile_main_view'))).toBeVisible();
- })
-
- it('open_editor', async () => {
- await expect(element(by.id('mobile_main_view'))).toBeVisible();
- })
-
-
+const {sleep} = require('./utils');
+
+it('Check if app is loaded', async () => {
+ await expect(element(by.id('mobile_main_view'))).toBeVisible();
+});
+
+it('Check if editor can be opened', async () => {
+ await expect(element(by.id('container_bottom_btn_text'))).toBeVisible();
+ await element(by.id('container_bottom_btn')).tap();
+ await sleep(2000);
+ await expect(element(by.id('editor'))).toBeVisible();
+});
diff --git a/apps/mobile/e2e/utils/index.js b/apps/mobile/e2e/utils/index.js
new file mode 100644
index 000000000..307f85d91
--- /dev/null
+++ b/apps/mobile/e2e/utils/index.js
@@ -0,0 +1,3 @@
+
+ export const sleep = duration =>
+ new Promise(resolve => setTimeout(() => resolve(), duration));
\ No newline at end of file
diff --git a/apps/mobile/index.mobile.js b/apps/mobile/index.mobile.js
index a74bbe95e..8e6317e1d 100644
--- a/apps/mobile/index.mobile.js
+++ b/apps/mobile/index.mobile.js
@@ -38,6 +38,7 @@ export const Initialize = () => {
return (
<>
<Animatable.View
+ testID={"mobile_main_view"}
transition="backgroundColor"
duration={300}
style={{
diff --git a/apps/mobile/src/components/Container/ContainerBottomButton.js b/apps/mobile/src/components/Container/ContainerBottomButton.js
index ce21a7364..3c408e26d 100644
--- a/apps/mobile/src/components/Container/ContainerBottomButton.js
+++ b/apps/mobile/src/components/Container/ContainerBottomButton.js
@@ -58,6 +58,7 @@ export const ContainerBottomButton = ({root}) => {
],
}}>
<PressableButton
+ testID={"container_bottom_btn"}
color={
containerBottomButton.color
? containerBottomButton.color
@@ -92,6 +93,7 @@ export const ContainerBottomButton = ({root}) => {
size={SIZE.xl}
/>
<Text
+ testID="container_bottom_btn_text"
style={{
fontSize: SIZE.md,
color: 'white',
diff --git a/apps/mobile/src/components/MoveNoteDialog/index.js b/apps/mobile/src/components/MoveNoteDialog/index.js
index 9a3c22bf1..c12f2659e 100644
--- a/apps/mobile/src/components/MoveNoteDialog/index.js
+++ b/apps/mobile/src/components/MoveNoteDialog/index.js
@@ -356,7 +356,7 @@ const MoveNoteDialog = () => {
onPress={async () => {
let noteIds = [];
selectedItemsList.forEach((i) => noteIds.push(i.id));
-
+
let res = await db.notes.move(
{
topic: item.title,
diff --git a/apps/mobile/src/components/PressableButton/index.js b/apps/mobile/src/components/PressableButton/index.js
index 47574a674..792ea8e05 100644
--- a/apps/mobile/src/components/PressableButton/index.js
+++ b/apps/mobile/src/components/PressableButton/index.js
@@ -14,10 +14,12 @@ export const PressableButton = ({
alpha = -0.1,
opacity = 1,
onLongPress,
- hitSlop
+ hitSlop,
+ testID
}) => {
return (
<Pressable
+ testID={testID}
hitSlop={hitSlop}
activeOpacity={opacity}
onPress={onPress}
diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.js
index b1cb84769..42a3785b7 100755
--- a/apps/mobile/src/views/Editor/index.js
+++ b/apps/mobile/src/views/Editor/index.js
@@ -263,6 +263,7 @@ const Editor = ({noMenu}) => {
</View>
<WebView
+ testID="editor"
ref={EditorWebView}
onError={(error) => console.log(error)}
onLoad={() => onWebViewLoad(noMenu, premium, colors)}