feat(ui): complete M1 Milestone - read-only Dashboard and Detail Pane with status.sh integration

This commit is contained in:
2026-07-16 21:09:31 +09:00
parent 7d22774d76
commit 2eb85866b3
22 changed files with 2014 additions and 399 deletions
@@ -1,30 +1,74 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mam_core/mam_core.dart';
import 'package:mam_desktop/main.dart';
import 'package:mam_desktop/src/providers/session_providers.dart';
import 'package:mam_desktop/src/theme/app_theme.dart';
import 'package:mam_desktop/src/widgets/detail_pane.dart';
import 'package:mam_desktop/src/widgets/session_table.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
testWidgets('SessionTable renders rows and drives selection', (tester) async {
final rows = [
SessionRow(
name: 'demo-session',
server: 'default',
status: 'running',
tmuxAlive: true,
pane: const Pane(
pid: 123,
cwd: '/x',
cmd: 'claude',
cmdFull: 'claude --foo',
),
role: 'creator',
resumeState: 'yes',
jobId: '-',
jobStatus: '-',
attachCommand: 'tmux attach -t demo-session',
driftClasses: const ['B'],
),
];
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
String? selected;
await tester.pumpWidget(
MaterialApp(
theme: buildAppTheme(),
home: Scaffold(
body: SessionTable(
sessions: rows,
selectedName: null,
onSelect: (name) => selected = name,
),
),
),
);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
expect(find.text('demo-session'), findsOneWidget);
expect(find.text('running'), findsOneWidget);
await tester.tap(find.text('demo-session'));
await tester.pump();
expect(selected, 'demo-session');
});
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
testWidgets('DetailPane shows placeholder when nothing selected', (
tester,
) async {
await tester.pumpWidget(
MaterialApp(
theme: buildAppTheme(),
home: const Scaffold(body: DetailPane(session: null)),
),
);
expect(find.text('Select a session to see details'), findsOneWidget);
});
test('selectedSessionNameProvider defaults to null', () {
final container = ProviderContainer();
addTearDown(container.dispose);
expect(container.read(selectedSessionNameProvider), isNull);
});
}