Skip to content

Instrumentation tests #1896

Instrumentation tests

Instrumentation tests #1896

name: Instrumentation tests
on:
workflow_dispatch:
schedule:
# every 12 hours
- cron: '0 */12 * * *'
jobs:
# This should be updated to use the browserstack github actions when supported
browserstack-instrumentation-tests:
name: Browserstack Instrumentation tests
runs-on: ubuntu-latest
timeout-minutes: 55
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/stripe_setup
- name: 'Build'
run: ./gradlew :paymentsheet-example:assembleDebugAndroidTest :paymentsheet-example:assembleDebug
- name: 'Install pip modules'
run: pip install requests_toolbelt requests
- name: 'Run BrowserStack tests'
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
run: python scripts/browserstack.py --test --apk paymentsheet-example/build/outputs/apk/debug/paymentsheet-example-debug.apk --espresso paymentsheet-example/build/outputs/apk/androidTest/debug/paymentsheet-example-debug-androidTest.apk --is-nightly
- name: Notify failure endpoint
id: notifyFailureEndpoint
if: failure()
run: |
./scripts/notify_failure_endpoint.rb \
${{ secrets.SDK_FAILURE_NOTIFICATION_ENDPOINT }} \
${{ secrets.SDK_FAILURE_NOTIFICATION_ENDPOINT_HMAC_KEY }} \
"https://github.com/stripe/stripe-android/actions/runs/${{ github.run_id }}" \
RUN_MOBILESDK
screenshot-regression-tests:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/stripe_setup
- name: run tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }}
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 28
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim
disable-animations: true
sdcard-path-or-size: 512M
profile: Nexus 6
script: ruby scripts/check_payment_sheet_screenshots.rb
- uses: actions/upload-artifact@v3
if: failure()
with:
name: test-failures
path: |
**/build/reports/shot/debug/verification/
**/tmp/shot/screenshot/
**/build/reports/androidTests/connected/
- uses: peter-evans/create-or-update-comment@v2
if: steps.failed-screenshots.outputs.PR_COMMENT
with:
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.failed-screenshots.outputs.PR_COMMENT }}
token: ${{ secrets.GITHUB_TOKEN }}
# - name: Notify failure endpoint
# id: notifyFailureEndpoint
# if: failure()
# run: |
# ./scripts/notify_failure_endpoint.rb \
# ${{ secrets.SDK_FAILURE_NOTIFICATION_ENDPOINT }} \
# ${{ secrets.SDK_FAILURE_NOTIFICATION_ENDPOINT_HMAC_KEY }} \
# "https://github.com/stripe/stripe-android/actions/runs/${{ github.run_id }}" \
# RUN_MOBILESDK