60 lines
1.9 KiB
Dart
60 lines
1.9 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/features/runs/ui/run_detail_content.dart';
|
|
import 'package:pipelines_app/features/runs/ui/run_detail_timeline.dart';
|
|
import 'package:pipelines_app/ui/status/run_status_icon.dart';
|
|
|
|
final _steps = [
|
|
{
|
|
'stage': 'plan',
|
|
'sequence': 1,
|
|
'status': 'completed',
|
|
'outcome': 'success',
|
|
'target': 'build',
|
|
'started_at': '2026-10-21T12:00:00Z',
|
|
'finished_at': '2026-10-21T12:02:05Z',
|
|
},
|
|
{
|
|
'stage': 'build',
|
|
'sequence': 2,
|
|
'status': 'completed',
|
|
'outcome': 'error',
|
|
'target': '#failure',
|
|
},
|
|
{'stage': 'review', 'sequence': 3, 'status': 'running'},
|
|
];
|
|
|
|
void main() {
|
|
for (final cupertino in [false, true]) {
|
|
testWidgets('timeline rows lead with their real status '
|
|
'(${cupertino ? 'cupertino' : 'material'})', (tester) async {
|
|
final list = RunTimelineList(
|
|
visits: detailTimeline(_steps),
|
|
cupertino: cupertino,
|
|
onSelected: (_) {},
|
|
);
|
|
await tester.pumpWidget(
|
|
cupertino
|
|
? CupertinoApp(home: CupertinoPageScaffold(child: list))
|
|
: MaterialApp(home: Scaffold(body: list)),
|
|
);
|
|
|
|
// No placeholder circles: every row has the state's own glyph.
|
|
expect(find.byIcon(Icons.circle_outlined), findsNothing);
|
|
expect(find.byIcon(CupertinoIcons.circle), findsNothing);
|
|
final states = tester
|
|
.widgetList<RunStatusIcon>(find.byType(RunStatusIcon))
|
|
.map((icon) => icon.state)
|
|
.toList();
|
|
// A completed step whose outcome is an error reads as failed.
|
|
expect(states, ['succeeded', 'failed', 'running']);
|
|
|
|
expect(find.text('success'), findsOneWidget);
|
|
expect(find.text('error'), findsOneWidget);
|
|
expect(find.text('→ build · 2m 5s'), findsOneWidget);
|
|
expect(find.text('→ #failure'), findsOneWidget);
|
|
});
|
|
}
|
|
}
|