diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 111ae78..91b64bc 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -9,18 +9,46 @@ on: jobs: build: - runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + - name: Build apk + run: flutter build apk --debug + - name: Upload APK + uses: actions/upload-artifact@v4 + with: + name: app_debug + path: build/app/outputs/flutter-apk/app-debug.apk + integration-tests: + runs-on: ubuntu-latest + strategy: + matrix: + api-level: [ 34 ] + target: [ playstore ] + needs: [ build ] steps: - - uses: actions/checkout@v4 - - uses: subosito/flutter-action@v2 - with: + - uses: actions/checkout@v4 + - uses: subosito/flutter-action@v2 + with: channel: 'stable' - - name: Build apk - run: flutter build apk --debug - - name: Upload APK - uses: actions/upload-artifact@v4 - with: - name: app_debug - path: build/app/outputs/flutter-apk/app-debug.apk + - name: Retrieve dependencies + run: dart pub get + - name: Generate tests + run: dart run build_runner build --delete-conflicting-outputs + - 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: Run Flutter Driver tests + uses: reactivecircus/android-emulator-runner@v2 + with: + target: ${{ matrix.target }} + api-level: ${{ matrix.api-level }} + arch: x86_64 + profile: Nexus 6 + script: flutter test integration_test diff --git a/.gitignore b/.gitignore index 6503b5e..1904278 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release +integration_test/*_test.dart diff --git a/README.md b/README.md index 4e1bc35..df5abe0 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,18 @@ To retrieve execute the following command from your wsl machine : ip add | grep "eth0 ``` -### Generating translation +### Generate translation ```shell flutter clean flutter pub get -``` \ No newline at end of file +``` + +### Generate integration tests +```shell +dart run build_runner build --delete-conflicting-outputs +``` + +### Run integration tests +```shell +flutter test integration_test +``` diff --git a/build.yaml b/build.yaml index 4faa097..0b86d16 100644 --- a/build.yaml +++ b/build.yaml @@ -1,5 +1,12 @@ targets: $default: + sources: + - integration_test/** # By default, build runner will not generate code in the integration folder + - test/** # so we override paths for code generation here + - lib/** + - $package$ builders: + bdd_widget_test|featureBuilder: + enabled: false uuv_flutter|generateTests: - options: \ No newline at end of file + enabled: true diff --git a/integration_test/panoramax.feature b/integration_test/panoramax.feature new file mode 100644 index 0000000..467c6bb --- /dev/null +++ b/integration_test/panoramax.feature @@ -0,0 +1,13 @@ +Feature: Panoramax mobile App + + Scenario: Homepage + Given the app is running + Then I should see a title named {'Your sequences'} + And I should see a button named {'Create a new sequence'} + + Scenario: Capture page + Given the app is running + When I tap on a button named {'Create a new sequence'} + Then I should see a button named {'Take a picture'} + And I should see a button named {'Switch camera'} + And I should see a button named {'Create a new sequence with captured pictures'} \ No newline at end of file diff --git a/integration_test/step/the_app_is_running.dart b/integration_test/step/the_app_is_running.dart new file mode 100644 index 0000000..eec2a31 --- /dev/null +++ b/integration_test/step/the_app_is_running.dart @@ -0,0 +1,6 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:panoramax_mobile/main.dart'; + +Future theAppIsRunning(WidgetTester tester) async { + await tester.pumpWidget(const PanoramaxApp()); +} diff --git a/pubspec.lock b/pubspec.lock index f7d94ed..4837852 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -41,6 +41,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.2" + bdd_widget_test: + dependency: transitive + description: + name: bdd_widget_test + sha256: a5acecd2eed66c12cb20fae0f664b64a35c82dd7cc103c15da6d460a62821112 + url: "https://pub.dev" + source: hosted + version: "1.6.4" boolean_selector: dependency: transitive description: @@ -213,10 +221,10 @@ packages: dependency: transitive description: name: coverage - sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76" + sha256: "595a29b55ce82d53398e1bcc2cba525d7bd7c59faeb2d2540e9d42c390cfeeeb" url: "https://pub.dev" source: hosted - version: "1.7.2" + version: "1.6.4" cross_file: dependency: transitive description: @@ -249,6 +257,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.2" + diacritic: + dependency: transitive + description: + name: diacritic + sha256: "96db5db6149cbe4aa3cfcbfd170aca9b7648639be7e48025f9d458517f807fe4" + url: "https://pub.dev" + source: hosted + version: "0.1.5" equatable: dependency: "direct main" description: @@ -277,10 +293,10 @@ packages: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "6.1.4" fixnum: dependency: transitive description: @@ -294,6 +310,11 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_driver: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" flutter_exif_plugin: dependency: "direct main" description: @@ -302,6 +323,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + flutter_finder_usercentric: + dependency: transitive + description: + name: flutter_finder_usercentric + sha256: "7005c1230fa6d1b7b186cb32769eaaf21b497c980671973540190667d63931a9" + url: "https://pub.dev" + source: hosted + version: "0.0.1-beta" flutter_lints: dependency: "direct dev" description: @@ -349,6 +378,11 @@ packages: url: "https://pub.dev" source: hosted version: "3.2.0" + fuchsia_remote_debug_protocol: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" geolocator: dependency: "direct main" description: @@ -453,6 +487,11 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" + integration_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" intl: dependency: "direct main" description: @@ -621,6 +660,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.1" + patrol_finders: + dependency: transitive + description: + name: patrol_finders + sha256: ac33527cc1b63e3aa131dbd7107cfda8ee2df0fb4a4a423c067174a2e60db77b + url: "https://pub.dev" + source: hosted + version: "2.0.2" permission_handler: dependency: "direct main" description: @@ -673,10 +720,10 @@ packages: dependency: transitive description: name: platform - sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59" + sha256: ae68c7bfcd7383af3629daafb32fb4e8681c7154428da4febcff06200585f102 url: "https://pub.dev" source: hosted - version: "3.1.3" + version: "3.1.2" plugin_platform_interface: dependency: transitive description: @@ -693,6 +740,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.5.1" + process: + dependency: transitive + description: + name: process + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + url: "https://pub.dev" + source: hosted + version: "4.2.4" pub_semver: dependency: transitive description: @@ -882,6 +937,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + sync_http: + dependency: transitive + description: + name: sync_http + sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961" + url: "https://pub.dev" + source: hosted + version: "0.3.1" term_glyph: dependency: transitive description: @@ -938,6 +1001,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.3.3" + uuv_flutter: + dependency: "direct dev" + description: + name: uuv_flutter + sha256: f12e43346b04d86d341c589c9af52e826d7183fe8bbf9ab8c0878002bc1027dd + url: "https://pub.dev" + source: hosted + version: "0.0.1-beta.1" vector_math: dependency: transitive description: @@ -950,10 +1021,10 @@ packages: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "11.10.0" watcher: dependency: transitive description: @@ -978,6 +1049,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.4.0" + webdriver: + dependency: transitive + description: + name: webdriver + sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49" + url: "https://pub.dev" + source: hosted + version: "3.0.2" webkit_inspection_protocol: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 0bcbeac..d3b21dc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -53,8 +53,13 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter + flutter_driver: + sdk: flutter + integration_test: + sdk: flutter test: ^1.3.0 build_runner: ^2.4.7 + uuv_flutter: ^0.0.1-beta.1 # The "flutter_lints" package below contains a set of recommended lints to