Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proof of concept - add patrol #282

Draft
wants to merge 54 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
039f1d1
Added patrol dependency and setup for Android
Robert-SD Sep 16, 2024
126d631
Added workflow
Robert-SD Sep 17, 2024
bc42b5b
Fixed
Robert-SD Sep 17, 2024
926f030
prepared ui test run on iPhone simulator
Robert-SD Sep 17, 2024
e26062b
Added patrol test step
Robert-SD Sep 17, 2024
e5f1771
Split patrol and simulator booting steps
Robert-SD Sep 17, 2024
099b0af
Added ios patrol integration
Robert-SD Sep 17, 2024
e25b936
Added patrol test for testing Drop-in and cards with session flow
Robert-SD Sep 17, 2024
af34313
prepare patrol tests for next implementation step
Robert-SD Sep 17, 2024
26642a9
Added android workflow for running ui tests
Robert-SD Sep 17, 2024
3e099fe
Added KVM
Robert-SD Sep 17, 2024
6e0066b
changed os
Robert-SD Sep 17, 2024
27c9941
Add emulator target
Robert-SD Sep 17, 2024
f7db762
test run
Robert-SD Sep 17, 2024
41e42a2
Test run
Robert-SD Sep 17, 2024
d32960e
Test run
Robert-SD Sep 17, 2024
325df77
Removed push trigger from ios run
Robert-SD Sep 17, 2024
fc99235
Test run
Robert-SD Sep 17, 2024
892baaa
used working directory
Robert-SD Sep 17, 2024
fb6b10d
Updated to java 17
Robert-SD Sep 17, 2024
4c76ad5
Added secrets to ui test runs
Robert-SD Oct 1, 2024
8fe0620
Test
Robert-SD Oct 1, 2024
7f59225
Updated to patrol 3.11.0
Robert-SD Oct 1, 2024
80a3282
Used test secrets for test run
Robert-SD Oct 1, 2024
812d950
Patrol test run
Robert-SD Oct 7, 2024
7e28fa6
specified patrol cli version
Robert-SD Oct 7, 2024
a4a940f
Test
Robert-SD Oct 7, 2024
6e296dd
Test
Robert-SD Oct 7, 2024
95ae4dc
Test run
Robert-SD Oct 7, 2024
17dd122
Set patrol to v3.10.0
Robert-SD Oct 7, 2024
ded9100
Another test run
Robert-SD Oct 7, 2024
5c5a7ca
Added profile
Robert-SD Oct 7, 2024
18903c9
show avds
Robert-SD Oct 7, 2024
57a348f
Test
Robert-SD Oct 7, 2024
4b36266
Test run
Robert-SD Oct 7, 2024
b563771
Updated profile to pixel 5
Robert-SD Oct 7, 2024
67e8d1e
Check devices
Robert-SD Oct 7, 2024
ebfe548
Clean workflow file
Robert-SD Oct 7, 2024
8fa7f7c
Added ui tests to CI
Robert-SD Oct 7, 2024
27ea724
Test run
Robert-SD Oct 8, 2024
3a7d224
Combined tests
Robert-SD Oct 8, 2024
f3ceb58
Test run
Robert-SD Oct 8, 2024
e7546b6
Updated patrol version
Robert-SD Oct 8, 2024
87b4dc4
Set java version to 17
Robert-SD Oct 8, 2024
ada1a68
Deleted test bundle from patrol
Robert-SD Oct 8, 2024
fb4d55f
Added patrol test bundle to gitignore
Robert-SD Oct 8, 2024
e79db56
removed profile
Robert-SD Oct 8, 2024
8365840
Changed clean build to closed prs
Robert-SD Oct 8, 2024
db3be52
inherited secrets
Robert-SD Oct 8, 2024
d420b86
Verbose run
Robert-SD Oct 8, 2024
b29c751
Added profile and avd name
Robert-SD Oct 8, 2024
e080bf8
Removed profile for emulator
Robert-SD Oct 9, 2024
5e0fe4b
Changed ideal payment method name example
Robert-SD Oct 14, 2024
765bf55
Add ios ui tests to the workflow
Robert-SD Oct 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 13 additions & 47 deletions .github/workflows/android_tests.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,23 @@
name: Android unit tests
name: Android tests

