Files
pipelines/app/test/features/runs/ui/run_detail_tabs_test.dart
T

71 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/graph/widgets/run_graph_view.dart';
import 'package:pipelines_app/features/runs/actions/title_wording.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_tab.dart';
import 'run_detail_graph_support.dart';
void main() {
for (final platform in RunDetailTestPlatform.values) {
testWidgets('${platform.name} tabs keep the web order and the actions', (
tester,
) async {
await pumpRunDetail(tester, platform);
for (final label in ['Summary', 'Graph', 'Input', 'Output', 'Timeline']) {
expect(find.text(label), findsOneWidget);
}
var previous = double.negativeInfinity;
for (final tab in RunDetailTab.values) {
final center = tester.getCenter(runDetailTab(tab));
expect(center.dx, greaterThan(previous));
previous = center.dx;
}
expect(find.byKey(runTitleActionKey), findsOneWidget);
for (final tab in [
RunDetailTab.graph,
RunDetailTab.input,
RunDetailTab.output,
RunDetailTab.timeline,
RunDetailTab.summary,
]) {
await openRunDetailTab(tester, tab);
expect(find.byKey(runTitleActionKey), findsOneWidget);
expect(find.text('Graph run'), findsOneWidget);
}
});
testWidgets('${platform.name} missing graph states the exact wording', (
tester,
) async {
await pumpRunDetail(tester, platform, run: graphRunFixture(graph: false));
await openRunDetailTab(tester, RunDetailTab.graph);
expect(find.text(runGraphMissing), findsOneWidget);
expect(find.byType(InteractiveViewer), findsNothing);
});
testWidgets('${platform.name} Graph stays bounded at 320 with 2x text', (
tester,
) async {
await pumpRunDetail(
tester,
platform,
size: const Size(320, 568),
scale: 2,
);
await openRunDetailTab(tester, RunDetailTab.graph);
expect(tester.takeException(), isNull);
final slot = tester.getSize(find.byType(RunGraphView));
expect(slot.height, greaterThan(0));
expect(slot.width, lessThanOrEqualTo(320));
expect(find.byType(InteractiveViewer), findsOneWidget);
expect(find.text(runGraphExecuted), findsOneWidget);
expect(find.text(runGraphNotExecuted), findsOneWidget);
});
}
}