Skip to content

E2E Tests

E2E Tests #22

Workflow file for this run

name: E2E Tests
on:
push:
branches:
- rel/**
workflow_dispatch:
inputs:
platform:
description: 'Platform to test'
required: true
default: 'android'
type: choice
options:
- android
- ios
- both
runner:
description: 'Where to run tests'
required: true
default: 'local'
type: choice
options:
- browserstack
- local
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# ── BrowserStack path ─────────────────────────────────────────────────
build-android:
if: >-
(github.event_name == 'push' ||
github.event.inputs.platform == 'android' ||
github.event.inputs.platform == 'both') &&
(github.event_name == 'push' || github.event.inputs.runner == 'browserstack')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Flutter
uses: ./.github/actions/setup-flutter
with:
working-directory: examples/demo
- name: Set up Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
- name: Create demo .env
working-directory: examples/demo
run: |
echo "ONESIGNAL_APP_ID=${{ vars.APPIUM_ONESIGNAL_APP_ID }}" > .env
echo "ONESIGNAL_API_KEY=${{ secrets.APPIUM_ONESIGNAL_API_KEY }}" >> .env
echo "E2E_MODE=true" >> .env
- name: Build release APK
working-directory: examples/demo
run: flutter build apk --release
- name: Upload APK
uses: actions/upload-artifact@v7
with:
name: demo-apk
path: examples/demo/build/app/outputs/flutter-apk/app-release.apk
retention-days: 1
build-ios:
if: >-
(github.event_name == 'push' ||
github.event.inputs.platform == 'ios' ||
github.event.inputs.platform == 'both') &&
(github.event_name == 'push' || github.event.inputs.runner == 'browserstack')
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Flutter
uses: ./.github/actions/setup-flutter
with:
working-directory: examples/demo
- name: Create demo .env
working-directory: examples/demo
run: |
echo "ONESIGNAL_APP_ID=${{ vars.APPIUM_ONESIGNAL_APP_ID }}" > .env
echo "ONESIGNAL_API_KEY=${{ secrets.APPIUM_ONESIGNAL_API_KEY }}" >> .env
echo "E2E_MODE=true" >> .env
- name: Build iOS app
working-directory: examples/demo
run: |
flutter build ios --release --no-codesign
cd build/ios/iphoneos
mkdir Payload
cp -r Runner.app Payload/
zip -r Runner.ipa Payload
- name: Upload IPA
uses: actions/upload-artifact@v7
with:
name: demo-ipa
path: examples/demo/build/ios/iphoneos/Runner.ipa
retention-days: 1
e2e-android:
needs: build-android
uses: OneSignal/sdk-shared/.github/workflows/appium-e2e.yml@main
secrets: inherit
with:
platform: android
app-artifact: demo-apk
app-filename: app-release.apk
sdk-type: flutter
build-name: flutter-android-${{ github.ref_name }}-${{ github.run_number }}
e2e-ios:
needs: build-ios
uses: OneSignal/sdk-shared/.github/workflows/appium-e2e.yml@main
secrets: inherit
with:
platform: ios
app-artifact: demo-ipa
app-filename: Runner.ipa
sdk-type: flutter
build-name: flutter-ios-${{ github.ref_name }}-${{ github.run_number }}
# ── Local path (composite action, build + test in one job) ────────────
e2e-android-local:
if: >-
github.event_name == 'workflow_dispatch' &&
github.event.inputs.runner == 'local' &&
(github.event.inputs.platform == 'android' ||
github.event.inputs.platform == 'both')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Flutter
uses: ./.github/actions/setup-flutter
with:
working-directory: examples/demo
- name: Set up Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6
with:
cache-read-only: false
- name: Cache Android SDK NDK + CMake
uses: actions/cache@v5
with:
path: |
/usr/local/lib/android/sdk/ndk/27.0.12077973
/usr/local/lib/android/sdk/cmake/3.22.1
key: android-sdk-ndk-27.0.12077973-cmake-3.22.1
- name: Cache pub dependencies
uses: actions/cache@v5
with:
path: ~/.pub-cache
key: pub-${{ runner.os }}-${{ hashFiles('examples/demo/pubspec.lock') }}
restore-keys: |
pub-${{ runner.os }}-
- name: Create demo .env
working-directory: examples/demo
run: |
echo "ONESIGNAL_APP_ID=${{ vars.APPIUM_ONESIGNAL_APP_ID }}" > .env
echo "ONESIGNAL_API_KEY=${{ secrets.APPIUM_ONESIGNAL_API_KEY }}" >> .env
echo "E2E_MODE=true" >> .env
- name: Build debug APK
working-directory: examples/demo
run: flutter build apk --debug --target-platform android-x64
- name: Run Appium tests
uses: OneSignal/sdk-shared/.github/actions/appium-local-android@main
with:
app-path: ${{ github.workspace }}/examples/demo/build/app/outputs/flutter-apk/app-debug.apk
sdk-type: flutter
onesignal-app-id: ${{ vars.APPIUM_ONESIGNAL_APP_ID }}
onesignal-api-key: ${{ secrets.APPIUM_ONESIGNAL_API_KEY }}
e2e-ios-local:
if: >-
github.event_name == 'workflow_dispatch' &&
github.event.inputs.runner == 'local' &&
(github.event.inputs.platform == 'ios' ||
github.event.inputs.platform == 'both')
runs-on: macos-26
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Flutter
uses: ./.github/actions/setup-flutter
with:
working-directory: examples/demo
- name: Create demo .env
working-directory: examples/demo
run: |
echo "ONESIGNAL_APP_ID=${{ vars.APPIUM_ONESIGNAL_APP_ID }}" > .env
echo "ONESIGNAL_API_KEY=${{ secrets.APPIUM_ONESIGNAL_API_KEY }}" >> .env
echo "E2E_MODE=true" >> .env
- name: Build iOS simulator .app
working-directory: examples/demo
run: flutter build ios --simulator --debug
- name: Run Appium tests
uses: OneSignal/sdk-shared/.github/actions/appium-local-ios@main
with:
app-path: ${{ github.workspace }}/examples/demo/build/ios/iphonesimulator/Runner.app
sdk-type: flutter
onesignal-app-id: ${{ vars.APPIUM_ONESIGNAL_APP_ID }}
onesignal-api-key: ${{ secrets.APPIUM_ONESIGNAL_API_KEY }}