Skip to content

Commit 971ef4c

Browse files
Rohit3523JASIM0021diegolmello
authored
chore: Maestro E2E Testing (#6500)
Co-authored-by: Rohit3523 <[email protected]> Co-authored-by: SK JASIMUDDIN <[email protected]> Co-authored-by: Diego Mello <[email protected]>
1 parent 429a2ff commit 971ef4c

38 files changed

+1250
-42
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Setup E2E Account
2+
description: Setup E2E Account
3+
inputs:
4+
E2E_ACCOUNT:
5+
description: 'E2E Account'
6+
required: true
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Setup Account
12+
shell: bash
13+
run: |
14+
echo "${{ inputs.E2E_ACCOUNT }}" | base64 --decode | tee .maestro/scripts/e2e_account.js > /dev/null
15+
sed '$s/.*/output.account = account;/' .maestro/scripts/e2e_account.js > tmp && mv tmp .maestro/scripts/e2e_account.js

.github/workflows/build-pr.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,40 @@ jobs:
5757
secrets: inherit
5858
with:
5959
type: official
60-
trigger: "pr"
60+
trigger: "pr"
61+
62+
e2e-hold:
63+
name: E2E Hold
64+
if: ${{ github.repository == 'RocketChat/Rocket.Chat.ReactNative' }}
65+
environment: approve_e2e_testing
66+
runs-on: ubuntu-latest
67+
steps:
68+
- run: echo "Waiting for manual approval..."
69+
70+
e2e-build-android:
71+
name: E2E Build Android
72+
if: ${{ github.repository == 'RocketChat/Rocket.Chat.ReactNative' }}
73+
uses: ./.github/workflows/e2e-build-android.yml
74+
needs: [e2e-hold]
75+
secrets: inherit
76+
77+
e2e-run-android:
78+
name: E2E Run Android
79+
if: ${{ github.repository == 'RocketChat/Rocket.Chat.ReactNative' }}
80+
uses: ./.github/workflows/maestro-android.yml
81+
needs: [e2e-build-android]
82+
secrets: inherit
83+
84+
e2e-build-ios:
85+
name: E2E Build iOS
86+
if: ${{ github.repository == 'RocketChat/Rocket.Chat.ReactNative' }}
87+
uses: ./.github/workflows/e2e-build-ios.yml
88+
needs: [e2e-hold]
89+
secrets: inherit
90+
91+
e2e-run-ios:
92+
name: E2E Run iOS
93+
if: ${{ github.repository == 'RocketChat/Rocket.Chat.ReactNative' }}
94+
uses: ./.github/workflows/maestro-ios.yml
95+
needs: [e2e-build-ios]
96+
secrets: inherit
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: E2E Build Android
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
EXPERIMENTAL_KEYSTORE_BASE64:
7+
required: true
8+
EXPERIMENTAL_KEYSTORE_PASSWORD:
9+
required: true
10+
EXPERIMENTAL_KEY_ALIAS:
11+
required: true
12+
EXPERIMENTAL_KEY_PASSWORD:
13+
required: true
14+
BUGSNAG_KEY:
15+
required: true
16+
17+
jobs:
18+
android-build:
19+
runs-on: ubuntu-latest
20+
21+
outputs:
22+
artifact_name: Android Experimental APK
23+
24+
steps:
25+
- name: Checkout Repository
26+
uses: actions/checkout@v4
27+
28+
- name: Checkout and Setup Node
29+
uses: ./.github/actions/setup-node
30+
31+
- name: Setup E2E Account
32+
uses: ./.github/actions/e2e-account
33+
with:
34+
E2E_ACCOUNT: ${{ secrets.E2E_ACCOUNT }}
35+
36+
- name: Cache Gradle dependencies
37+
uses: actions/cache@v4
38+
with:
39+
path: |
40+
~/.gradle/caches/modules-2
41+
~/.gradle/caches/transforms-*
42+
~/.gradle/caches/build-cache-*
43+
key: gradle-transforms-v1-${{ runner.os }}-${{ hashFiles('**/*.gradle*', 'gradle-wrapper.properties') }}
44+
restore-keys: |
45+
gradle-transforms-v1-${{ runner.os }}-
46+
47+
- name: Set up JDK
48+
uses: actions/setup-java@v4
49+
with:
50+
java-version: '17'
51+
distribution: 'temurin'
52+
53+
- name: Setup Android SDK
54+
uses: android-actions/setup-android@v3
55+
56+
- name: Set up Gradle
57+
uses: gradle/actions/setup-gradle@v4
58+
with:
59+
gradle-version: wrapper
60+
cache-disabled: true
61+
62+
- name: Decode Keystore
63+
run: |
64+
echo "${{ secrets.EXPERIMENTAL_KEYSTORE_BASE64 }}" | base64 -d > android/app/release.keystore
65+
66+
- name: Set gradle.properties
67+
working-directory: android
68+
run: |
69+
echo "" > ./gradle.properties
70+
echo -e "org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8" >> ./gradle.properties
71+
echo -e "android.useAndroidX=true" >> ./gradle.properties
72+
echo -e "android.enableJetifier=true" >> ./gradle.properties
73+
echo -e "reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64" >> ./gradle.properties
74+
echo -e "APPLICATION_ID=chat.rocket.reactnative" >> ./gradle.properties
75+
echo -e "newArchEnabled=true" >> ./gradle.properties
76+
echo -e "hermesEnabled=true" >> ./gradle.properties
77+
echo -e "VERSIONCODE=999999" >> ./gradle.properties
78+
echo -e "KEYSTORE=release.keystore" >> ./gradle.properties
79+
echo -e "KEYSTORE_PASSWORD=${{ secrets.EXPERIMENTAL_KEYSTORE_PASSWORD }}" >> ./gradle.properties
80+
echo -e "KEY_ALIAS=${{ secrets.EXPERIMENTAL_KEY_ALIAS }}" >> ./gradle.properties
81+
echo -e "KEY_PASSWORD=${{ secrets.EXPERIMENTAL_KEY_PASSWORD }}" >> ./gradle.properties
82+
echo -e "BugsnagAPIKey=${{ secrets.BUGSNAG_KEY }}" >> ./gradle.properties
83+
84+
- name: Build Android Release APK
85+
working-directory: android
86+
run: ./gradlew assembleExperimentalRelease --build-cache --parallel --max-workers=4 --no-daemon --stacktrace
87+
88+
- name: Upload APK
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: Android Experimental APK
92+
path: android/app/build/outputs/apk/experimental/release/app-experimental-release.apk
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: E2E Build iOS
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
APP_STORE_CONNECT_API_KEY_BASE64:
7+
required: true
8+
BUGSNAG_KEY:
9+
required: true
10+
MATCH_KEYCHAIN_NAME:
11+
required: true
12+
MATCH_KEYCHAIN_PASSWORD:
13+
required: true
14+
MATCH_PASSWORD:
15+
required: true
16+
APP_STORE_CONNECT_API_KEY_ID:
17+
required: true
18+
APP_STORE_CONNECT_API_KEY_ISSUER_ID:
19+
required: true
20+
FASTLANE_REPO_PAT:
21+
required: true
22+
23+
jobs:
24+
ios-build:
25+
runs-on: macos-15
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
- name: Set up Node.js
32+
uses: ./.github/actions/setup-node
33+
34+
- name: Set up Xcode
35+
uses: maxim-lobanov/setup-xcode@v1
36+
with:
37+
xcode-version: '16.2'
38+
39+
- name: Set up Ruby
40+
uses: ruby/setup-ruby@v1
41+
with:
42+
ruby-version: 2.7.7
43+
bundler-cache: true
44+
45+
- name: Cache CocoaPods and derived data
46+
uses: actions/cache@v4
47+
with:
48+
path: |
49+
ios/Pods
50+
~/Library/Caches/CocoaPods
51+
~/.cocoapods/repos
52+
~/Library/Developer/Xcode/DerivedData
53+
key: ios-cache-${{ runner.os }}-${{ hashFiles('ios/Podfile.lock', 'ios/Podfile') }}
54+
restore-keys: |
55+
ios-cache-${{ runner.os }}-
56+
57+
- name: Cache Xcode DerivedData
58+
uses: actions/cache@v4
59+
with:
60+
path: ~/Library/Developer/Xcode/DerivedData
61+
key: derived-data-${{ runner.os }}-${{ github.sha }}
62+
restore-keys: |
63+
derived-data-${{ runner.os }}-
64+
65+
- name: pod install
66+
run: |
67+
yarn pod-install
68+
69+
- name: Decode p8
70+
run: |
71+
echo ${{ secrets.APP_STORE_CONNECT_API_KEY_BASE64 }} | base64 --decode > ./ios/fastlane/app_store_connect_api_key.p8
72+
73+
- name: Set bugsnag key
74+
run: |
75+
cd ios
76+
/usr/libexec/PlistBuddy -c "Set :bugsnag:apiKey ${{ secrets.BUGSNAG_KEY}}" ./RocketChatRN/Info.plist
77+
/usr/libexec/PlistBuddy -c "Set :bugsnag:apiKey ${{ secrets.BUGSNAG_KEY}}" ./ShareRocketChatRN/Info.plist
78+
79+
- name: Build iOS app
80+
run: |
81+
cd ios
82+
bundle exec fastlane ios build_experimental_simulator \
83+
disable_xcpretty:false \
84+
skip_package_ipa:true \
85+
skip_archive:true
86+
env:
87+
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
88+
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
89+
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
90+
APP_STORE_CONNECT_API_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }}
91+
APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ISSUER_ID }}
92+
FASTLANE_REPO_PAT: ${{ secrets.FASTLANE_REPO_PAT }}
93+
94+
- name: Find latest xcarchive path
95+
id: find_xcarchive
96+
run: |
97+
ARCHIVE_PATH=$(ls -td ios/fastlane/build/*.xcarchive | head -n 1)
98+
echo "Latest archive path is $ARCHIVE_PATH"
99+
echo "archive_path=$ARCHIVE_PATH" >> $GITHUB_OUTPUT
100+
101+
- name: Upload Artifact
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: ios-simulator-app
105+
path: ${{ steps.find_xcarchive.outputs.archive_path }}/Products/Applications/Rocket.Chat Experimental.app
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Maestro Tests on Android
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
android-test:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout Repository
12+
uses: actions/checkout@v4
13+
14+
- name: Download APK
15+
uses: actions/download-artifact@v4
16+
with:
17+
name: Android Experimental APK
18+
19+
- name: Setup E2E Account
20+
uses: ./.github/actions/e2e-account
21+
with:
22+
E2E_ACCOUNT: ${{ secrets.E2E_ACCOUNT }}
23+
24+
- name: Install Maestro
25+
run: |
26+
curl -fsSL "https://get.maestro.mobile.dev" | bash
27+
echo "$HOME/.maestro/bin" >> $GITHUB_PATH
28+
29+
- name: Enable KVM group permissions
30+
run: |
31+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
32+
sudo udevadm control --reload-rules
33+
sudo udevadm trigger --name-match=kvm
34+
35+
- name: Start Android Emulator and Run Maestro Tests
36+
uses: reactivecircus/android-emulator-runner@v2
37+
with:
38+
api-level: 34
39+
disk-size: 4096M
40+
arch: x86_64
41+
target: google_apis
42+
profile: pixel_7_pro
43+
cores: 4
44+
ram-size: 4096M
45+
force-avd-creation: false
46+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
47+
disable-animations: true
48+
script: |
49+
adb install app-experimental-release.apk
50+
adb shell monkey -p chat.rocket.reactnative -c android.intent.category.LAUNCHER 1
51+
sleep 10
52+
adb shell am force-stop chat.rocket.reactnative
53+
export MAESTRO_USE_GRAALJS=true
54+
maestro test .maestro --format junit --output maestro-report.xml
55+
56+
- name: Upload Test Report
57+
if: always()
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: Android Test Report
61+
path: maestro-report.xml
62+
63+
- name: Upload Maestro Logs
64+
if: always()
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: Android Maestro Logs
68+
path: ~/.maestro/tests/

0 commit comments

Comments
 (0)