87 lines
3.1 KiB
Dart
87 lines
3.1 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 'package:pipelines_app/features/runs/ui/run_detail_tab_strip.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);
|
|
|
|
expect(renderedRunDetailTabs, [
|
|
RunDetailTab.summary,
|
|
RunDetailTab.graph,
|
|
RunDetailTab.timeline,
|
|
]);
|
|
for (final label in ['Summary', 'Graph', 'Timeline']) {
|
|
expect(find.text(label), findsOneWidget);
|
|
}
|
|
// Input and Output are Summary sections now, never separate tabs.
|
|
final strip = find.byKey(const Key('run-detail-tabs'));
|
|
for (final label in ['Input', 'Output']) {
|
|
expect(
|
|
find.descendant(of: strip, matching: find.text(label)),
|
|
findsNothing,
|
|
);
|
|
}
|
|
var previous = double.negativeInfinity;
|
|
for (final tab in renderedRunDetailTabs) {
|
|
final center = tester.getCenter(runDetailTab(tab));
|
|
expect(center.dx, greaterThan(previous));
|
|
previous = center.dx;
|
|
}
|
|
expect(find.byKey(runTitleActionKey), findsOneWidget);
|
|
// The strip lines up with the header's 16px inset on both hosts: the
|
|
// first label sits within its segment's own padding of that inset, not
|
|
// behind a second 16px control inset (which put it at 48 on Cupertino).
|
|
expect(tester.getTopLeft(find.text('Summary')).dx, lessThan(40));
|
|
|
|
for (final tab in [
|
|
RunDetailTab.graph,
|
|
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);
|
|
});
|
|
}
|
|
}
|