on:
workflow_call:
inputs:
flutter-version:
description: 'Flutter version'
required: true
default: '3.16.2'
default: '3.24.0'
type: string

jobs:
android_tests:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: example/android
timeout-minutes: 30

steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 18

- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ inputs.flutter-version }}
channel: 'stable'
cache: true

- run: flutter doctor -v
- run: flutter clean
- run: flutter pub get

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper

- name: Init gradle wrapper
run: gradle wrapper

- name: Lint check
run: ./gradlew ktlintCheck lintReportDebug

- name: Unit tests with code coverage reporting
run: ./gradlew jacocoTestReport

- name: Cache android reports
uses: actions/cache/save@v4
id: save-android-reports
with:
path: example/build/adyen_checkout/reports
key: android-reports
android_unit_tests:
name: Android unit tests
uses: ./.github/workflows/android_unit_tests.yml
with:
flutter-version: ${{ needs.preparation.outputs.FLUTTER_VERSION }}
android_ui_tests:
name: Android ui tests
uses: ./.github/workflows/android_ui_tests.yml
with:
flutter-version: ${{ needs.preparation.outputs.FLUTTER_VERSION }}
secrets: inherit
62 changes: 62 additions & 0 deletions .github/workflows/android_ui_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Android ui tests

on:
workflow_dispatch:
workflow_call:
inputs:
flutter-version:
description: 'Flutter version'
required: true
default: '3.24.0'
type: string

jobs:
android_ui_tests:
runs-on: ubuntu-22.04

steps:
- name: Provide more disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"

- 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

- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ inputs.flutter-version }}
channel: 'stable'
cache: true
cache-key: ${{ env.FLUTTER_VERSION }}

- run: flutter pub get
- run: dart pub global activate patrol_cli
- run: patrol doctor

- name: Boot emulator and run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
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: false
working-directory: ./example
avd-name: avd-34-x64
script: |
echo "Emulator launched"
patrol test -t integration_test/drop_in_test/drop_in_card_test.dart --dart-define=CLIENT_KEY='${{ secrets.ADYEN_TEST_CLIENT_KEY }}' --dart-define=X_API_KEY='${{ secrets.ADYEN_TEST_X_API_KEY }}' -d emulator-5554 --verbose
55 changes: 55 additions & 0 deletions .github/workflows/android_unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Android unit tests

on:
workflow_call:
inputs:
flutter-version:
description: 'Flutter version'
required: true
default: '3.24.0'
type: string

jobs:
android_tests:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: example/android

steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ inputs.flutter-version }}
channel: 'stable'
cache: true
cache-key: ${{ env.FLUTTER_VERSION }}

- run: flutter pub get

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper

- name: Init gradle wrapper
run: gradle wrapper

- name: Lint check
run: ./gradlew ktlintCheck lintReportDebug

- name: Unit tests with code coverage reporting
run: ./gradlew jacocoTestReport

- name: Cache android reports
uses: actions/cache/save@v4
id: save-android-reports
with:
path: example/build/adyen_checkout/reports
key: android-reports
9 changes: 8 additions & 1 deletion .github/workflows/check_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ jobs:
outputs:
FLUTTER_VERSION: ${{ env.FLUTTER_VERSION }}
steps:
- run: echo ""
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: 'stable'
cache: true
cache-key: ${{ env.FLUTTER_VERSION }}

test_flutter:
name: Flutter tests
Expand All @@ -31,12 +36,14 @@ jobs:
uses: ./.github/workflows/android_tests.yml
with:
flutter-version: ${{ needs.preparation.outputs.FLUTTER_VERSION }}
secrets: inherit
test_ios:
name: iOS tests
needs: [ preparation ]
uses: ./.github/workflows/ios_tests.yml
with:
flutter-version: ${{ needs.preparation.outputs.FLUTTER_VERSION }}
secrets: inherit
sonar_cloud:
name: Sonar cloud
needs: [ test_android, test_ios ]
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/clean_build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ name: Clean build test
on:
workflow_dispatch:
pull_request:
branches: [ "main" ]
branches:
- main
types:
- closed
push:
tags:
- '*'
Expand Down
56 changes: 13 additions & 43 deletions .github/workflows/ios_tests.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,23 @@
name: Swift unit tests
name: iOS tests

