From e259a7faa7a9587e100ad4b3716493ed0d1fc4bb Mon Sep 17 00:00:00 2001 From: a-mabe Date: Fri, 21 Jul 2023 10:38:47 -0400 Subject: [PATCH] Initial test commit --- .github/workflows/build.yaml | 1 + pubspec.lock | 40 ++++++++++++++++++++ pubspec.yaml | 1 + test/interval_timer_test.dart | 0 test/{widget_test.dart => workout_test.dart} | 23 ++++++----- 5 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 test/interval_timer_test.dart rename test/{widget_test.dart => workout_test.dart} (54%) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9ba0727..26eb855 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -30,6 +30,7 @@ jobs: with: channel: 'stable' - run: flutter pub get + - run: flutter test # - run: flutter test # - run: flutter build apk # - run: flutter build appbundle \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index cb0b8c1..a1cd6c5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -154,6 +154,14 @@ packages: url: "https://github.com/a-mabe/simple_count_down.git" source: git version: "2.2.2" + coverage: + dependency: "direct main" + description: + name: coverage + sha256: "2fb815080e44a09b85e0f2ca8a820b15053982b2e714b59267719e8a9ff17097" + url: "https://pub.dev" + source: hosted + version: "1.6.3" crypto: dependency: transitive description: @@ -281,6 +289,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" + logging: + dependency: transitive + description: + name: logging + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" + source: hosted + version: "1.2.0" matcher: dependency: transitive description: @@ -313,6 +329,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" path: dependency: "direct main" description: @@ -414,6 +438,14 @@ packages: description: flutter source: sdk version: "0.0.99" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" + url: "https://pub.dev" + source: hosted + version: "0.10.12" source_span: dependency: transitive description: @@ -534,6 +566,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: ada49637c27973c183dad90beb6bd781eea4c9f5f955d35da172de0af7bd3440 + url: "https://pub.dev" + source: hosted + version: "11.8.0" wakelock: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index c47ab5f..474f3d0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -45,6 +45,7 @@ dependencies: sqflite_common_ffi: ^2.2.5 wakelock: ^0.6.2 flutter_launcher_icons: ^0.13.1 + coverage: ^1.6.3 flutter_launcher_icons: android: "launcher_icon" diff --git a/test/interval_timer_test.dart b/test/interval_timer_test.dart new file mode 100644 index 0000000..e69de29 diff --git a/test/widget_test.dart b/test/workout_test.dart similarity index 54% rename from test/widget_test.dart rename to test/workout_test.dart index bb4a539..a0209bf 100644 --- a/test/widget_test.dart +++ b/test/workout_test.dart @@ -11,20 +11,23 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:openhiit/main.dart'; void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { + testWidgets('Load add workout smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const WorkoutTimer()); - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. + // Tap the '+' icon and trigger the add Workout or Timer page. await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); + await tester.pumpAndSettle(); + + // Verify that the next page has loaded. + expect(find.text('Interval Timer'), findsOneWidget); + expect(find.text('Workout'), findsOneWidget); + + // Tap to add a Workout. + await tester.tap(find.byIcon(Icons.fitness_center)); + await tester.pumpAndSettle(); - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); + // Verify that the next page has loaded. + expect(find.text('Name this workout:'), findsOneWidget); }); }