b771f3813a
Keep the assigned runs and pipelines UI Material-only by removing alternate icons, host branches, and Cupertino color usage while preserving compatibility parameters needed by other callers. Update mirrored tests and record focused verification for the cleanup.
56 lines
1.7 KiB
Dart
56 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/features/runs/ui/run_path_mini.dart';
|
|
import 'package:pipelines_app/ui/status/run_status_icon.dart';
|
|
|
|
void main() {
|
|
final run = {
|
|
'graph_evidence': {
|
|
'complete': true,
|
|
'visits': [
|
|
{'stage': 'plan', 'status': 'completed', 'outcome': 'success'},
|
|
{'stage': 'build', 'status': 'completed', 'outcome': 'retry'},
|
|
{
|
|
'stage': 'build',
|
|
'status': 'completed',
|
|
'outcome': 'error',
|
|
'target': '#failure',
|
|
},
|
|
],
|
|
},
|
|
};
|
|
|
|
test('the path keeps first-visit order and each stage latest state', () {
|
|
final path = runPath(run);
|
|
expect(path.stages.map((stage) => stage.key), ['plan', 'build']);
|
|
expect(path.stages.map((stage) => stage.state), ['succeeded', 'failed']);
|
|
expect(path.end, '#failure');
|
|
expect(runPath({}).stages, isEmpty);
|
|
});
|
|
|
|
testWidgets('the miniature colours each stage by its result', (tester) async {
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: Scaffold(
|
|
body: Center(child: RunPathMini(run: run)),
|
|
),
|
|
),
|
|
);
|
|
final colors = tester
|
|
.widgetList<Container>(find.byType(Container))
|
|
.map((box) => (box.decoration as BoxDecoration?)?.color)
|
|
.whereType<Color>()
|
|
.map((color) => color.toARGB32())
|
|
.toList();
|
|
final context = tester.element(find.byKey(const Key('run-path-mini')));
|
|
expect(
|
|
colors,
|
|
contains(runStatusColor('succeeded').resolveFrom(context).toARGB32()),
|
|
);
|
|
expect(
|
|
colors,
|
|
contains(runStatusColor('failed').resolveFrom(context).toARGB32()),
|
|
);
|
|
});
|
|
}
|