Skip to content

Commit 9cfb274

Browse files
authored
ci: [SDK-4333] add appium E2E infrastructure with smoke test (#27)
1 parent aeb9120 commit 9cfb274

12 files changed

Lines changed: 8638 additions & 0 deletions

File tree

.github/workflows/appium-e2e.yml

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