Skip to content

Commit

Permalink
Migrate mobile testing to BrowserStack (#877)
Browse files Browse the repository at this point in the history
  • Loading branch information
albho authored Nov 29, 2024
1 parent 7923086 commit 0cad878
Show file tree
Hide file tree
Showing 18 changed files with 736 additions and 611 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Android AppCenter Tests
name: Android BrowserStack Tests

on:
workflow_dispatch:
push:
branches: [ master ]
paths:
- '.github/workflows/android-appcenter.yml'
- '.github/workflows/android-browserstack.yml'
- 'sdk/android/PicovoiceTestApp/**'
- 'resources/.test/**'
- 'resources/audio_samples/**'
pull_request:
branches: [ master, 'v[0-9]+.[0-9]+' ]
paths:
- '.github/workflows/android-appcenter.yml'
- '.github/workflows/android-browserstack.yml'
- 'sdk/android/PicovoiceTestApp/**'
- 'resources/.test/**'
- 'resources/audio_samples/**'
Expand All @@ -23,7 +23,7 @@ defaults:

jobs:
build:
name: Run Android Tests on AppCenter
name: Run Android Tests on BrowserStack
runs-on: ubuntu-latest

steps:
Expand All @@ -32,18 +32,17 @@ jobs:
with:
submodules: recursive

- name: Set up Node.js LTS
uses: actions/setup-node@v3
- name: Installing Python
uses: actions/setup-python@v5
with:
node-version: lts/*
python-version: '3.10'
- run:
pip3 install requests

- name: Install AppCenter CLI
run: npm install -g appcenter-cli

- name: set up JDK 11
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'

- name: Copy test_resources
Expand Down Expand Up @@ -71,18 +70,18 @@ jobs:
- name: Build androidTest
run: ./gradlew assembleEnDebugAndroidTest

- name: Run tests on AppCenter
run: appcenter test run espresso
--token ${{secrets.APPCENTERAPITOKEN}}
--app "Picovoice/Picovoice-Android-Activity"
--devices "Picovoice/android-min-max"
--app-path picovoice-test-app/build/outputs/apk/en/debug/picovoice-test-app-en-debug.apk
--test-series "porcupine-android"
--locale "en_US"
--build-dir picovoice-test-app/build/outputs/apk/androidTest/en/debug
- name: Run tests on BrowserStack
run: python3 ../../../script/automation/browserstack.py
--type espresso
--username "${{secrets.BROWSERSTACK_USERNAME}}"
--access_key "${{secrets.BROWSERSTACK_ACCESS_KEY}}"
--project_name "Picovoice-Android"
--devices "android-min-max"
--app_path "picovoice-test-app/build/outputs/apk/en/debug/picovoice-test-app-en-debug.apk"
--test_path "picovoice-test-app/build/outputs/apk/androidTest/en/debug/picovoice-test-app-en-debug-androidTest.apk"

build-integ:
name: Run Android Integration Tests on AppCenter
name: Run Android Integration Tests on BrowserStack
runs-on: ubuntu-latest

steps:
Expand All @@ -91,18 +90,17 @@ jobs:
with:
submodules: recursive

- name: Set up Node.js LTS
uses: actions/setup-node@v3
- name: Installing Python
uses: actions/setup-python@v5
with:
node-version: lts/*

- name: Install AppCenter CLI
run: npm install -g appcenter-cli
python-version: '3.10'
- run:
pip3 install requests

- name: set up JDK 11
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'

- name: Copy test_resources
Expand Down Expand Up @@ -130,12 +128,12 @@ jobs:
- name: Build androidTest
run: ./gradlew assembleEnReleaseAndroidTest -DtestBuildType=integ

- name: Run tests on AppCenter
run: appcenter test run espresso
--token ${{secrets.APPCENTERAPITOKEN}}
--app "Picovoice/Picovoice-Android-Activity"
--devices "Picovoice/android-min-max"
--app-path picovoice-test-app/build/outputs/apk/en/release/picovoice-test-app-en-release.apk
--test-series "picovoice-android"
--locale "en_US"
--build-dir picovoice-test-app/build/outputs/apk/androidTest/en/release
- name: Run tests on BrowserStack
run: python3 ../../../script/automation/browserstack.py
--type espresso
--username "${{secrets.BROWSERSTACK_USERNAME}}"
--access_key "${{secrets.BROWSERSTACK_ACCESS_KEY}}"
--project_name "Picovoice-Android-Integration"
--devices "android-min-max"
--app_path "picovoice-test-app/build/outputs/apk/en/release/picovoice-test-app-en-release.apk"
--test_path "picovoice-test-app/build/outputs/apk/androidTest/en/release/picovoice-test-app-en-release-androidTest.apk"
8 changes: 4 additions & 4 deletions .github/workflows/android-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: set up JDK 11
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'

- name: Build English
Expand All @@ -48,10 +48,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: set up JDK 11
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'

- name: Build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: iOS AppCenter Tests
name: iOS BrowserStack Tests

on:
workflow_dispatch:
push:
branches: [ master ]
paths:
- '.github/workflows/ios-appcenter.yml'
- '.github/workflows/ios-browserstack.yml'
- 'sdk/ios/PicovoiceAppTest/**'
- 'resources/audio_samples/**'
- 'resources/porcupine'
Expand All @@ -14,7 +14,7 @@ on:
pull_request:
branches: [ master, 'v[0-9]+.[0-9]+' ]
paths:
- '.github/workflows/ios-appcenter.yml'
- '.github/workflows/ios-browserstack.yml'
- 'sdk/ios/PicovoiceAppTest/**'
- 'resources/audio_samples/**'
- 'resources/porcupine'
Expand All @@ -27,7 +27,7 @@ defaults:

jobs:
build:
name: Run iOS Tests on AppCenter
name: Run iOS Tests on BrowserStack
runs-on: macos-latest

steps:
Expand All @@ -36,32 +36,26 @@ jobs:
with:
submodules: recursive

- name: Set up Node.js LTS
uses: actions/setup-node@v3
- name: Installing Python
uses: actions/setup-python@v5
with:
node-version: lts/*
python-version: '3.10'
- run:
pip3 install requests

- name: Install Cocoapods
run: gem install cocoapods

- name: Install AppCenter CLI
run: npm install -g appcenter-cli

- name: Make build dir
run: mkdir ddp

- name: Install resource script dependency
run: |
brew update
brew install convmv
- name: Copy test_resources
run: ./copy_test_resources.sh

- name: Run Cocoapods
run: pod install

- name: Inject AppID
- name: Inject AccessKey
run: sed -i '.bak' 's:{TESTING_ACCESS_KEY_HERE}:${{secrets.PV_VALID_ACCESS_KEY}}:'
PicovoiceAppTestUITests/BaseTest.swift

Expand All @@ -74,11 +68,23 @@ jobs:
-derivedDataPath ddp
CODE_SIGNING_ALLOWED=NO

- name: Run Tests on AppCenter
run: appcenter test run xcuitest
--token ${{secrets.APPCENTERAPITOKEN}}
--app "Picovoice/Picovoice-iOS"
--devices "Picovoice/ios-min-max"
--test-series "picovoice-ios"
--locale "en_US"
--build-dir ddp/Build/Products/Debug-iphoneos
- name: Generating ipa
run: cd ddp/Build/Products/Debug-iphoneos/ &&
mkdir Payload &&
cp -r PicovoiceAppTest.app Payload &&
zip --symlinks -r PicovoiceAppTest.ipa Payload &&
rm -r Payload

- name: Zipping Tests
run: cd ddp/Build/Products/Debug-iphoneos/ &&
zip --symlinks -r PicovoiceAppTestUITests.zip PicovoiceAppTestUITests-Runner.app

- name: Run tests on BrowserStack
run: python3 ../../../script/automation/browserstack.py
--type xcuitest
--username "${{secrets.BROWSERSTACK_USERNAME}}"
--access_key "${{secrets.BROWSERSTACK_ACCESS_KEY}}"
--project_name "Picovoice-iOS"
--devices "ios-min-max"
--app_path "ddp/Build/Products/Debug-iphoneos/PicovoiceAppTest.ipa"
--test_path "ddp/Build/Products/Debug-iphoneos/PicovoiceAppTestUITests.zip"
9 changes: 0 additions & 9 deletions .github/workflows/ios-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ jobs:
- name: Install Cocoapods
run: gem install cocoapods

- name: Install AppCenter CLI
run: npm install -g appcenter-cli

- name: Make build dir
run: mkdir ddp

Expand Down Expand Up @@ -81,9 +78,6 @@ jobs:
- name: Install Cocoapods
run: gem install cocoapods

- name: Install AppCenter CLI
run: npm install -g appcenter-cli

- name: Make build dir
run: mkdir ddp

Expand Down Expand Up @@ -119,9 +113,6 @@ jobs:
- name: Install Cocoapods
run: gem install cocoapods

- name: Install AppCenter CLI
run: npm install -g appcenter-cli

- name: Make build dir
run: mkdir ddp

Expand Down
1 change: 1 addition & 0 deletions resources/.lint/spell-check/dict.txt
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ webvp
weiß
Wohnzimmer
xcframework
xcuitest
xcworkspace
xcodeproj
xcshareddata
Expand Down
Loading

0 comments on commit 0cad878

Please sign in to comment.