Skip to content

Commit c882d2a

Browse files
committed
Add more tests
1 parent 708adb4 commit c882d2a

File tree

7 files changed

+105
-16
lines changed

7 files changed

+105
-16
lines changed

maestro/Precondition.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ appId: "${APP_ID}"
77
clearState: true
88
permissions:
99
camera: allow
10+
notifications: allow
1011
- extendedWaitUntil:
1112
visible: "Widgets menu"
1213
timeout: 180000 # A long timeout since app startup is quite unstable due to resources when executed on Github runners

maestro/run_maestro_tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ if [ ${#failed_tests[@]} -gt 0 ]; then
4545
exit 1 # Mark the workflow stage as failed if any tests fail
4646
else
4747
echo "All tests passed!"
48-
exit 0 # Mark the workflow stage as successful if no failed tests
48+
exit 0 # Mark the workflow stage as successful only if all tests pass
4949
fi

maestro/run_maestro_tests_local.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
# Update DEVICE_ID and path to the yaml file according to needs
44

55
if [ "$1" == "android" ]; then
6-
APP_ID="com.mendix.nativetemplate"
6+
APP_ID="myapp.nativecomponentstestproject"
77
DEVICE_ID="emulator-5554"
88
elif [ "$1" == "ios" ]; then
9-
APP_ID="com.mendix.native.template"
9+
APP_ID="myapp.nativecomponentstestproject"
1010
DEVICE_ID="8006E26A-352B-4553-BA00-D8AE2DE23313"
1111
else
1212
echo "Usage: $0 [android|ios]"
1313
exit 1
1414
fi
1515

16-
maestro --device $DEVICE_ID test --env APP_ID=$APP_ID ../packages/pluggableWidgets/safe-area-view-native/e2e/specs/maestro/SafeAreaViewMaps.yaml
16+
maestro --device $DEVICE_ID test --env APP_ID=$APP_ID ../packages/pluggableWidgets/bar-chart-native/e2e/specs/maestro/Bar_Chart.yaml

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
"setup-android": "node ./detox/scripts/setup-android.js",
3535
"setup-ios": "node ./detox/scripts/setup-ios.js",
3636
"patch-package": "sh ./scripts/patch/patch-package.sh",
37-
"build:widgets": "node ./scripts/widget/buildWidgets.js"
37+
"build:widgets": "node ./scripts/widget/buildWidgets.js",
38+
"test:maestro:ios": "bash maestro/run_maestro_tests.sh ios",
39+
"test:maestro:android": "bash maestro/run_maestro_tests.sh android"
3840
},
3941
"workspaces": {
4042
"packages": [
@@ -79,6 +81,8 @@
7981
"lint-staged": "^10.5.4",
8082
"mendix-client": "^7.15.8",
8183
"patch-package": "^8.0.0",
84+
"pixelmatch": "^5.2.1",
85+
"pngjs": "^6.0.0",
8286
"prettier": "^2.8.8",
8387
"pretty-quick": "^3.3.1",
8488
"react-dom": "18.2.0",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
appId: "${APP_ID}"
2+
---
3+
- runFlow:
4+
file: "../../../../../../../maestro/Precondition.yaml"
5+
- tapOn:
6+
point: "37%,94%"
7+
# Authentication
8+
- tapOn:
9+
text: "Authentication"
10+
- tapOn:
11+
text: "Is biometric authentication supported?"
12+
# - assertVisible:
13+
# text: "Information"
14+
- tapOn:
15+
text: "OK"
16+
- tapOn: "Go back"
17+
18+
19+
# Clipboard
20+
- tapOn:
21+
text: "Clipboard"
22+
- tapOn:
23+
text: "Set clipboard content to 'Hi there'"
24+
- tapOn:
25+
text: "Get clipboard content"
26+
- tapOn: "Go back"
27+
28+
# Network
29+
- tapOn:
30+
text: "Network"
31+
- tapOn:
32+
text: "Is connected?"
33+
- assertVisible:
34+
text: "Information"
35+
- tapOn:
36+
text: "OK"
37+
- tapOn:
38+
text: "Is wifi connected?"
39+
- assertVisible:
40+
text: "Information"
41+
- tapOn:
42+
text: "OK"
43+
- tapOn:
44+
text: "Is cellular connected?"
45+
- assertVisible:
46+
text: "Information"
47+
- tapOn:
48+
text: "OK"
49+
- tapOn: "Go back"
50+
51+
# Notifications
52+
- tapOn:
53+
text: "Notifications"
54+
- tapOn:
55+
text: "Has permission?"
56+
- assertVisible:
57+
text: "Information"
58+
- tapOn:
59+
text: "OK"
60+
- tapOn:
61+
text: "Request permission"
62+
- assertVisible:
63+
text: "Permission was granted"
64+
- tapOn:
65+
text: "OK"
66+
- tapOn:
67+
text: "Display notification"
68+
- assertVisible:
69+
text: "Title"
70+
- tapOn: "Go back"
71+
72+
# Mobile
73+
- tapOn:
74+
text: "Mobile"
75+
- tapOn:
76+
text: "Device info"
77+
- assertVisible:
78+
text: "Device info"
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
appId: "${APP_ID}"
22
---
3-
- runFlow:
4-
file: "../../../../../../maestro/Precondition.yaml"
5-
- tapOn:
6-
text: "B"
7-
- tapOn:
8-
text: "Bar chart"
9-
- assertVisible:
10-
id: "barChart"
11-
- assertVisible:
12-
text: "x-values"
3+
# - runFlow:
4+
# file: "../../../../../../maestro/Precondition.yaml"
5+
# - tapOn:
6+
# text: "B"
7+
# - tapOn:
8+
# text: "Bar chart"
9+
# - assertVisible:
10+
# text: "Bar chart"
11+
- takeScreenshot:
12+
path: "images/actual/bar_chart_actual"
13+
- runScript:
14+
file: "../../../../../../maestro/compareScreenshots.js"
15+
env:
16+
expected: "bar_chart"

yarn.lock

+3-1
Original file line numberDiff line numberDiff line change
@@ -14107,6 +14107,8 @@ __metadata:
1410714107
lint-staged: "npm:^10.5.4"
1410814108
mendix-client: "npm:^7.15.8"
1410914109
patch-package: "npm:^8.0.0"
14110+
pixelmatch: "npm:^5.2.1"
14111+
pngjs: "npm:^6.0.0"
1411014112
prettier: "npm:^2.8.8"
1411114113
pretty-quick: "npm:^3.3.1"
1411214114
react-dom: "npm:18.2.0"
@@ -14975,7 +14977,7 @@ __metadata:
1497514977
languageName: node
1497614978
linkType: hard
1497714979

14978-
"pixelmatch@npm:^5.1.0":
14980+
"pixelmatch@npm:^5.1.0, pixelmatch@npm:^5.2.1":
1497914981
version: 5.3.0
1498014982
resolution: "pixelmatch@npm:5.3.0"
1498114983
dependencies:

0 commit comments

Comments
 (0)