Skip to content

Commit bfd2d3a

Browse files
authored
Migrate mobile testing to BrowserStack (#746)
1 parent 3df6954 commit bfd2d3a

File tree

24 files changed

+882
-695
lines changed

24 files changed

+882
-695
lines changed

.github/workflows/android-appcenter.yml renamed to .github/workflows/android-browserstack.yml

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
name: Android AppCenter Tests
1+
name: Android BrowserStack Tests
22

33
on:
44
workflow_dispatch:
55
push:
66
branches: [ master ]
77
paths:
8-
- '.github/workflows/android-appcenter.yml'
8+
- '.github/workflows/android-browserstack.yml'
99
- 'binding/android/RhinoTestApp/**'
1010
- 'resources/.test/**'
1111
- 'resources/audio_samples/**'
1212
pull_request:
1313
branches: [ master, 'v[0-9]+.[0-9]+' ]
1414
paths:
15-
- '.github/workflows/android-appcenter.yml'
15+
- '.github/workflows/android-browserstack.yml'
1616
- 'binding/android/RhinoTestApp/**'
1717
- 'resources/.test/**'
1818
- 'resources/audio_samples/**'
@@ -23,24 +23,23 @@ defaults:
2323

2424
jobs:
2525
build:
26-
name: Run Android Tests on AppCenter
26+
name: Run Android Tests on BrowserStack
2727
runs-on: ubuntu-latest
2828

2929
steps:
3030
- uses: actions/checkout@v3
3131

32-
- name: Set up Node.js LTS
33-
uses: actions/setup-node@v3
32+
- name: Installing Python
33+
uses: actions/setup-python@v5
3434
with:
35-
node-version: lts/*
35+
python-version: '3.10'
36+
- run:
37+
pip3 install requests
3638

37-
- name: Install AppCenter CLI
38-
run: npm install -g appcenter-cli
39-
40-
- name: set up JDK 11
39+
- name: set up JDK 17
4140
uses: actions/setup-java@v3
4241
with:
43-
java-version: '11'
42+
java-version: '17'
4443
distribution: 'temurin'
4544

4645
- name: Copy test_resources
@@ -68,35 +67,34 @@ jobs:
6867
- name: Build androidTest
6968
run: ./gradlew assembleEnDebugAndroidTest
7069

71-
- name: Run tests on AppCenter
72-
run: appcenter test run espresso
73-
--token ${{secrets.APPCENTERAPITOKEN}}
74-
--app "Picovoice/Rhino-Android-Activity"
75-
--devices "Picovoice/android-min-max"
76-
--app-path rhino-test-app/build/outputs/apk/en/debug/rhino-test-app-en-debug.apk
77-
--test-series "rhino-android"
78-
--locale "en_US"
79-
--build-dir rhino-test-app/build/outputs/apk/androidTest/en/debug
70+
- name: Run tests on BrowserStack
71+
run: python3 ../../../script/automation/browserstack.py
72+
--type espresso
73+
--username "${{secrets.BROWSERSTACK_USERNAME}}"
74+
--access_key "${{secrets.BROWSERSTACK_ACCESS_KEY}}"
75+
--project_name "Rhino-Android"
76+
--devices "android-min-max"
77+
--app_path "rhino-test-app/build/outputs/apk/en/debug/rhino-test-app-en-debug.apk"
78+
--test_path "rhino-test-app/build/outputs/apk/androidTest/en/debug/rhino-test-app-en-debug-androidTest.apk"
8079

8180
build-integ:
82-
name: Run Android Integration Tests on AppCenter
81+
name: Run Android Integration Tests on BrowserStack
8382
runs-on: ubuntu-latest
8483

8584
steps:
8685
- uses: actions/checkout@v3
8786

88-
- name: Set up Node.js LTS
89-
uses: actions/setup-node@v3
87+
- name: Installing Python
88+
uses: actions/setup-python@v5
9089
with:
91-
node-version: lts/*
92-
93-
- name: Install AppCenter CLI
94-
run: npm install -g appcenter-cli
90+
python-version: '3.10'
91+
- run:
92+
pip3 install requests
9593

96-
- name: set up JDK 11
94+
- name: set up JDK 17
9795
uses: actions/setup-java@v3
9896
with:
99-
java-version: '11'
97+
java-version: '17'
10098
distribution: 'temurin'
10199

102100
- name: Copy test_resources
@@ -124,12 +122,12 @@ jobs:
124122
- name: Build androidTest
125123
run: ./gradlew assembleEnReleaseAndroidTest -DtestBuildType=integ
126124

127-
- name: Run tests on AppCenter
128-
run: appcenter test run espresso
129-
--token ${{secrets.APPCENTERAPITOKEN}}
130-
--app "Picovoice/Rhino-Android-Activity"
131-
--devices "Picovoice/android-min-max"
132-
--app-path rhino-test-app/build/outputs/apk/en/release/rhino-test-app-en-release.apk
133-
--test-series "rhino-android"
134-
--locale "en_US"
135-
--build-dir rhino-test-app/build/outputs/apk/androidTest/en/release
125+
- name: Run tests on BrowserStack
126+
run: python3 ../../../script/automation/browserstack.py
127+
--type espresso
128+
--username "${{secrets.BROWSERSTACK_USERNAME}}"
129+
--access_key "${{secrets.BROWSERSTACK_ACCESS_KEY}}"
130+
--project_name "Rhino-Android-Integration"
131+
--devices "android-min-max"
132+
--app_path "rhino-test-app/build/outputs/apk/en/release/rhino-test-app-en-release.apk"
133+
--test_path "rhino-test-app/build/outputs/apk/androidTest/en/release/rhino-test-app-en-release-androidTest.apk"

.github/workflows/android-demos.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@v3
2727

28-
- name: set up JDK 11
28+
- name: set up JDK 17
2929
uses: actions/setup-java@v3
3030
with:
31-
java-version: '11'
31+
java-version: '17'
3232
distribution: 'temurin'
3333

3434
- name: Build

.github/workflows/android-perf.yml

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,30 @@ defaults:
1919

2020
jobs:
2121
build:
22-
name: Run Android Speed Tests on AppCenter
22+
name: Run Android Speed Tests on BrowserStack
2323
runs-on: ubuntu-latest
2424

2525
strategy:
2626
matrix:
27-
device: [single-android, 32bit-android]
27+
device: [ android-perf ]
2828
include:
29-
- device: single-android
29+
- device: android-perf
3030
performanceThresholdSec: 0.2
31-
- device: 32bit-android
32-
performanceThresholdSec: 1.0
3331

3432
steps:
3533
- uses: actions/checkout@v3
3634

37-
- name: Set up Node.js LTS
38-
uses: actions/setup-node@v3
35+
- name: Installing Python
36+
uses: actions/setup-python@v5
3937
with:
40-
node-version: lts/*
38+
python-version: '3.10'
39+
- run:
40+
pip3 install requests
4141

42-
- name: Install AppCenter CLI
43-
run: npm install -g appcenter-cli
44-
45-
- name: set up JDK 11
42+
- name: set up JDK 17
4643
uses: actions/setup-java@v3
4744
with:
48-
java-version: '11'
45+
java-version: '17'
4946
distribution: 'temurin'
5047

5148
- name: Copy test_resources
@@ -79,12 +76,12 @@ jobs:
7976
- name: Build androidTest
8077
run: ./gradlew assembleEnDebugAndroidTest -DtestBuildType=perf
8178

82-
- name: Run tests on AppCenter
83-
run: appcenter test run espresso
84-
--token ${{secrets.APPCENTERAPITOKEN}}
85-
--app "Picovoice/Rhino-Android-Activity"
86-
--devices "Picovoice/${{ matrix.device }}"
87-
--app-path rhino-test-app/build/outputs/apk/en/debug/rhino-test-app-en-debug.apk
88-
--test-series "rhino-android"
89-
--locale "en_US"
90-
--build-dir rhino-test-app/build/outputs/apk/androidTest/en/debug
79+
- name: Run tests on BrowserStack
80+
run: python3 ../../../script/automation/browserstack.py
81+
--type espresso
82+
--username "${{secrets.BROWSERSTACK_USERNAME}}"
83+
--access_key "${{secrets.BROWSERSTACK_ACCESS_KEY}}"
84+
--project_name "Rhino-Android-Performance"
85+
--devices "${{ matrix.device }}"
86+
--app_path "rhino-test-app/build/outputs/apk/en/debug/rhino-test-app-en-debug.apk"
87+
--test_path "rhino-test-app/build/outputs/apk/androidTest/en/debug/rhino-test-app-en-debug-androidTest.apk"

.github/workflows/ios-appcenter.yml

Lines changed: 0 additions & 78 deletions
This file was deleted.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: iOS BrowserStack Tests
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ master ]
7+
paths:
8+
- '.github/workflows/ios-browserstack.yml'
9+
- 'binding/ios/RhinoAppTest/**'
10+
- 'resources/.test/**'
11+
- 'resources/audio_samples/**'
12+
pull_request:
13+
branches: [ master, 'v[0-9]+.[0-9]+' ]
14+
paths:
15+
- '.github/workflows/ios-browserstack.yml'
16+
- 'binding/ios/RhinoAppTest/**'
17+
- 'resources/.test/**'
18+
- 'resources/audio_samples/**'
19+
20+
defaults:
21+
run:
22+
working-directory: binding/ios/RhinoAppTest
23+
24+
jobs:
25+
build:
26+
name: Run iOS Tests on BrowserStack
27+
runs-on: macos-latest
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v3
32+
33+
- name: Installing Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: '3.10'
37+
- run:
38+
pip3 install requests
39+
40+
- name: Install Cocoapods
41+
run: gem install cocoapods
42+
43+
- name: Make build dir
44+
run: mkdir ddp
45+
46+
- name: Copy test_resources
47+
run: ./copy_test_resources.sh
48+
49+
- name: Run Cocoapods
50+
run: pod install
51+
52+
- name: Inject AccessKey
53+
run: sed -i '.bak' 's:{TESTING_ACCESS_KEY_HERE}:${{secrets.PV_VALID_ACCESS_KEY}}:'
54+
RhinoAppTestUITests/BaseTest.swift
55+
56+
- name: XCode Build
57+
run: xcrun xcodebuild build-for-testing
58+
-configuration Debug
59+
-workspace RhinoAppTest.xcworkspace
60+
-sdk iphoneos
61+
-scheme RhinoAppTest
62+
-derivedDataPath ddp
63+
CODE_SIGNING_ALLOWED=NO
64+
65+
- name: Generating ipa
66+
run: cd ddp/Build/Products/Debug-iphoneos/ &&
67+
mkdir Payload &&
68+
cp -r RhinoAppTest.app Payload &&
69+
zip --symlinks -r RhinoAppTest.ipa Payload &&
70+
rm -r Payload
71+
72+
- name: Zipping Tests
73+
run: cd ddp/Build/Products/Debug-iphoneos/ &&
74+
zip --symlinks -r RhinoAppTestUITests.zip RhinoAppTestUITests-Runner.app
75+
76+
- name: Run tests on BrowserStack
77+
run: python3 ../../../script/automation/browserstack.py
78+
--type xcuitest
79+
--username "${{secrets.BROWSERSTACK_USERNAME}}"
80+
--access_key "${{secrets.BROWSERSTACK_ACCESS_KEY}}"
81+
--project_name "Rhino-iOS"
82+
--devices "ios-min-max"
83+
--app_path "ddp/Build/Products/Debug-iphoneos/RhinoAppTest.ipa"
84+
--test_path "ddp/Build/Products/Debug-iphoneos/RhinoAppTestUITests.zip"

.github/workflows/ios-demos.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ jobs:
3232
- name: Install Cocoapods
3333
run: gem install cocoapods
3434

35-
- name: Install AppCenter CLI
36-
run: npm install -g appcenter-cli
37-
3835
- name: Make build dir
3936
run: mkdir ddp
4037

0 commit comments

Comments
 (0)