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:
@@ -2,17 +2,25 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.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';
|
import 'run_detail_graph_support.dart';
|
||||||
|
|
||||||
int _current(WidgetTester tester) => tester
|
/// The selected tab's index, from the bottom bar (narrow) or the top
|
||||||
.widget<FloatingDestinationBar>(
|
/// segments (wide), whichever the layout shows.
|
||||||
find.descendant(
|
int _current(WidgetTester tester) {
|
||||||
of: find.byKey(const Key('run-detail-tabs')),
|
final bar = find.descendant(
|
||||||
matching: find.byType(FloatingDestinationBar),
|
of: find.byKey(const Key('run-detail-tabs')),
|
||||||
),
|
matching: find.byType(FloatingDestinationBar),
|
||||||
)
|
);
|
||||||
.currentIndex;
|
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() {
|
void main() {
|
||||||
testWidgets('bare 1-4 switch the run detail tabs', (tester) async {
|
testWidgets('bare 1-4 switch the run detail tabs', (tester) async {
|
||||||
|
|||||||
Reference in New Issue
Block a user