Skip to content

Commit

Permalink
Run integration tests in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
a-mabe committed Jan 1, 2025
1 parent 96717ed commit 6939491
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 23 deletions.
40 changes: 39 additions & 1 deletion .github/workflows/integration_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,45 @@ on:
- 'ios/**'

jobs:
Build:
Workout:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Check Version
run: flutter --version
- name: Flutter Doctor
run: flutter doctor -v
- 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: Setup Android SDK
uses: android-actions/setup-android@v3

- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 35
arch: x86_64
script: |
# Build the APK
flutter build apk --debug
adb -s emulator-5554 install build/app/outputs/flutter-apk/app-debug.apk
adb -s emulator-5554 root
adb -s emulator-5554 shell appops set com.codepup.workout_timer SCHEDULE_EXACT_ALARM allow
flutter drive -d emulator-5554 --driver=test_driver/integration_test.dart --target=integration_test/workout_test.dart
Timer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
22 changes: 0 additions & 22 deletions integration_test/timer_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ void main() {
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;

const String workoutName = 'Test Workout';
const String workoutName2 = 'Test Workout Edited';
const String timerName = 'Test Timer';

group('end-to-end test', () {
Expand All @@ -19,26 +17,6 @@ void main() {
await binding.setSurfaceSize(const Size(1080, 2400));
expect(find.text('No saved timers'), findsOneWidget);
});
testWidgets('create a workout', (tester) async {
await loadApp(tester);
await navigateToAddWorkoutOrTimer(tester, true);
await createWorkout(tester, workoutName);
});
testWidgets('run a workout and restart', (tester) async {
await loadApp(tester);
await verifyWorkoutOrTimerOpens(tester, workoutName);
await runWorkoutOne(tester, binding);
});
testWidgets('edit workout', (tester) async {
await loadApp(tester);
await verifyWorkoutOrTimerOpens(tester, workoutName);
await editWorkout(tester, workoutName2);
});
testWidgets('run an edited workout and restart', (tester) async {
await loadApp(tester);
await verifyWorkoutOrTimerOpens(tester, workoutName2);
await runWorkoutTwo(tester);
});
testWidgets('create a timer', (tester) async {
await loadApp(tester);
await navigateToAddWorkoutOrTimer(tester, false);
Expand Down
38 changes: 38 additions & 0 deletions integration_test/workout_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import 'dart:ui';

import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

import 'functions.dart';

void main() {
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;

const String workoutName = 'Test Workout';
const String workoutName2 = 'Test Workout Edited';

group('end-to-end test', () {
testWidgets('create a workout', (tester) async {
await loadApp(tester);
await binding.setSurfaceSize(const Size(1080, 2400));
await navigateToAddWorkoutOrTimer(tester, true);
await createWorkout(tester, workoutName);
});
testWidgets('run a workout and restart', (tester) async {
await loadApp(tester);
await verifyWorkoutOrTimerOpens(tester, workoutName);
await runWorkoutOne(tester, binding);
});
testWidgets('edit workout', (tester) async {
await loadApp(tester);
await verifyWorkoutOrTimerOpens(tester, workoutName);
await editWorkout(tester, workoutName2);
});
testWidgets('run an edited workout and restart', (tester) async {
await loadApp(tester);
await verifyWorkoutOrTimerOpens(tester, workoutName2);
await runWorkoutTwo(tester);
});
});
}

0 comments on commit 6939491

Please sign in to comment.