Compare commits

...

7 commits

Author SHA1 Message Date
Vadim
6faa9e12a0 increased tests timeout 2024-03-12 22:53:18 +01:00
Vadim
60dd9549e8 bumped macos version 2024-03-12 22:21:57 +01:00
Vadim
1d6cc13d7d try running only on ios 2024-03-12 22:07:18 +01:00
Vadim
6d1fd9e05a added no-dds to flutter drive 2024-03-12 21:52:56 +01:00
Vadim
cd5949470b try running tests only for one platform 2024-03-12 20:55:12 +01:00
Vadim
20b4c387c1 removed app pre-build 2024-03-12 20:16:31 +01:00
Vadim
ed45052317 use flutter drive for integration tests 2024-03-12 20:04:56 +01:00
5 changed files with 25 additions and 41 deletions

View file

@ -0,0 +1,6 @@
flutter drive \
--target=integration_test/e2e_test.dart \
--driver=test_driver/integration_driver.dart \
--flavor=dev \
--no-dds \
--dart-define cameraStubImage=assets/camera_stub_image.jpg

View file

@ -9,19 +9,11 @@ on:
workflow_dispatch: workflow_dispatch:
workflow_call: workflow_call:
env:
BUILD_ARGS: --flavor dev --dart-define cameraStubImage=assets/camera_stub_image.jpg
TARGET: integration_test/run_all_tests.dart
jobs: jobs:
run-integration-tests: run-integration-tests:
name: Run integration tests name: Run integration tests
timeout-minutes: 30 timeout-minutes: 60
strategy: runs-on: macos-13
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13]
runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
@ -42,42 +34,23 @@ jobs:
channel: "stable" channel: "stable"
flutter-version: "3.10.0" flutter-version: "3.10.0"
- name: Build app - name: Prepare app
run: | run: |
flutter --version flutter --version
flutter pub get flutter pub get
flutter pub run intl_utils:generate flutter pub run intl_utils:generate
flutter analyze lib --fatal-infos flutter analyze lib --fatal-infos
if [ "${{ matrix.os }}" == "macos-13" ]
then
cd ios
pod install
cd ..
fi
flutter build ${{ matrix.os == 'ubuntu-latest' && 'apk --debug' || 'ios --no-codesign --simulator --debug' }} $BUILD_ARGS -t $TARGET
- name: Enable KVM
if: ${{ matrix.os == 'ubuntu-latest' }}
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: Launch Android simulator & Run tests
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 32
target: default
arch: x86_64
profile: pixel_6
script: flutter test $TARGET $BUILD_ARGS
- name: Launch iOS simulator - name: Launch iOS simulator
uses: futureware-tech/simulator-action@v3 uses: futureware-tech/simulator-action@v3
if: ${{ matrix.os == 'macos-13' }}
with: with:
model: "iPhone 15 Pro" model: "iPhone 15 Pro"
- name: Run tests - name: Run tests
if: ${{ matrix.os == 'macos-13' }} run: |
run: flutter test $TARGET $BUILD_ARGS flutter drive \
--target=integration_test/e2e_test.dart \
--driver=test_driver/integration_driver.dart \
--flavor=dev \
--no-dds \
--dart-define cameraStubImage=assets/camera_stub_image.jpg

View file

@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:lightmeter/data/models/ev_source_type.dart'; import 'package:lightmeter/data/models/ev_source_type.dart';
import 'package:lightmeter/data/models/metering_screen_layout_config.dart'; import 'package:lightmeter/data/models/metering_screen_layout_config.dart';
import 'package:lightmeter/data/shared_prefs_service.dart'; import 'package:lightmeter/data/shared_prefs_service.dart';
@ -24,6 +25,8 @@ import 'mocks/paid_features_mock.dart';
import 'utils/expectations.dart'; import 'utils/expectations.dart';
void main() { void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
setUp(() { setUp(() {
SharedPreferences.setMockInitialValues({ SharedPreferences.setMockInitialValues({
/// Metering values /// Metering values

View file

@ -0,0 +1,5 @@
flutter drive \
--target=integration_test/e2e_test.dart \
--driver=test_driver/integration_driver.dart \
--flavor=dev \
--dart-define cameraStubImage=assets/camera_stub_image.jpg

View file

@ -1,8 +1,5 @@
import 'package:integration_test/integration_test_driver_extended.dart'; import 'package:integration_test/integration_test_driver_extended.dart';
import 'utils/grant_camera_permission.dart';
Future<void> main() async { Future<void> main() async {
await grantCameraPermission();
await integrationDriver(); await integrationDriver();
} }