-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1561 from Adyen/setup-ui-testing
Setup UI testing
- Loading branch information
Showing
19 changed files
with
441 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: UI Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'develop' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
ui-test: | ||
name: Run UI tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
# Define the Android version you want to run UI tests for here. | ||
api-level: [ 34 ] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Enable KVM | ||
run: | | ||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | ||
sudo udevadm control --reload-rules | ||
sudo udevadm trigger --name-match=kvm | ||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: 17 | ||
|
||
- name: Gradle cache | ||
uses: gradle/actions/setup-gradle@v3 | ||
with: | ||
cache-read-only: false | ||
|
||
- name: AVD cache | ||
uses: actions/cache@v4 | ||
id: avd-cache | ||
with: | ||
path: | | ||
~/.android/avd/* | ||
~/.android/adb* | ||
key: avd-${{ matrix.api-level }} | ||
|
||
- name: Create AVD and generate snapshot for caching | ||
if: steps.avd-cache.outputs.cache-hit != 'true' | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
api-level: ${{ matrix.api-level }} | ||
target: google_apis | ||
arch: x86_64 | ||
force-avd-creation: false | ||
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | ||
disable-animations: false | ||
script: echo "Generated AVD snapshot for caching." | ||
|
||
- name: Run connectedDebugAndroidTest | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
env: | ||
ADYEN_ANDROID_MERCHANT_SERVER_URL: 'https://android-ui-tests.adyen.com/' | ||
ADYEN_ANDROID_CLIENT_KEY: 'test_fakefakefakefakefakefakefakefake' | ||
with: | ||
api-level: ${{ matrix.api-level }} | ||
target: google_apis | ||
arch: x86_64 | ||
force-avd-creation: false | ||
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | ||
disable-animations: true | ||
script: ./gradlew connectedDebugAndroidTest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
android { | ||
buildTypes { | ||
|
||
def merchantAccount = System.getenv('ADYEN_ANDROID_MERCHANT_ACCOUNT') | ||
def merchantServerUrl = System.getenv('ADYEN_ANDROID_MERCHANT_SERVER_URL') | ||
def authorizationHeaderName = System.getenv('ADYEN_ANDROID_AUTHORIZATION_HEADER_NAME') | ||
def authorizationHeaderValue = System.getenv('ADYEN_ANDROID_AUTHORIZATION_HEADER_VALUE') | ||
def clientKey = System.getenv('ADYEN_ANDROID_CLIENT_KEY') | ||
|
||
debug { | ||
buildConfigField "String", "MERCHANT_ACCOUNT", "\"$merchantAccount\"" | ||
buildConfigField "String", "MERCHANT_SERVER_URL", "\"$merchantServerUrl\"" | ||
buildConfigField "String", "AUTHORIZATION_HEADER_NAME", "\"$authorizationHeaderName\"" | ||
buildConfigField "String", "AUTHORIZATION_HEADER_VALUE", "\"$authorizationHeaderValue\"" | ||
buildConfigField "String", "CLIENT_KEY", "\"$clientKey\"" | ||
buildConfigField "String", "MERCHANT_RECURRING_SERVER_URL", "\"$merchantServerUrl\"" | ||
} | ||
|
||
release { | ||
initWith debug | ||
matchingFallbacks = ['debug'] | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
example-app/src/androidTest/java/com/adyen/checkout/HiltTestRunner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (c) 2024 Adyen N.V. | ||
* | ||
* This file is open source and available under the MIT license. See the LICENSE file for more info. | ||
* | ||
* Created by oscars on 19/4/2024. | ||
*/ | ||
|
||
package com.adyen.checkout | ||
|
||
import android.app.Application | ||
import android.content.Context | ||
import androidx.test.runner.AndroidJUnitRunner | ||
import dagger.hilt.android.testing.HiltTestApplication | ||
|
||
// This class is used from build.gradle | ||
@Suppress("Unused") | ||
class HiltTestRunner : AndroidJUnitRunner() { | ||
|
||
override fun newApplication(cl: ClassLoader?, name: String?, context: Context?): Application { | ||
return super.newApplication(cl, HiltTestApplication::class.java.name, context) | ||
} | ||
} |
Oops, something went wrong.