|
| 1 | +name: Functional Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - 'release/**' |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + - 'release/**' |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +env: |
| 15 | + BUILD_CONFIGURATION: 'Release' |
| 16 | + CI: true |
| 17 | + DOTNET_VERSION: '8.0.x' |
| 18 | + NODE_VERSION: 'lts/*' |
| 19 | + |
| 20 | +jobs: |
| 21 | + android-tests: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + api-level: [32] |
| 28 | + target: [google_apis] |
| 29 | + |
| 30 | + env: |
| 31 | + APPIUM_LOG_PATH: '${{ github.workspace }}/appium.log' |
| 32 | + |
| 33 | + steps: |
| 34 | + - name: Checkout code |
| 35 | + uses: actions/checkout@v6 |
| 36 | + |
| 37 | + - name: Setup .NET |
| 38 | + uses: actions/setup-dotnet@v5 |
| 39 | + with: |
| 40 | + dotnet-version: ${{ env.DOTNET_VERSION }} |
| 41 | + |
| 42 | + - name: Enable KVM |
| 43 | + run: | |
| 44 | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules |
| 45 | + sudo udevadm control --reload-rules |
| 46 | + sudo udevadm trigger --name-match=kvm |
| 47 | +
|
| 48 | + - name: Setup Java |
| 49 | + uses: actions/setup-java@v5 |
| 50 | + with: |
| 51 | + distribution: 'temurin' |
| 52 | + java-version: '17' |
| 53 | + |
| 54 | + - name: Setup Android SDK |
| 55 | + uses: android-actions/setup-android@v3 |
| 56 | + |
| 57 | + - name: AVD cache |
| 58 | + uses: actions/cache@v5 |
| 59 | + id: avd-cache |
| 60 | + with: |
| 61 | + path: | |
| 62 | + ~/.android/avd/* |
| 63 | + ~/.android/adb* |
| 64 | + key: avd-${{ matrix.api-level }} |
| 65 | + |
| 66 | + - name: Create AVD and generate snapshot for caching |
| 67 | + if: steps.avd-cache.outputs.cache-hit != 'true' |
| 68 | + uses: reactivecircus/android-emulator-runner@v2 |
| 69 | + with: |
| 70 | + api-level: ${{ matrix.api-level }} |
| 71 | + target: ${{ matrix.target }} |
| 72 | + arch: x86_64 |
| 73 | + force-avd-creation: false |
| 74 | + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none |
| 75 | + disable-animations: false |
| 76 | + script: echo "Generated AVD snapshot for caching." |
| 77 | + |
| 78 | + - name: Setup Node.js |
| 79 | + uses: actions/setup-node@v6 |
| 80 | + with: |
| 81 | + node-version: ${{ env.NODE_VERSION }} |
| 82 | + |
| 83 | + - name: Install Appium |
| 84 | + run: npm install -g appium |
| 85 | + |
| 86 | + - name: Install Android drivers |
| 87 | + run: | |
| 88 | + appium driver install uiautomator2 |
| 89 | + appium driver install espresso |
| 90 | +
|
| 91 | + - name: Restore dependencies |
| 92 | + run: dotnet restore Appium.Net.sln |
| 93 | + |
| 94 | + - name: Build solution |
| 95 | + run: dotnet build Appium.Net.sln --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore |
| 96 | + |
| 97 | + - name: Create test environment file |
| 98 | + run: | |
| 99 | + cat > ./test/integration/env.json << 'EOF' |
| 100 | + { |
| 101 | + "DEV": "false", |
| 102 | + "isRemoteAppiumServer": "false", |
| 103 | + "remoteAppiumServerUri": "http://localhost:4723" |
| 104 | + } |
| 105 | + EOF |
| 106 | +
|
| 107 | + - name: Run Android functional tests |
| 108 | + uses: reactivecircus/android-emulator-runner@v2 |
| 109 | + with: |
| 110 | + api-level: ${{ matrix.api-level }} |
| 111 | + target: ${{ matrix.target }} |
| 112 | + arch: x86_64 |
| 113 | + force-avd-creation: false |
| 114 | + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none |
| 115 | + disable-animations: true |
| 116 | + script: | |
| 117 | + dotnet test --configuration ${{ env.BUILD_CONFIGURATION }} --no-build --framework net8.0 --filter "FullyQualifiedName~Android|FullyQualifiedName~CustomCommand" --logger "trx;LogFileName=android-test-results.trx" --logger "console;verbosity=detailed" ./test/integration/Appium.Net.Integration.Tests.csproj |
| 118 | +
|
| 119 | + # Common: Publish results |
| 120 | + - name: Publish test results |
| 121 | + uses: dorny/test-reporter@v2 |
| 122 | + if: always() |
| 123 | + with: |
| 124 | + name: Android Test Results (API ${{ matrix.api-level }}) |
| 125 | + path: '**/android-test-results.trx' |
| 126 | + reporter: dotnet-trx |
| 127 | + |
| 128 | + - name: Save server output |
| 129 | + if: always() |
| 130 | + uses: actions/upload-artifact@v6 |
| 131 | + with: |
| 132 | + name: appium-android-${{ matrix.api-level }}.log |
| 133 | + path: appium*.log |
| 134 | + if-no-files-found: ignore |
| 135 | + |
| 136 | + ios-tests: |
| 137 | + runs-on: macos-15 |
| 138 | + |
| 139 | + env: |
| 140 | + APPIUM_LOG_PATH: '${{ github.workspace }}/appium-ios.log' |
| 141 | + IOS_DEVICE_NAME: 'iPhone 16' |
| 142 | + IOS_VERSION: '18.5' |
| 143 | + XCODE_VERSION: '16.4' |
| 144 | + |
| 145 | + steps: |
| 146 | + # Common: Checkout and setup |
| 147 | + - name: Checkout code |
| 148 | + uses: actions/checkout@v6 |
| 149 | + |
| 150 | + - name: Setup .NET |
| 151 | + uses: actions/setup-dotnet@v5 |
| 152 | + with: |
| 153 | + dotnet-version: ${{ env.DOTNET_VERSION }} |
| 154 | + |
| 155 | + - name: Select Xcode |
| 156 | + uses: maxim-lobanov/setup-xcode@v1 |
| 157 | + with: |
| 158 | + xcode-version: ${{ env.XCODE_VERSION }} |
| 159 | + |
| 160 | + - name: Disable pasteboard sync |
| 161 | + run: defaults write com.apple.iphonesimulator PasteboardAutomaticSync -bool false |
| 162 | + |
| 163 | + - name: Setup Node.js |
| 164 | + uses: actions/setup-node@v6 |
| 165 | + with: |
| 166 | + node-version: ${{ env.NODE_VERSION }} |
| 167 | + |
| 168 | + - name: Install Appium |
| 169 | + run: npm install -g appium |
| 170 | + |
| 171 | + - name: Install ffmpeg |
| 172 | + run: brew install ffmpeg |
| 173 | + |
| 174 | + - name: Install XCUITest driver |
| 175 | + run: appium driver install xcuitest |
| 176 | + |
| 177 | + - name: Download prebuilt WDA |
| 178 | + run: npx appium driver run xcuitest download-wda-sim --platform=ios --outdir=${{ github.workspace }}/wda |
| 179 | + |
| 180 | + - name: Setup iOS Simulator |
| 181 | + uses: futureware-tech/simulator-action@v4 |
| 182 | + with: |
| 183 | + model: ${{ env.IOS_DEVICE_NAME }} |
| 184 | + os_version: ${{ env.IOS_VERSION }} |
| 185 | + wait_for_boot: true |
| 186 | + shutdown_after_job: false |
| 187 | + |
| 188 | + - name: Restore dependencies |
| 189 | + run: dotnet restore Appium.Net.sln |
| 190 | + |
| 191 | + - name: Build solution |
| 192 | + run: dotnet build Appium.Net.sln --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore |
| 193 | + |
| 194 | + - name: Create test environment file |
| 195 | + run: | |
| 196 | + cat > ./test/integration/env.json << 'EOF' |
| 197 | + { |
| 198 | + "DEV": "false", |
| 199 | + "isRemoteAppiumServer": "false", |
| 200 | + "remoteAppiumServerUri": "http://127.0.0.1:4723" |
| 201 | + } |
| 202 | + EOF |
| 203 | +
|
| 204 | + - name: Run iOS functional tests |
| 205 | + env: |
| 206 | + LOCAL_PREBUILT_WDA: ${{ github.workspace }}/wda/WebDriverAgentRunner-Runner.app |
| 207 | + run: | |
| 208 | + dotnet test --configuration ${{ env.BUILD_CONFIGURATION }} \ |
| 209 | + --no-build \ |
| 210 | + --framework net8.0 \ |
| 211 | + --filter "FullyQualifiedName~IOS" \ |
| 212 | + --logger "trx;LogFileName=ios-test-results.trx" \ |
| 213 | + --logger "console;verbosity=detailed" \ |
| 214 | + ./test/integration/Appium.Net.Integration.Tests.csproj |
| 215 | +
|
| 216 | + - name: Publish test results |
| 217 | + uses: dorny/test-reporter@v2 |
| 218 | + if: always() |
| 219 | + with: |
| 220 | + name: iOS Test Results |
| 221 | + path: '**/ios-test-results.trx' |
| 222 | + reporter: dotnet-trx |
| 223 | + |
| 224 | + - name: Save server output |
| 225 | + if: always() |
| 226 | + uses: actions/upload-artifact@v6 |
| 227 | + with: |
| 228 | + name: appium-ios.log |
| 229 | + path: | |
| 230 | + appium*.log |
| 231 | + *.log |
| 232 | + if-no-files-found: ignore |
0 commit comments