545291e04a
- Run rows show a failed run's reason (else its diagnostic's first line, full text in a tooltip) or a short result preview; the Summary leads with "Why it failed". - Run again for succeeded/canceled/interrupted runs opens the New run form pre-filled (prompt, workspace, report format) at the latest version with the original offered. - Run detail and stage tabs show their names; touch shows captions on the Runs header and artifact viewer actions (desktop keeps tooltips). - ErrorNotice maps not connected / server too old / permission / timeout to what to do, raw detail behind Details (Schedules, create chat, Runs, Pipelines banners). - Settings has no Back arrow; Schedules keeps the rail on wide windows; phone Settings leads with Connection and Notifications and has a Jump to topic menu. - Walkthrough: Open Connection (skipped when connected), labelled Copy. - Pluralised counts; no duplicate status/rail names for screen readers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
122 lines
3.9 KiB
Dart
122 lines
3.9 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/application/app_session.dart';
|
|
import 'package:pipelines_app/application/schedules_destination.dart';
|
|
import 'package:pipelines_app/application/server_endpoint.dart';
|
|
import 'package:pipelines_app/core/transport/pipelines_client.dart';
|
|
import 'package:pipelines_app/features/schedules/ui/list/schedule_list_toolbar.dart';
|
|
import 'package:pipelines_app/shell/destination.dart';
|
|
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart';
|
|
|
|
import '../core/transport/pipelines_client_test.dart' show FakeChannel;
|
|
|
|
void main() {
|
|
testWidgets('a page opened before the connection lists once connected', (
|
|
tester,
|
|
) async {
|
|
final channel = FakeChannel();
|
|
final client = PipelinesClient(channelFactory: (_) => channel);
|
|
final server = ServerEndpoint.resolve(
|
|
base: Uri.parse('http://127.0.0.1:8096/'),
|
|
web: true,
|
|
);
|
|
final session = AppSession(endpoint: server.uri, client: client);
|
|
addTearDown(session.dispose);
|
|
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: SchedulesDestination(
|
|
session: session,
|
|
server: server,
|
|
onBack: () {},
|
|
onOpenPipeline: (_) {},
|
|
),
|
|
),
|
|
);
|
|
await tester.pump();
|
|
expect(
|
|
find.text('Connect to the server to see schedules.'),
|
|
findsOneWidget,
|
|
);
|
|
|
|
final starting = session.start();
|
|
channel.readyCompleter.complete();
|
|
await starting;
|
|
await tester.pump();
|
|
await tester.pump();
|
|
expect(find.text('Connect to the server to see schedules.'), findsNothing);
|
|
|
|
final request = channel.outgoing
|
|
.map((frame) => jsonDecode(frame as String) as Map<String, dynamic>)
|
|
.lastWhere((frame) => frame['type'] == 'list_schedules');
|
|
channel.incoming.add(
|
|
jsonEncode({
|
|
'id': request['id'],
|
|
'type': 'schedules',
|
|
'schedules': [
|
|
{
|
|
'id': 1,
|
|
'pipeline_id': 4,
|
|
'version': 1,
|
|
'name': 'Nightly review',
|
|
'enabled': true,
|
|
'rule': {'kind': 'interval', 'every_seconds': 3600},
|
|
},
|
|
],
|
|
}),
|
|
);
|
|
await tester.pump();
|
|
await tester.pump();
|
|
expect(find.text('Nightly review'), findsOneWidget);
|
|
|
|
// Back and Refresh are bar pieces; the body has neither.
|
|
Finder inBar(Key key) => find.descendant(
|
|
of: find.byType(SegmentedBar),
|
|
matching: find.byKey(key),
|
|
);
|
|
expect(inBar(schedulesPageBackKey), findsOneWidget);
|
|
expect(inBar(scheduleRefreshKey), findsOneWidget);
|
|
expect(find.byKey(scheduleRefreshKey), findsOneWidget);
|
|
expect(find.byType(SegmentedBackButton), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('a wide window keeps the navigation rail beside Schedules; a '
|
|
'narrow one does not', (tester) async {
|
|
final client = PipelinesClient(channelFactory: (_) => FakeChannel());
|
|
final server = ServerEndpoint.resolve(
|
|
base: Uri.parse('http://127.0.0.1:8096/'),
|
|
web: true,
|
|
);
|
|
final session = AppSession(endpoint: server.uri, client: client);
|
|
addTearDown(session.dispose);
|
|
final selected = <AppDestination>[];
|
|
Future<void> pumpAt(double width) async {
|
|
tester.view.physicalSize = Size(width, 800);
|
|
tester.view.devicePixelRatio = 1;
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: SchedulesDestination(
|
|
session: session,
|
|
server: server,
|
|
onBack: () {},
|
|
onOpenPipeline: (_) {},
|
|
onSelectDestination: selected.add,
|
|
),
|
|
),
|
|
);
|
|
await tester.pump();
|
|
}
|
|
|
|
addTearDown(tester.view.reset);
|
|
await pumpAt(1300);
|
|
expect(find.byType(NavigationRail), findsOneWidget);
|
|
await tester.tap(find.byKey(const ValueKey('shell.destination.runs')));
|
|
expect(selected, [AppDestination.runs]);
|
|
|
|
await pumpAt(500);
|
|
expect(find.byType(NavigationRail), findsNothing);
|
|
});
|
|
}
|