summaryrefslogtreecommitdiff
path: root/player-android/test/widget_smoke_test.dart
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-18 23:02:38 +0300
committerPaul Buetow <paul@buetow.org>2026-05-18 23:02:38 +0300
commit687837c4633ff5567618a9042a06ccc77d5e178f (patch)
tree6e0f813ea91f9d9ebe23d8dce5a9fb4aad96452d /player-android/test/widget_smoke_test.dart
parent4356fde60cd64b48bee83385c78f37dd13e2659d (diff)
Add named routes and widget smoke tests to player-android
Adds HomeScreen ('/') and NowPlayingScreen ('/now-playing') as the first two named routes in PlayerAndroidApp, replacing the anonymous home widget. Widget smoke tests verify that the app starts on the library screen, navigates to the now-playing screen on button tap, and back-navigates correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'player-android/test/widget_smoke_test.dart')
-rw-r--r--player-android/test/widget_smoke_test.dart48
1 files changed, 48 insertions, 0 deletions
diff --git a/player-android/test/widget_smoke_test.dart b/player-android/test/widget_smoke_test.dart
new file mode 100644
index 0000000..fba21d4
--- /dev/null
+++ b/player-android/test/widget_smoke_test.dart
@@ -0,0 +1,48 @@
+// Widget smoke tests for PlayerAndroidApp.
+//
+// These tests verify that the two named routes defined in main.dart render
+// without errors and contain the expected key widgets. Navigation between
+// HomeScreen and NowPlayingScreen is exercised end-to-end.
+//
+// Run with: flutter test test/widget_smoke_test.dart
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:player_android/main.dart';
+
+void main() {
+ group('PlayerAndroidApp', () {
+ testWidgets('starts on HomeScreen showing Library title', (tester) async {
+ await tester.pumpWidget(const PlayerAndroidApp());
+
+ expect(find.text('Library'), findsOneWidget);
+ expect(find.text('Now Playing'), findsOneWidget);
+ });
+
+ testWidgets('navigates to NowPlayingScreen on button tap', (tester) async {
+ await tester.pumpWidget(const PlayerAndroidApp());
+
+ await tester.tap(find.widgetWithText(ElevatedButton, 'Now Playing'));
+ await tester.pumpAndSettle();
+
+ expect(find.text('Now Playing'), findsWidgets);
+ expect(find.text('No media selected'), findsOneWidget);
+ });
+
+ testWidgets('NowPlayingScreen back-navigates to HomeScreen', (tester) async {
+ await tester.pumpWidget(const PlayerAndroidApp());
+
+ // Navigate to NowPlayingScreen.
+ await tester.tap(find.widgetWithText(ElevatedButton, 'Now Playing'));
+ await tester.pumpAndSettle();
+ expect(find.text('No media selected'), findsOneWidget);
+
+ // Press the back button provided by Scaffold/AppBar.
+ final NavigatorState nav = tester.state(find.byType(Navigator));
+ nav.pop();
+ await tester.pumpAndSettle();
+
+ expect(find.text('Library'), findsOneWidget);
+ });
+ });
+}