Skip to content

Adding tests for appium iOS #17

Adding tests for appium iOS

Adding tests for appium iOS #17

name: iOS Appium Tests
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]
workflow_dispatch:
inputs:
ios_version:
description: 'iOS Version'
required: false
default: '17.5'
device_name:
description: 'Device Name'
required: false
default: 'iPhone 15 Pro'
appium2_driver_version:
description: 'Appium 2 axe-devtools driver version (e.g. 2.2.0-beta.abc123)'
required: false
default: '2.2.0-beta.f652cff'
appium3_driver_version:
description: 'Appium 3 axe-devtools driver version (e.g. 1.1.0-beta.abc123)'
required: false
default: '1.1.0-beta.f652cff'
env:
XCODE_VERSION: '15.4'
IOS_VERSION: ${{ github.event.inputs.ios_version || '17.5' }}
DEVICE_NAME: ${{ github.event.inputs.device_name || 'iPhone 15 Pro' }}
APPIUM_SKIP_CHROMEDRIVER_INSTALL: 1
ADT_APIKEY: ${{ secrets.AXE_APIKEY }}
AGORA_NPM_EMAIL: ${{ secrets.AGORA_NPM_EMAIL }}
AGORA_NPM_AUTH: ${{ secrets.DQ_AGORA_IDENTITY_TOKEN }}
AGORA_REGISTRY_URL: //agora.dequecloud.com/artifactory/api/npm/axe-devtools-mobile-appium-qa/
jobs:
build-app:
name: Build iOS App
runs-on: macos-14
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: List available Xcode versions
run: ls /Applications | grep Xcode
- name: Select Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
continue-on-error: true
- name: Fallback Xcode selection
if: failure()
run: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
- name: Show Xcode version
run: xcodebuild -version
- name: List available simulators
run: xcrun simctl list devices available
- name: Create build directory
run: mkdir -p build
- name: Build app for simulator
run: |
xcodebuild \
-project axe-devtools-ios-sample-app.xcodeproj \
-scheme axe-devtools-ios-sample-app \
-sdk iphonesimulator \
-configuration Release \
-derivedDataPath ./DerivedData \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGNING_REQUIRED=NO \
build
- name: Locate and copy built app
run: |
echo "Searching for built app..."
find ./DerivedData -name "*.app" -type d
echo "Copying app to build directory..."
cp -R ./DerivedData/Build/Products/Release-iphonesimulator/axe-devtools-ios-sample-app.app ./build/
- name: Verify app structure
run: |
ls -la ./build/axe-devtools-ios-sample-app.app
file ./build/axe-devtools-ios-sample-app.app/axe-devtools-ios-sample-app
- name: Upload app artifact
uses: actions/upload-artifact@v4
with:
name: ios-app
path: build/axe-devtools-ios-sample-app.app
retention-days: 1
test-appium-2:
name: Test with Appium 2
runs-on: macos-14
needs: build-app
strategy:
matrix:
xcuitest-driver-version: ['2.2.0-beta.f652cff']
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'npm'
cache-dependency-path: ./appium-tests/package.json
- name: Download app artifact
uses: actions/download-artifact@v4
with:
name: ios-app
path: build/Release-iphonesimulator/axe-devtools-ios-sample-app.app
- name: Verify downloaded app
run: |
echo "Checking downloaded app structure..."
ls -la build/Release-iphonesimulator/
ls -la build/Release-iphonesimulator/axe-devtools-ios-sample-app.app/
- name: Select Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
continue-on-error: true
- name: Fallback Xcode selection
if: failure()
run: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
- name: Install Appium 2.x
run: |
npm install -g appium@2
appium --version
- name: Configure npm for @axe-devtools registry
run: |
echo "Configuring npm for @axe-devtools driver..."
git config user.name "deque-mobileteam"
git config user.email "[email protected]"
npm config set "@deque:registry" "https:${{ env.AGORA_REGISTRY_URL }}"
npm config set "@axe-devtools:registry" "https:${{ env.AGORA_REGISTRY_URL }}"
npm config set "${{ env.AGORA_REGISTRY_URL }}:email" "${{ env.AGORA_NPM_EMAIL }}"
npm config set "${{ env.AGORA_REGISTRY_URL }}:_authToken" "${{ env.AGORA_NPM_AUTH }}"
- name: Install @axe-devtools XCUITest Driver
env:
APPIUM_HOME: ${{ github.workspace }}/.appium
run: |
DRIVER_VERSION="${{ github.event.inputs.appium2_driver_version || matrix.xcuitest-driver-version }}"
echo "Installing @axe-devtools/axe-appium-xcuitest-driver@${DRIVER_VERSION} to APPIUM_HOME=$APPIUM_HOME"
appium driver install --source=npm @axe-devtools/axe-appium-xcuitest-driver@${DRIVER_VERSION}
echo "Verifying driver installation..."
appium driver list
echo "Checking for AxeXCUITest driver..."
appium driver list | grep -i "axexcuitest" || echo "Warning: AxeXCUITest driver not found in list"
- name: Prepare and boot iOS simulator
id: prepareSimulator
uses: futureware-tech/simulator-action@v4
with:
model: "${{ env.DEVICE_NAME }}"
os_version: "${{ env.IOS_VERSION }}"
shutdown_after_job: true
- name: Wait for Simulator to finish booting
run: |
echo "Waiting for simulator ${{ steps.prepareSimulator.outputs.udid }} to boot..."
xcrun simctl bootstatus ${{ steps.prepareSimulator.outputs.udid }} -b
echo "✓ Simulator is fully booted"
- name: Verify simulator is ready
run: |
xcrun simctl list devices | grep "${{ steps.prepareSimulator.outputs.udid }}"
- name: Install dependencies
working-directory: appium-tests
run: npm ci
- name: Create test output directories
working-directory: appium-tests
run: |
mkdir -p screenshots
mkdir -p test-results
- name: Run Appium 2 tests
working-directory: appium-tests
env:
APP_PATH: ${{ github.workspace }}/build/Release-iphonesimulator/axe-devtools-ios-sample-app.app
IOS_VERSION: ${{ env.IOS_VERSION }}
DEVICE_NAME: ${{ env.DEVICE_NAME }}
APPIUM_HOME: ${{ github.workspace }}/.appium
run: npm run test:appium2
continue-on-error: true
- name: Display Appium logs
if: always()
working-directory: appium-tests
run: |
echo "========== Appium Server Logs =========="
cat appium.log 2>/dev/null || echo "No Appium logs found"
- name: Upload test results and logs
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-appium2-driver-${{ matrix.xcuitest-driver-version }}
path: |
appium-tests/test-results/
appium-tests/html-report/
appium-tests/screenshots/
appium-tests/appium.log
retention-days: 7
test-appium-3:
name: Test with Appium 3
runs-on: macos-14
needs: build-app
strategy:
matrix:
xcuitest-driver-version: ['1.1.0-beta.f652cff']
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'npm'
cache-dependency-path: ./appium-tests/package.json
- name: Download app artifact
uses: actions/download-artifact@v4
with:
name: ios-app
path: build/Release-iphonesimulator/axe-devtools-ios-sample-app.app
- name: Verify downloaded app
run: |
echo "Checking downloaded app structure..."
ls -la build/Release-iphonesimulator/
ls -la build/Release-iphonesimulator/axe-devtools-ios-sample-app.app/
- name: Select Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
continue-on-error: true
- name: Fallback Xcode selection
if: failure()
run: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
- name: Install Appium 3.x
run: |
npm install -g appium@next
appium --version
- name: Configure npm for @axe-devtools registry
run: |
echo "Configuring npm for @axe-devtools driver..."
git config user.name "deque-mobileteam"
git config user.email "[email protected]"
npm config set "@deque:registry" "https:${{ env.AGORA_REGISTRY_URL }}"
npm config set "@axe-devtools:registry" "https:${{ env.AGORA_REGISTRY_URL }}"
npm config set "${{ env.AGORA_REGISTRY_URL }}:email" "${{ env.AGORA_NPM_EMAIL }}"
npm config set "${{ env.AGORA_REGISTRY_URL }}:_authToken" "${{ env.AGORA_NPM_AUTH }}"
- name: Install @axe-devtools XCUITest Driver
env:
APPIUM_HOME: ${{ github.workspace }}/.appium
run: |
DRIVER_VERSION="${{ github.event.inputs.appium3_driver_version || matrix.xcuitest-driver-version }}"
echo "Installing @axe-devtools/axe-appium3-xcuitest-driver@${DRIVER_VERSION} to APPIUM_HOME=$APPIUM_HOME"
appium driver install --source=npm @axe-devtools/axe-appium3-xcuitest-driver@${DRIVER_VERSION}
echo "Verifying driver installation..."
appium driver list
echo "Checking for AxeXCUITest driver..."
appium driver list | grep -i "axexcuitest" || echo "Warning: AxeXCUITest driver not found in list"
- name: Prepare and boot iOS simulator
id: prepareSimulator
uses: futureware-tech/simulator-action@v4
with:
model: "${{ env.DEVICE_NAME }}"
os_version: "${{ env.IOS_VERSION }}"
shutdown_after_job: true
- name: Wait for Simulator to finish booting
run: |
echo "Waiting for simulator ${{ steps.prepareSimulator.outputs.udid }} to boot..."
xcrun simctl bootstatus ${{ steps.prepareSimulator.outputs.udid }} -b
echo "✓ Simulator is fully booted"
- name: Verify simulator is ready
run: |
xcrun simctl list devices | grep "${{ steps.prepareSimulator.outputs.udid }}"
- name: Install dependencies
working-directory: appium-tests
run: npm ci
- name: Create test output directories
working-directory: appium-tests
run: |
mkdir -p screenshots
mkdir -p test-results
- name: Run Appium 3 tests
working-directory: appium-tests
env:
APP_PATH: ${{ github.workspace }}/build/Release-iphonesimulator/axe-devtools-ios-sample-app.app
IOS_VERSION: ${{ env.IOS_VERSION }}
DEVICE_NAME: ${{ env.DEVICE_NAME }}
APPIUM_HOME: ${{ github.workspace }}/.appium
run: npm run test:appium3
continue-on-error: true
- name: Display Appium logs
if: always()
working-directory: appium-tests
run: |
echo "========== Appium Server Logs =========="
cat appium.log 2>/dev/null || echo "No Appium logs found"
- name: Upload test results and logs
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-appium3-driver-${{ matrix.xcuitest-driver-version }}
path: |
appium-tests/test-results/
appium-tests/html-report/
appium-tests/screenshots/
appium-tests/appium.log
retention-days: 7
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [test-appium-2, test-appium-3]
if: always()
steps:
- name: Summary
run: |
echo "## Test Execution Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ Build completed" >> $GITHUB_STEP_SUMMARY
echo "📱 Device: ${{ env.DEVICE_NAME }}" >> $GITHUB_STEP_SUMMARY
echo "📱 iOS Version: ${{ env.IOS_VERSION }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "🔧 Using @axe-devtools custom drivers" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Appium Versions Tested:" >> $GITHUB_STEP_SUMMARY
echo "- Appium 2.x with @axe-devtools driver version: 2.2.0-beta.f652cff" >> $GITHUB_STEP_SUMMARY
echo "- Appium 3.x with @axe-devtools driver version: 1.1.0-beta.f652cff" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Check the artifacts for detailed test results and screenshots." >> $GITHUB_STEP_SUMMARY