diff --git a/.github/scripts/run_integration_tests.sh b/.github/scripts/run_integration_tests.sh new file mode 100644 index 0000000..d4b146e --- /dev/null +++ b/.github/scripts/run_integration_tests.sh @@ -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 \ No newline at end of file diff --git a/.github/workflows/run_integration_tests.yml b/.github/workflows/run_integration_tests.yml index c9d323a..158a049 100644 --- a/.github/workflows/run_integration_tests.yml +++ b/.github/workflows/run_integration_tests.yml @@ -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 diff --git a/integration_test/e2e_test.dart b/integration_test/e2e_test.dart index e2539a0..19cd316 100644 --- a/integration_test/e2e_test.dart +++ b/integration_test/e2e_test.dart @@ -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 diff --git a/integration_test/run_integration_tests.sh b/integration_test/run_integration_tests.sh new file mode 100644 index 0000000..d4b146e --- /dev/null +++ b/integration_test/run_integration_tests.sh @@ -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 \ No newline at end of file diff --git a/test_driver/integration_driver.dart b/test_driver/integration_driver.dart index 3d79aac..82b5a06 100644 --- a/test_driver/integration_driver.dart +++ b/test_driver/integration_driver.dart @@ -1,8 +1,5 @@ import 'package:integration_test/integration_test_driver_extended.dart'; -import 'utils/grant_camera_permission.dart'; - Future main() async { - await grantCameraPermission(); await integrationDriver(); }