Skip to content

Commit 19b04da

Browse files
committed
ci: add appium E2E infrastructure with smoke test
Add shared Appium testing setup for OneSignal SDK wrappers: - WebDriverIO configs for iOS/Android (local + BrowserStack) - Test helpers for app interaction, logging, and selectors - GitHub Actions composite action for CI integration - Smoke test placeholder to validate the pipeline Made-with: Cursor
1 parent aeb9120 commit 19b04da

12 files changed

Lines changed: 8625 additions & 0 deletions

File tree

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: 'Appium E2E Tests'
2+
description: 'Run Appium E2E tests on BrowserStack App Automate'
3+
4+
inputs:
5+
platform:
6+
description: 'Target platform: android or ios'
7+
required: true
8+
app-path:
9+
description: 'Path to built APK or .app/.ipa bundle'
10+
required: true
11+
sdk-type:
12+
description: 'SDK type: react-native, flutter, capacitor, ios-native, or android-native'
13+
required: true
14+
browserstack-username:
15+
description: 'BrowserStack username'
16+
required: true
17+
browserstack-access-key:
18+
description: 'BrowserStack access key'
19+
required: true
20+
device:
21+
description: 'BrowserStack device name'
22+
required: false
23+
os-version:
24+
description: 'Device OS version'
25+
required: false
26+
test-spec:
27+
description: 'Glob for which specs to run'
28+
required: false
29+
default: 'tests/specs/**/*.spec.ts'
30+
onesignal-app-id:
31+
description: 'OneSignal App ID dedicated to E2E tests'
32+
required: false
33+
onesignal-api-key:
34+
description: 'OneSignal API key dedicated to E2E tests'
35+
required: false
36+
build-name:
37+
description: 'Label for the BrowserStack session'
38+
required: false
39+
40+
runs:
41+
using: 'composite'
42+
steps:
43+
- name: Checkout sdk-shared (for test files)
44+
uses: actions/checkout@v4
45+
with:
46+
repository: OneSignal/sdk-shared
47+
path: _sdk-shared
48+
49+
- name: Setup Node.js
50+
uses: actions/setup-node@v4
51+
with:
52+
node-version: '20'
53+
54+
- name: Upload app to BrowserStack
55+
id: bs-upload
56+
shell: bash
57+
env:
58+
BROWSERSTACK_USERNAME: ${{ inputs.browserstack-username }}
59+
BROWSERSTACK_ACCESS_KEY: ${{ inputs.browserstack-access-key }}
60+
run: |
61+
RESPONSE=$(curl -s -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \
62+
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
63+
-F "file=@${{ inputs.app-path }}")
64+
APP_URL=$(echo "$RESPONSE" | jq -r '.app_url')
65+
if [ "$APP_URL" = "null" ] || [ -z "$APP_URL" ]; then
66+
echo "::error::Failed to upload app to BrowserStack: $RESPONSE"
67+
exit 1
68+
fi
69+
echo "app-url=$APP_URL" >> "$GITHUB_OUTPUT"
70+
echo "Uploaded app to BrowserStack: $APP_URL"
71+
72+
- name: Install test dependencies
73+
shell: bash
74+
working-directory: _sdk-shared/appium
75+
run: npm ci
76+
77+
- name: Run Appium tests
78+
shell: bash
79+
working-directory: _sdk-shared/appium
80+
env:
81+
BROWSERSTACK_USERNAME: ${{ inputs.browserstack-username }}
82+
BROWSERSTACK_ACCESS_KEY: ${{ inputs.browserstack-access-key }}
83+
BROWSERSTACK_APP_URL: ${{ steps.bs-upload.outputs.app-url }}
84+
SDK_TYPE: ${{ inputs.sdk-type }}
85+
DEVICE: ${{ inputs.device }}
86+
OS_VERSION: ${{ inputs.os-version }}
87+
BUILD_NAME: ${{ inputs.build-name }}
88+
ONESIGNAL_APP_ID: ${{ inputs.onesignal-app-id }}
89+
ONESIGNAL_API_KEY: ${{ inputs.onesignal-api-key }}
90+
run: |
91+
npx wdio run wdio.${{ inputs.platform }}.conf.ts \
92+
--spec '${{ inputs.test-spec }}'
93+
94+
- name: Upload test results
95+
if: always()
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: appium-results-${{ inputs.platform }}-${{ inputs.sdk-type }}
99+
path: _sdk-shared/appium/results/
100+
if-no-files-found: ignore

appium/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
dist/
3+
results/

0 commit comments

Comments
 (0)