Run tab keys test: read the selected tab from the top segments on wide layouts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 01:07:34 +00:00
parent dd86454657
commit bbeb90339b
@@ -2,17 +2,25 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_top_tabs.dart';
import 'run_detail_graph_support.dart';
int _current(WidgetTester tester) => tester
.widget<FloatingDestinationBar>(
find.descendant(
of: find.byKey(const Key('run-detail-tabs')),
matching: find.byType(FloatingDestinationBar),
),
)
.currentIndex;
/// The selected tab's index, from the bottom bar (narrow) or the top
/// segments (wide), whichever the layout shows.
int _current(WidgetTester tester) {
final bar = find.descendant(
of: find.byKey(const Key('run-detail-tabs')),
matching: find.byType(FloatingDestinationBar),
);
if (bar.evaluate().isNotEmpty) {
return tester.widget<FloatingDestinationBar>(bar).currentIndex;
}
final segments = tester.widget<RunDetailTopTabs>(
find.byType(RunDetailTopTabs),
);
return segments.tabs.indexOf(segments.selected);
}
void main() {
testWidgets('bare 1-4 switch the run detail tabs', (tester) async {