Skip to content

Commit 7edabb2

Browse files
copy of reactNativeMockLogin
0 parents  commit 7edabb2

File tree

100 files changed

+11241
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+11241
-0
lines changed

.bundle/config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUNDLE_PATH: "vendor/bundle"
2+
BUNDLE_FORCE_RUBY_PLATFORM: 1

.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native',
4+
};
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: 💬 Build, test and post to slack
2+
on:
3+
push:
4+
branches:
5+
# Typically the corporate site is rarely changing once it's finalised, so we can save on build minutes by only triggering it when we need to.
6+
- main
7+
- fakebranch # Uncomment and set to the branch you want to listen to (ie main)
8+
# Allows you to run this workflow manually from the Actions tab.
9+
workflow_dispatch:
10+
11+
jobs:
12+
13+
# JOB-yarn:
14+
# name: Check build requirements
15+
# runs-on: [self-hosted, brett]
16+
# steps:
17+
# - uses: actions/checkout@v3
18+
# - name: "Install yarn dependencies"
19+
# run: |
20+
# yarn install
21+
22+
JOB-build-app:
23+
name: Build the app
24+
runs-on: [self-hosted, brett]
25+
steps:
26+
- name: Check for a connected Android device
27+
run: |
28+
devices=$(adb devices | grep -v "List of devices attached" | grep -v "^$")
29+
if [ -z "$devices" ]; then
30+
echo "No Android devices were found."
31+
echo "Set it up so you see it when you run ADB devices, and enable debugger/usb on your phone or start an emulator."
32+
echo "Exiting..."
33+
exit 1
34+
else
35+
echo "✅ Found the following connected Android devices:"
36+
echo "$devices"
37+
fi
38+
- uses: actions/checkout@v3
39+
- name: "Build app"
40+
run: |
41+
yarn install
42+
cd android
43+
./gradlew assembleRelease
44+
45+
JOB-test-app:
46+
name: Install and test the app
47+
runs-on: [self-hosted, brett]
48+
needs: JOB-build-app # or alternatively source the APK file to run
49+
timeout-minutes: 5
50+
steps:
51+
52+
- name: "Check for built app"
53+
run: |
54+
pwd
55+
ls -lash android/app/build/outputs/apk/release/app-release.apk
56+
57+
- name: "Install the Application"
58+
run: |
59+
adb install android/app/build/outputs/apk/release/app-release.apk
60+
61+
# Given an android phone, this command does the following:
62+
# Presses the power button, types in the pincode, and presses enter, then presses the home button.
63+
# This is not needed if your phone has no lock, and can save a few seconds.
64+
- name: "Start the phone"
65+
run: |
66+
adb shell input keyevent KEYCODE_MENU && adb shell input text ${{ secrets.PHONE_PIN_CODE }} && adb shell input keyevent KEYCODE_ENTER && adb shell input keyevent KEYCODE_HOME
67+
68+
- name: "Run the test suite"
69+
id: run_tests
70+
# You need to set the below to true, if you want failing steps to still be posted to slack.
71+
# With it off, you will only see successful tests get posted, as processing will stop.
72+
continue-on-error: true
73+
# run: |
74+
# maestro test maestrotests/functionality.yaml
75+
run: |
76+
mkdir -p MaestroTests/TestResults
77+
maestro test --format junit --output MaestroTests/TestResults/report.xml MaestroTests/autorun | tee testresults.txt
78+
exit_status=${PIPESTATUS[0]}
79+
if [ $exit_status -ne 0 ]; then
80+
echo "Error: The command failed with exit status $exit_status"
81+
exit $exit_status
82+
fi
83+
84+
- name: "If the tests failed, save the failure screenshot as well"
85+
if: ${{ steps.run_tests.outcome == 'failure' }}
86+
run: |
87+
echo "The test before has failed, lets save the picture from the test when it errored"
88+
FAILEDTESTLOCATION=$(grep -oE '/[^ ]+/.maestro/tests/[0-9_-]+' testresults.txt)
89+
echo $FAILEDTESTLOCATION
90+
ls -lash $FAILEDTESTLOCATION
91+
if [[ -n "$FAILEDTESTLOCATION" ]]; then
92+
echo "Found failed test folder name: $FAILEDTESTLOCATION"
93+
cp "$FAILEDTESTLOCATION"/*.png MaestroTests/TestResults/
94+
else
95+
echo "No folder specified, skipping check for extra images."
96+
fi
97+
98+
- name: "Info: Check for report file existing"
99+
run: |
100+
ls -lash MaestroTests/TestResults/report.xml
101+
102+
- name: Check test results and post to slack
103+
id: testresults
104+
uses: brett-james-rocketlab/maestro-test-results-to-slack@main
105+
# See the readme.md in the repo for more information on these.
106+
env:
107+
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
108+
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
109+
INTRO_MESSAGE: From Mock login (React Native)
110+
TEST_RESULTS_FOLDER: MaestroTests/TestResults/
111+
112+
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: 🧪 Build, test and process (no posting to slack)
2+
on:
3+
push:
4+
branches:
5+
# Typically the corporate site is rarely changing once it's finalised, so we can save on build minutes by only triggering it when we need to.
6+
- fakebranch # Uncomment and set to the branch you want to listen to (ie main)
7+
# Allows you to run this workflow manually from the Actions tab.
8+
workflow_dispatch:
9+
10+
jobs:
11+
12+
# JOB-yarn:
13+
# name: Check build requirements
14+
# runs-on: [self-hosted, brett]
15+
# steps:
16+
# - uses: actions/checkout@v3
17+
# - name: "Install yarn dependencies"
18+
# run: |
19+
# yarn install
20+
21+
JOB-build-app:
22+
name: Build the app
23+
runs-on: [self-hosted, brett]
24+
steps:
25+
- name: Check for a connected Android device
26+
run: |
27+
devices=$(adb devices | grep -v "List of devices attached" | grep -v "^$")
28+
if [ -z "$devices" ]; then
29+
echo "No Android devices were found."
30+
echo "Set it up so you see it when you run ADB devices, and enable debugger/usb on your phone or start an emulator."
31+
echo "Exiting..."
32+
exit 1
33+
else
34+
echo "✅ Found the following connected Android devices:"
35+
echo "$devices"
36+
fi
37+
- uses: actions/checkout@v3
38+
- name: "Build app"
39+
run: |
40+
yarn install
41+
cd android
42+
./gradlew assembleRelease
43+
44+
JOB-test-app:
45+
name: Install and test the app
46+
runs-on: [self-hosted, brett]
47+
needs: JOB-build-app # or alternatively source the APK file to run
48+
timeout-minutes: 5
49+
steps:
50+
51+
- name: "Check for built app"
52+
run: |
53+
pwd
54+
ls -lash android/app/build/outputs/apk/release/app-release.apk
55+
56+
#TODO make this be a generic step?
57+
- name: "Install the Application"
58+
run: |
59+
adb install android/app/build/outputs/apk/release/app-release.apk
60+
61+
# Given an android phone, this command does the following:
62+
# Presses the power button, types in the pincode, and presses enter, then presses the home button.
63+
# This is not needed if your phone has no lock, and can save a few seconds.
64+
- name: "Start the phone"
65+
run: |
66+
adb shell input keyevent KEYCODE_MENU && adb shell input text ${{ secrets.PHONE_PIN_CODE }} && adb shell input keyevent KEYCODE_ENTER && adb shell input keyevent KEYCODE_HOME
67+
68+
- name: "Run the test suite"
69+
id: run_tests
70+
# You need to set the below to true, if you want failing steps to still be posted to slack.
71+
# With it off, you will only see successful tests get posted, as processing will stop.
72+
continue-on-error: true
73+
# run: |
74+
# maestro test maestrotests/functionality.yaml
75+
run: |
76+
mkdir -p MaestroTests/TestResults
77+
maestro test --format junit --output MaestroTests/TestResults/report.xml MaestroTests/autorun | tee testresults.txt
78+
exit_status=${PIPESTATUS[0]}
79+
if [ $exit_status -ne 0 ]; then
80+
echo "Error: The command failed with exit status $exit_status"
81+
exit $exit_status
82+
fi
83+
84+
- name: "If the tests failed, save the failure screenshot as well"
85+
if: ${{ steps.run_tests.outcome == 'failure' }}
86+
run: |
87+
echo "The test before failed, lets save the picture from the test"
88+
# FAILEDTESTLOCATION=$(grep -oE '/Users/[^/]+/.maestro/tests/[0-9_-]+' testresults.txt) # Mac Specific one
89+
FAILEDTESTLOCATION=$(grep -oE '/[^ ]+/.maestro/tests/[0-9_-]+' testresults.txt)
90+
echo $FAILEDTESTLOCATION
91+
ls -lash $FAILEDTESTLOCATION
92+
if [[ -n "$FAILEDTESTLOCATION" ]]; then
93+
echo "Found folder name: $FAILEDTESTLOCATION"
94+
cp "$FAILEDTESTLOCATION"/*.png MaestroTests/TestResults/
95+
else
96+
echo "No folder name found."
97+
fi
98+
99+
- name: "Info: Check for report file existing"
100+
run: |
101+
ls -lash MaestroTests/TestResults/report.xml
102+
103+
- name: "Info: Show pictures/files that are saved in test results folder"
104+
run: |
105+
ls -lash MaestroTests/TestResults/
106+
107+
108+
- name: "Info: Check for failed image"
109+
run: |
110+
ls -lash $FAILEDTESTLOCATION
111+
112+
- name: "Info: status of test run"
113+
run: |
114+
echo outcome: ${{ steps.run_tests.outcome }}
115+
echo conclusion: ${{ steps.run_tests.conclusion }}
116+
117+
118+
119+
# Don't post it to slack.
120+
# - name: Check test results and post to slack
121+
# id: testresults
122+
# uses: brett-james-rocketlab/maestro-test-results-to-slack@main
123+
# # See the readme.md in the repo for more information on these.
124+
# env:
125+
# SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
126+
# SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
127+
# # INTRO_MESSAGE: From bleedingedgeRN # This is optional
128+
# TEST_RESULTS_FOLDER: MaestroTests/TestResults/

0 commit comments

Comments
 (0)