use flutter drive for integration tests

This commit is contained in:
Vadim 2024-03-12 20:04:56 +01:00
parent c79a578286
commit ed45052317
5 changed files with 15 additions and 9 deletions

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

@ -9,10 +9,6 @@ on:
workflow_dispatch:
workflow_call:
env:
BUILD_ARGS: --flavor dev --dart-define cameraStubImage=assets/camera_stub_image.jpg
TARGET: integration_test/run_all_tests.dart
jobs:
run-integration-tests:
name: Run integration tests
@ -71,7 +67,7 @@ jobs:
target: default
arch: x86_64
profile: pixel_6
script: flutter test $TARGET $BUILD_ARGS
script: bash .github/scripts/run_integration_tests.sh
- name: Launch iOS simulator
uses: futureware-tech/simulator-action@v3
@ -80,4 +76,4 @@ jobs:
model: "iPhone 15 Pro"
- name: Run tests
if: ${{ matrix.os == 'macos-13' }}
run: flutter test $TARGET $BUILD_ARGS
run: bash .github/scripts/run_integration_tests.sh

View file

@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:flutter/material.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/metering_screen_layout_config.dart';
import 'package:lightmeter/data/shared_prefs_service.dart';
@ -24,6 +25,8 @@ import 'mocks/paid_features_mock.dart';
import 'utils/expectations.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
setUp(() {
SharedPreferences.setMockInitialValues({
/// 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 'utils/grant_camera_permission.dart';
Future<void> main() async {
await grantCameraPermission();
await integrationDriver();
}