on:
workflow_call:
inputs:
flutter-version:
description: 'Flutter version'
required: true
default: '3.16.2'
default: '3.24.0'
type: string

jobs:
ios_tests:
runs-on: macos-13
defaults:
run:
working-directory: example/ios
timeout-minutes: 30

steps:
- uses: actions/checkout@v4

- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ inputs.flutter-version }}
channel: 'stable'
cache: true

- run: flutter doctor -v
- run: flutter clean
- run: flutter pub get

- name: Pod install
run: pod install

- name: Lint check
working-directory: ios
run: swiftlint --config .swiftlint.yml --output "swiftLintReport.json"

- name: Cache iOS reports
uses: actions/cache/save@v4
id: save-iOS-reports
with:
path: ios/
key: ios-reports

- name: Run ios unit tests
run: |
xcodebuild test \
-workspace Runner.xcworkspace \
-scheme Runner \
-destination "platform=iOS Simulator,name=iPhone 14" \
-enableCodeCoverage YES | xcpretty --utf --color && exit ${PIPESTATUS[0]}
ios_unit_tests:
name: iOS unit tests
uses: ./.github/workflows/ios_unit_tests.yml
with:
flutter-version: ${{ needs.preparation.outputs.FLUTTER_VERSION }}
android_ui_tests:
name: iOS ui tests
uses: ./.github/workflows/ios_ui_tests.yml
with:
flutter-version: ${{ needs.preparation.outputs.FLUTTER_VERSION }}
secrets: inherit
37 changes: 37 additions & 0 deletions .github/workflows/ios_ui_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: iOS ui tests

on:
workflow_dispatch:
workflow_call:
inputs:
flutter-version:
description: 'Flutter version'
required: true
default: '3.24.0'
type: string

jobs:
ios_ui_tests:
runs-on: macos-14

steps:
- name: Provide more disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"

- uses: actions/checkout@v4

- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ inputs.flutter-version }}
channel: 'stable'
cache: true
cache-key: ${{ env.FLUTTER_VERSION }}

- run: flutter pub get
- run: dart pub global activate patrol_cli
- run: patrol doctor
- run: open -a Simulator && xcrun simctl boot 'iPhone 15'
- run: patrol test -t example/integration_test/drop_in_test/open_drop_in_test.dart --dart-define=CLIENT_KEY='${{ secrets.ADYEN_TEST_CLIENT_KEY }}' --dart-define=X_API_KEY='${{ secrets.ADYEN_TEST_X_API_KEY }}' -d 'iPhone 15'
53 changes: 53 additions & 0 deletions .github/workflows/ios_unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: iOS unit tests

on:
workflow_call:
inputs:
flutter-version:
description: 'Flutter version'
required: true
default: '3.24.0'
type: string

jobs:
ios_tests:
runs-on: macos-13
defaults:
run:
working-directory: example/ios
timeout-minutes: 30

steps:
- uses: actions/checkout@v4

- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ inputs.flutter-version }}
channel: 'stable'
cache: true

- run: flutter doctor -v
- run: flutter clean
- run: flutter pub get

- name: Pod install
run: pod install

- name: Lint check
working-directory: ios
run: swiftlint --config .swiftlint.yml --output "swiftLintReport.json"

- name: Cache iOS reports
uses: actions/cache/save@v4
id: save-iOS-reports
with:
path: ios/
key: ios-reports

- name: Run ios unit tests
run: |
xcodebuild test \
-workspace Runner.xcworkspace \
-scheme Runner \
-destination "platform=iOS Simulator,name=iPhone 14" \
-enableCodeCoverage YES | xcpretty --utf --color && exit ${PIPESTATUS[0]}
Loading
Loading