Merge branch 'worktree-agent-ac4392b2750312e98'
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/layout/app_list_row.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/chat/screen.dart';
|
||||
@@ -175,7 +176,8 @@ void main() {
|
||||
final background = appLightTheme().scaffoldBackgroundColor;
|
||||
expect(origin.color, isNot(background), reason: 'the chat colour tints it');
|
||||
expect(origin.color.a, 1);
|
||||
expect(origin.markerWidth, 10);
|
||||
// The open row's one bar, as every list marks its open row.
|
||||
expect(origin.markerWidth, kAppListRowBarWidth);
|
||||
expect(origin.marker, isNotNull);
|
||||
});
|
||||
|
||||
|
||||
@@ -58,13 +58,17 @@ void main() {
|
||||
of: row,
|
||||
matching: find.byKey(appListRowSurfaceKey),
|
||||
);
|
||||
// The lists' shared open-row style: the tonal fill and one bar.
|
||||
final color = tester.widget<Material>(surface).color;
|
||||
expect(color, const Color(0x00000000));
|
||||
final highlight = tester.widget<AnimatedContainer>(
|
||||
find.byKey(ValueKey('chat-visibility-$id')),
|
||||
final context = tester.element(row);
|
||||
expect(color == AppListRow.selectedColor(context), active);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(ValueKey('chat-visibility-$id')),
|
||||
matching: find.byKey(appListRowSelectionKey),
|
||||
),
|
||||
active ? findsOneWidget : findsNothing,
|
||||
);
|
||||
final fill = (highlight.decoration as BoxDecoration).color;
|
||||
expect(fill != null && fill.a > 0, active);
|
||||
}
|
||||
|
||||
expectRow('a', true);
|
||||
|
||||
@@ -210,16 +210,16 @@ void main() {
|
||||
),
|
||||
),
|
||||
);
|
||||
final surface = tester.widget<Material>(find.byKey(appListRowSurfaceKey));
|
||||
expect(surface.color, Colors.transparent);
|
||||
final highlight = tester.widget<AnimatedContainer>(
|
||||
find.byKey(const ValueKey('chat-visibility-s1')),
|
||||
);
|
||||
// The selected row is filled in its own colour.
|
||||
final fill = (highlight.decoration as BoxDecoration).color!;
|
||||
expect(fill.a, greaterThan(0));
|
||||
// The shared open-row style: the tonal fill, and its one bar in the
|
||||
// chat's own colour.
|
||||
final context = tester.element(find.byType(ChatSessionRow));
|
||||
expect(fill.withValues(alpha: 1), chatColorShade(context, 'amber'));
|
||||
final surface = tester.widget<Material>(find.byKey(appListRowSurfaceKey));
|
||||
expect(surface.color, AppListRow.selectedColor(context));
|
||||
final bar = tester.widget<DecoratedBox>(find.byKey(appListRowSelectionKey));
|
||||
final side =
|
||||
((bar.decoration as BoxDecoration).border as BorderDirectional).start;
|
||||
expect(side.color, chatColorShade(context, 'amber'));
|
||||
expect(side.width, kAppListRowBarWidth);
|
||||
expect(find.byKey(appListRowAccentKey), findsNothing);
|
||||
expect(find.byKey(const ValueKey('chat-visibility-s1')), findsOneWidget);
|
||||
});
|
||||
|
||||
@@ -25,9 +25,20 @@ BorderSide edge(WidgetTester tester, String id) {
|
||||
return ((box.decoration as BoxDecoration).border as BorderDirectional).start;
|
||||
}
|
||||
|
||||
/// The shared open-row bar [AppListRow] draws on the selected row of [id].
|
||||
BorderSide? selectionBar(WidgetTester tester, String id) {
|
||||
final bar = find.descendant(
|
||||
of: find.byKey(ValueKey('chat-visibility-$id')),
|
||||
matching: find.byKey(appListRowSelectionKey),
|
||||
);
|
||||
if (bar.evaluate().isEmpty) return null;
|
||||
final box = tester.widget<DecoratedBox>(bar);
|
||||
return ((box.decoration as BoxDecoration).border as BorderDirectional).start;
|
||||
}
|
||||
|
||||
void main() {
|
||||
testWidgets(
|
||||
'only visible chats have an edge; active edge widens continuously',
|
||||
'visible chats have a thin edge; the open chat has the shared selection',
|
||||
(tester) async {
|
||||
tester.platformDispatcher.accessibilityFeaturesTestValue =
|
||||
const FakeAccessibilityFeatures(disableAnimations: false);
|
||||
@@ -72,19 +83,25 @@ void main() {
|
||||
),
|
||||
),
|
||||
);
|
||||
// A selected chat not shown in a pane wears only the shared selection.
|
||||
expect(edge(tester, 'off').style, BorderStyle.none);
|
||||
expect(selectionBar(tester, 'off')!.width, kAppListRowBarWidth);
|
||||
// A chat visible elsewhere keeps its thin edge.
|
||||
expect(edge(tester, 'on').width, 3);
|
||||
expect(selectionBar(tester, 'on'), isNull);
|
||||
expect(find.byKey(appListRowAccentKey), findsNothing);
|
||||
update(() => active = true);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
expect(edge(tester, 'on').width, greaterThan(3));
|
||||
expect(edge(tester, 'on').width, lessThan(8));
|
||||
await tester.pumpAndSettle();
|
||||
expect(edge(tester, 'on').width, 8);
|
||||
// Opened, it is marked exactly like any open row: one bar in the
|
||||
// chat's colour over the tonal fill, and no second edge.
|
||||
expect(edge(tester, 'on').style, BorderStyle.none);
|
||||
final bar = selectionBar(tester, 'on')!;
|
||||
expect(bar.width, kAppListRowBarWidth);
|
||||
expect(bar.color, isNot(Colors.transparent));
|
||||
update(() => active = false);
|
||||
await tester.pumpAndSettle();
|
||||
expect(edge(tester, 'on').width, 3);
|
||||
expect(selectionBar(tester, 'on'), isNull);
|
||||
},
|
||||
);
|
||||
testWidgets('compact chats keep identity colours and visible/active edges', (
|
||||
@@ -128,7 +145,18 @@ void main() {
|
||||
await tester.tap(find.byTooltip('New chat'));
|
||||
expect(newChatPressed, isTrue);
|
||||
expect(find.byTooltip('Expand chat list'), findsOneWidget);
|
||||
expect(edge(tester, 'a').width, 8);
|
||||
// The open chat: no second edge, the shared fill and bar instead.
|
||||
expect(edge(tester, 'a').style, BorderStyle.none);
|
||||
final open = tester
|
||||
.widgetList<AnimatedContainer>(
|
||||
find.descendant(
|
||||
of: find.byKey(const ValueKey('chat-visibility-a')),
|
||||
matching: find.byType(AnimatedContainer),
|
||||
),
|
||||
)
|
||||
.singleWhere((box) => box.foregroundDecoration != null);
|
||||
final bar = (open.foregroundDecoration as BoxDecoration).border;
|
||||
expect((bar as BorderDirectional).start.width, kAppListRowBarWidth);
|
||||
expect(edge(tester, 'b').width, 3);
|
||||
expect(edge(tester, 'c').style, BorderStyle.none);
|
||||
final avatars = tester
|
||||
|
||||
@@ -48,31 +48,36 @@ void main() {
|
||||
.setMockMethodCallHandler(SystemChannels.platform, null),
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'fenced code reveals Copy without shifting and copies exact whitespace',
|
||||
(tester) async {
|
||||
const code = ' final x = 1;\n\tkeep spaces ';
|
||||
await tester.pumpWidget(_host('```dart\n$code\n```'));
|
||||
await tester.pumpAndSettle();
|
||||
final before = tester.getTopLeft(find.text(code));
|
||||
expect(find.text('Copy').hitTestable(), findsNothing);
|
||||
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
|
||||
await mouse.addPointer(location: const Offset(1, 1));
|
||||
await mouse.moveTo(tester.getCenter(find.text(code)));
|
||||
await tester.pump();
|
||||
expect(find.text('Copy').hitTestable(), findsOneWidget);
|
||||
expect(tester.getTopLeft(find.text(code)), before);
|
||||
await tester.tap(find.text('Copy').hitTestable());
|
||||
await tester.pump();
|
||||
expect(copied, code);
|
||||
expect(find.text('Copied').hitTestable(), findsOneWidget);
|
||||
await mouse.moveTo(const Offset(1, 1));
|
||||
await tester.pump();
|
||||
expect(find.text('Copied').hitTestable(), findsNothing);
|
||||
await mouse.removePointer();
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
},
|
||||
);
|
||||
testWidgets('fenced code has a header strip with its language and Copy', (
|
||||
tester,
|
||||
) async {
|
||||
const code = ' final x = 1;\n\tkeep spaces ';
|
||||
await tester.pumpWidget(_host('```dart\n$code\n```'));
|
||||
await tester.pumpAndSettle();
|
||||
// One framed block: the header strip (label and Copy) sits on top of
|
||||
// the code, inside the block, and Copy needs no hover (touch has none).
|
||||
final header = tester.getRect(find.byKey(const Key('chat-code-header')));
|
||||
final block = tester.getRect(find.byKey(const Key('chat-code-body')));
|
||||
final label = tester.getRect(find.text('dart'));
|
||||
final copy = tester.getRect(find.text('Copy').hitTestable());
|
||||
expect(header.top, block.top);
|
||||
expect(header.contains(label.center), isTrue);
|
||||
expect(header.contains(copy.center), isTrue);
|
||||
expect(tester.getTopLeft(find.text(code)).dy, greaterThan(header.bottom));
|
||||
expect(block.contains(tester.getCenter(find.text(code))), isTrue);
|
||||
final before = tester.getTopLeft(find.text(code));
|
||||
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
|
||||
await mouse.addPointer(location: const Offset(1, 1));
|
||||
await mouse.moveTo(tester.getCenter(find.text(code)));
|
||||
await tester.pump();
|
||||
expect(tester.getTopLeft(find.text(code)), before);
|
||||
await tester.tap(find.text('Copy').hitTestable());
|
||||
await tester.pump();
|
||||
expect(copied, code);
|
||||
expect(find.text('Copied').hitTestable(), findsOneWidget);
|
||||
await mouse.removePointer();
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
'inline spans retain selection, hover transfer and copy the right raw snippet',
|
||||
@@ -168,11 +173,11 @@ void main() {
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
});
|
||||
|
||||
testWidgets('keyboard focus exposes the reserved block action', (
|
||||
testWidgets('the block action is reachable from the keyboard', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(_host('```text\nraw\n```'));
|
||||
expect(find.text('Copy').hitTestable(), findsNothing);
|
||||
expect(find.text('Copy').hitTestable(), findsOneWidget);
|
||||
// The selectable transcript itself is the first focus stop.
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
|
||||
await tester.pump();
|
||||
|
||||
@@ -45,6 +45,9 @@ Widget _host({
|
||||
);
|
||||
}
|
||||
|
||||
/// The chevron over the faded side with more content.
|
||||
Finder _more(String side) => find.byKey(Key('chat-horizontal-more-$side'));
|
||||
|
||||
ScrollController _controller(WidgetTester tester) =>
|
||||
tester.widget<Scrollbar>(find.byType(Scrollbar)).controller!;
|
||||
|
||||
@@ -55,14 +58,16 @@ void main() {
|
||||
(tester) async {
|
||||
await tester.pumpWidget(_host(brightness: brightness));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Scroll horizontally'), findsOneWidget);
|
||||
expect(find.byKey(const Key('chat-horizontal-fade')), findsOneWidget);
|
||||
final controller = _controller(tester);
|
||||
expect(controller.position.maxScrollExtent, 640);
|
||||
expect(
|
||||
tester.widget<Scrollbar>(find.byType(Scrollbar)).thumbVisibility,
|
||||
isTrue,
|
||||
);
|
||||
expect(find.byIcon(Icons.arrow_forward), findsOneWidget);
|
||||
// More content to the right: that side fades under a chevron.
|
||||
expect(_more('right'), findsOneWidget);
|
||||
expect(_more('left'), findsNothing);
|
||||
final focus = tester
|
||||
.widgetList<Focus>(find.byType(Focus))
|
||||
.firstWhere(
|
||||
@@ -73,15 +78,17 @@ void main() {
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);
|
||||
await tester.pumpAndSettle();
|
||||
expect(controller.offset, 80);
|
||||
expect(find.byIcon(Icons.swap_horiz), findsOneWidget);
|
||||
expect(_more('left'), findsOneWidget);
|
||||
expect(_more('right'), findsOneWidget);
|
||||
controller.jumpTo(controller.position.maxScrollExtent);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byIcon(Icons.arrow_back), findsOneWidget);
|
||||
expect(_more('left'), findsOneWidget);
|
||||
expect(_more('right'), findsNothing);
|
||||
await tester.pumpWidget(
|
||||
_host(brightness: brightness, contentWidth: 120),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Scroll horizontally'), findsNothing);
|
||||
expect(find.byKey(const Key('chat-horizontal-fade')), findsNothing);
|
||||
expect(tester.takeException(), isNull);
|
||||
},
|
||||
);
|
||||
@@ -92,9 +99,10 @@ void main() {
|
||||
(tester) async {
|
||||
await tester.pumpWidget(_host(direction: TextDirection.rtl));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byIcon(Icons.arrow_back), findsOneWidget);
|
||||
expect(_more('left'), findsOneWidget);
|
||||
expect(_more('right'), findsNothing);
|
||||
expect(
|
||||
tester.widget<Icon>(find.byIcon(Icons.arrow_back)).textDirection,
|
||||
tester.widget<Icon>(_more('left')).textDirection,
|
||||
TextDirection.ltr,
|
||||
);
|
||||
final controller = _controller(tester);
|
||||
@@ -169,7 +177,7 @@ void main() {
|
||||
find.bySemanticsLabel('Horizontally scrollable table'),
|
||||
findsNothing,
|
||||
);
|
||||
expect(find.text('Scroll horizontally'), findsOneWidget);
|
||||
expect(find.byKey(const Key('chat-horizontal-fade')), findsOneWidget);
|
||||
final viewport = tester.getRect(find.byType(ChatMarkdownView));
|
||||
expect(
|
||||
tester.getRect(find.byType(Table)).right,
|
||||
|
||||
@@ -27,7 +27,7 @@ void main() {
|
||||
'| No | Text | Ok |\n| --- | --- | --- |\n'
|
||||
'| one | ${List.filled(30, 'word').join(' ')} | done |',
|
||||
);
|
||||
expect(find.text('Scroll horizontally'), findsNothing);
|
||||
expect(find.byKey(const Key('chat-horizontal-fade')), findsNothing);
|
||||
expect(tableRect(tester).right, lessThanOrEqualTo(screenRight));
|
||||
final description = tester.getSize(find.textContaining('word word'));
|
||||
final status = tester.getSize(find.text('done'));
|
||||
@@ -55,7 +55,7 @@ void main() {
|
||||
'| --- | --- | --- | --- | --- | --- | --- |\n'
|
||||
'| a b | c d | e f | g h | i j | k l | m n |',
|
||||
);
|
||||
expect(find.text('Scroll horizontally'), findsOneWidget);
|
||||
expect(find.byKey(const Key('chat-horizontal-fade')), findsOneWidget);
|
||||
expect(
|
||||
find.bySemanticsLabel('Horizontally scrollable table'),
|
||||
findsOneWidget,
|
||||
@@ -76,7 +76,7 @@ void main() {
|
||||
'| Column | Notes |\n| --- | --- |\n'
|
||||
'| x | ${List.filled(40, 'note').join(' ')} |',
|
||||
);
|
||||
expect(find.text('Scroll horizontally'), findsNothing);
|
||||
expect(find.byKey(const Key('chat-horizontal-fade')), findsNothing);
|
||||
expect(tableRect(tester).right, lessThanOrEqualTo(screenRight));
|
||||
final header = tester.getSize(find.text('Column')).height;
|
||||
expect(header, tester.getSize(find.text('x')).height);
|
||||
|
||||
@@ -55,6 +55,11 @@ void main() {
|
||||
expect(find.textContaining('v2 · #'), findsNothing);
|
||||
expect(find.text('2 stages · 1 schedule'), findsOneWidget);
|
||||
expect(find.byKey(const Key('pipeline-status-1')), findsOneWidget);
|
||||
// The state is spelled out beside its dot, with when the run was.
|
||||
expect(
|
||||
tester.widget<Text>(find.byKey(const Key('pipeline-status-text-1'))).data,
|
||||
matches(RegExp(r'^Succeeded · last run .+')),
|
||||
);
|
||||
expect(find.byKey(const Key('pipeline-status-2')), findsOneWidget);
|
||||
expect(find.text('no runs recorded'), findsNothing);
|
||||
});
|
||||
@@ -142,7 +147,10 @@ void main() {
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: firstRow, matching: find.text('Succeeded')),
|
||||
find.descendant(
|
||||
of: firstRow,
|
||||
matching: find.textContaining(RegExp(r'^Succeeded( · .+)?$')),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
@@ -204,7 +212,10 @@ void main() {
|
||||
runs.complete(runListReply(fixture.runs));
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
find.descendant(of: firstRow, matching: find.text('Succeeded')),
|
||||
find.descendant(
|
||||
of: firstRow,
|
||||
matching: find.textContaining(RegExp(r'^Succeeded( · .+)?$')),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/runs/data/runs_repository.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/runs_controller.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_tab_button.dart';
|
||||
|
||||
import '../../artifacts/domain/artifact_fixtures.dart';
|
||||
|
||||
@@ -97,16 +98,44 @@ void main() {
|
||||
expect(find.text('reviewer · visit 1'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('the action is offered only when the detail has steps', (
|
||||
/// The Artifacts tab keeps its place on a run with none: disabled, badged
|
||||
/// `0`, and its tooltip (and accessibility hint) says why.
|
||||
Future<void> expectDisabledArtifacts(WidgetTester tester, String why) async {
|
||||
final tab = find.byKey(const ValueKey('run-detail-tab-artifacts'));
|
||||
expect(tab, findsOneWidget);
|
||||
final button = tester.widget<FloatingTabButton>(tab);
|
||||
expect(button.enabled, isFalse);
|
||||
expect(button.tooltip, why);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: tab,
|
||||
matching: find.byKey(const ValueKey('run-detail-artifacts-count')),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.descendant(of: tab, matching: find.text('0')), findsOneWidget);
|
||||
// A tap does not open an empty gallery: Summary stays.
|
||||
await tester.tap(tab, warnIfMissed: false);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(why), findsNothing);
|
||||
// Changes, after it, keeps its place.
|
||||
final order = [
|
||||
for (final name in ['summary', 'timeline', 'artifacts', 'changes'])
|
||||
tester.getCenter(find.byKey(ValueKey('run-detail-tab-$name'))).dx,
|
||||
];
|
||||
expect(order, orderedEquals([...order]..sort()));
|
||||
}
|
||||
|
||||
testWidgets('a run without steps keeps a disabled Artifacts tab', (
|
||||
tester,
|
||||
) async {
|
||||
final gateway = _FakeGateway(_run(steps: const []));
|
||||
final controller = await _loaded(gateway);
|
||||
addTearDown(controller.dispose);
|
||||
await _pumpDetail(tester, controller, gateway);
|
||||
expect(
|
||||
find.byKey(const ValueKey('run-detail-tab-artifacts')),
|
||||
findsNothing,
|
||||
await expectDisabledArtifacts(
|
||||
tester,
|
||||
'No artifacts recorded for this run.',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -121,16 +150,10 @@ void main() {
|
||||
final controller = await _loaded(gateway);
|
||||
addTearDown(controller.dispose);
|
||||
await _pumpDetail(tester, controller, gateway);
|
||||
|
||||
await tester.ensureVisible(
|
||||
find.byKey(const ValueKey('run-detail-tab-artifacts')),
|
||||
await expectDisabledArtifacts(
|
||||
tester,
|
||||
'No artifacts recorded for this run.',
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.byKey(const ValueKey('run-detail-tab-artifacts')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('No artifacts recorded for this run.'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('an unavailable capture is never reported as empty', (
|
||||
@@ -142,16 +165,6 @@ void main() {
|
||||
final controller = await _loaded(gateway);
|
||||
addTearDown(controller.dispose);
|
||||
await _pumpDetail(tester, controller, gateway);
|
||||
|
||||
await tester.ensureVisible(
|
||||
find.byKey(const ValueKey('run-detail-tab-artifacts')),
|
||||
);
|
||||
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.byKey(const ValueKey('run-detail-tab-artifacts')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Artifacts · capture unavailable'), findsOneWidget);
|
||||
expect(find.text('No artifacts recorded for this run.'), findsNothing);
|
||||
await expectDisabledArtifacts(tester, 'Artifacts · capture unavailable');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart';
|
||||
import 'run_detail_graph_support.dart';
|
||||
import 'run_detail_visit_support.dart';
|
||||
|
||||
/// The run and stage detail bodies are flat on the page, and beside a list one
|
||||
/// row of tabs and header.
|
||||
/// The run and stage detail bodies are flat on the page, and beside a list
|
||||
/// the tabs sit under the header in one strip.
|
||||
void main() {
|
||||
testWidgets('Summary and Timeline show their bodies', (tester) async {
|
||||
await pumpRunDetail(tester, RunDetailTestPlatform.material);
|
||||
@@ -28,7 +28,7 @@ void main() {
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('beside a list the tabs and the header share one row', (
|
||||
testWidgets('beside a list the tabs sit under the header at the top', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(720, 900);
|
||||
@@ -51,11 +51,13 @@ void main() {
|
||||
|
||||
final tabs = tester.getRect(find.byKey(const Key('run-detail-tabs')));
|
||||
final header = tester.getRect(find.byKey(const Key('run-detail-header')));
|
||||
// Side by side, not stacked: the header starts after the tabs and
|
||||
// overlaps them vertically.
|
||||
expect(header.left, greaterThanOrEqualTo(tabs.right - 12));
|
||||
expect(header.top, lessThan(tabs.bottom));
|
||||
expect(header.bottom, greaterThan(tabs.top));
|
||||
// One strip at the top: the tabs are inside it, at its foot, and the
|
||||
// whole strip sits near the top of the 900px detail.
|
||||
expect(tabs.top, greaterThan(header.top));
|
||||
expect(tabs.bottom, lessThanOrEqualTo(header.bottom));
|
||||
expect(tabs.left, greaterThanOrEqualTo(header.left));
|
||||
expect(header.top, lessThan(120));
|
||||
expect(tester.getRect(find.text('Summary')).top, greaterThan(header.top));
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -59,18 +59,21 @@ void main() {
|
||||
previous = center.dx;
|
||||
}
|
||||
expect(find.byKey(runMoreMenuKey), findsOneWidget);
|
||||
// The tabs are the floating glass bar: on this 900px detail it is sized
|
||||
// to its tabs at the right edge, above the bottom.
|
||||
final pill = tester.getRect(
|
||||
// On this wide 900px detail the tabs are Material segments under the
|
||||
// run header, at the top of the detail, not a floating bottom bar.
|
||||
final row = tester.getRect(strip);
|
||||
final header = tester.getRect(find.byKey(const Key('run-detail-header')));
|
||||
expect(find.byType(SegmentedButton<RunDetailTab>), findsOneWidget);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: strip,
|
||||
matching: find.byKey(FloatingDestinationBar.rowKey),
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
expect(pill.right, 900 - 16);
|
||||
expect(pill.bottom, 1000 - 16);
|
||||
// (The test font draws every glyph a full em wide.)
|
||||
expect(pill.width, lessThan(900 * 0.7));
|
||||
expect(row.top, greaterThan(header.top));
|
||||
expect(row.bottom, lessThanOrEqualTo(header.bottom));
|
||||
expect(row.top, lessThan(1000 / 3));
|
||||
|
||||
for (final tab in [
|
||||
RunDetailTab.timeline,
|
||||
@@ -122,19 +125,24 @@ void main() {
|
||||
greaterThanOrEqualTo(844 - pill.top),
|
||||
);
|
||||
|
||||
// Wide, the tabs move to the top under the header; the content still
|
||||
// fills the pane and starts below them at rest.
|
||||
await pumpRunDetail(tester, platform, size: const Size(1000, 844));
|
||||
final widePill = tester.getRect(
|
||||
final wideTabs = tester.getRect(strip);
|
||||
expect(wideTabs.top, lessThan(844 / 3));
|
||||
expect(
|
||||
find.descendant(
|
||||
of: strip,
|
||||
matching: find.byKey(FloatingDestinationBar.rowKey),
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
expect(widePill.right, 1000 - 16);
|
||||
expect(widePill.bottom, 844 - 16);
|
||||
expect(widePill.width, lessThan(1000 * 0.6));
|
||||
// Beside the bar the content takes taps: the body fills the pane.
|
||||
expect(tester.getRect(body).left, 0);
|
||||
expect(tester.getRect(body).width, 1000);
|
||||
expect(
|
||||
MediaQuery.paddingOf(tester.element(body)).top,
|
||||
greaterThanOrEqualTo(wideTabs.bottom),
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} missing graph states the exact wording', (
|
||||
|
||||
@@ -187,4 +187,30 @@ void main() {
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
testWidgets('under a day heading a row shows only its time of day', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: RunListRow(
|
||||
run: _finished,
|
||||
now: DateTime.utc(2026, 10, 22),
|
||||
timeOfDay: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
final created = DateTime.parse('${_finished['created_at']}');
|
||||
expect(find.byType(RelativeTimeLabel), findsNothing);
|
||||
final time = tester.widget<Text>(
|
||||
find.byKey(const ValueKey('run-row-time-42')),
|
||||
);
|
||||
expect(time.data, runTimeOfDay(created));
|
||||
expect(time.data, matches(RegExp(r'^\d\d:\d\d$')));
|
||||
// The day the heading already names is not repeated on the row.
|
||||
final local = created.toLocal();
|
||||
expect(find.textContaining('${local.day} Oct'), findsNothing);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/settings/settings_controls.dart';
|
||||
|
||||
Widget _actions({required bool connected}) => MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SettingsActions(
|
||||
primaryLabel: connected ? 'Disconnect' : 'Connect',
|
||||
secondaryLabel: 'Reconnect',
|
||||
primaryKey: const Key('primary'),
|
||||
secondaryKey: const Key('secondary'),
|
||||
primaryOutlined: connected,
|
||||
onPrimary: () {},
|
||||
onSecondary: () {},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
void main() {
|
||||
testWidgets('connected: Reconnect is tonal and leads, Disconnect outlined', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(_actions(connected: true));
|
||||
final disconnect = find.byKey(const Key('primary'));
|
||||
final reconnect = find.byKey(const Key('secondary'));
|
||||
expect(tester.widget(disconnect), isA<OutlinedButton>());
|
||||
expect(tester.widget(reconnect), isA<FilledButton>());
|
||||
// Never the filled primary emphasis on the action that drops the link.
|
||||
expect(find.byType(OutlinedButton), findsOneWidget);
|
||||
expect(
|
||||
tester.getTopLeft(reconnect).dx,
|
||||
lessThan(tester.getTopLeft(disconnect).dx),
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('disconnected: Connect is filled, Reconnect outlined', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(_actions(connected: false));
|
||||
final connect = find.byKey(const Key('primary'));
|
||||
final reconnect = find.byKey(const Key('secondary'));
|
||||
expect(tester.widget(connect), isA<FilledButton>());
|
||||
expect(tester.widget(reconnect), isA<OutlinedButton>());
|
||||
expect(
|
||||
tester.getTopLeft(connect).dx,
|
||||
lessThan(tester.getTopLeft(reconnect).dx),
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user