Files
pipelines/app/test/features/runs/ui/run_detail_visit_test.dart
T
alan e34fa1050e Close the chrome gaps: content behind bars on Templates, run detail, stage page and Schedules; Search field fills the bar
- SegmentedBar.titleWidget (and ShellBar/ShellBarSpec titleWidget,
  backgroundColor): a bar's main pill can be an input in place of the title;
  Search uses it so the field fills the bar with Kind and info, capped at the
  result column width so field and results share edges on wide windows.
- Templates page/frame drop the top SafeArea again (BelowTopBar gate,
  TopBarNotices banners); Cupertino uses the grouped background.
- Settings on Cupertino in the shell publishes the grouped background so the
  bar scrim matches the page (no white band or seam).
- TopGlassStrip: the run detail header (status, actions, decision, notices)
  and the Schedules search/filter toolbar float as glass under the bar; tabs
  and lists scroll behind both.
- Stage page: stage title and Visit/Run subtitle in the bar, facts lead the
  Summary scroll, sections scroll behind the bar under floating tabs.
- Tests for content-behind-bar on each page and the title-widget bar mode;
  notes/chrome-gaps-fixes.md.
2026-10-31 04:27:35 +00:00

170 lines
5.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_timeline.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_visit_session.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_visit_session_state.dart';
import 'run_detail_graph_support.dart';
import 'run_detail_visit_support.dart';
void main() {
for (final platform in RunDetailTestPlatform.values) {
testWidgets('${platform.name} visit shows only its recorded facts', (
tester,
) async {
await openVisit(tester, platform);
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
// The page bar names the stage over its visit and run; the body does
// not repeat them.
final heading = find.byKey(const Key('run-visit-title'));
expect(
find.descendant(of: heading, matching: find.text('plan')),
findsOneWidget,
);
expect(
find.descendant(
of: heading,
matching: find.text('Visit 1 · Run 77 · Visit run'),
),
findsOneWidget,
);
expect(find.text('plan'), findsOneWidget);
expect(find.text('Visit 1'), findsNothing);
// Each fact as its label over its value; several share a line.
for (final (label, value) in [
('Status', 'completed'),
('Outcome', 'success'),
('Duration', '2m 5s'),
('Provider/model', 'anthropic / claude-x'),
('Target', 'build'),
]) {
expect(find.text(label), findsWidgets, reason: label);
expect(find.text(value), findsWidgets, reason: value);
}
for (final value in ['approve', 'Looks good.', 'Plan checked.']) {
expect(find.text(value), findsOneWidget, reason: value);
}
expect(find.text('Verdict'), findsOneWidget);
expect(find.text('Diagnostic'), findsOneWidget);
// The title is the bar's header; the facts lead the scrolled Summary
// below the bar at rest.
expect(
tester.getSemantics(find.text('plan')),
matchesSemantics(isHeader: true, label: 'plan'),
);
final facts = tester.getRect(
find.byKey(const Key('run-visit-facts-grid')),
);
expect(facts.top, greaterThanOrEqualTo(tester.getRect(heading).bottom));
// Status and duration share a line.
expect(
tester.getTopLeft(find.text('completed')).dy,
moreOrLessEquals(tester.getTopLeft(find.text('2m 5s')).dy, epsilon: 4),
);
});
testWidgets('${platform.name} duration hides without both timestamps', (
tester,
) async {
await openVisit(
tester,
platform,
run: visitRunFixture(bothTimestamps: false),
);
expect(find.textContaining('Duration'), findsNothing);
expect(find.textContaining('0s'), findsNothing);
expect(find.text('completed'), findsOneWidget);
});
testWidgets('${platform.name} absent provider/model is not invented', (
tester,
) async {
await openVisit(
tester,
platform,
run: visitRunFixture(providerModel: false),
);
expect(find.textContaining('Provider/model'), findsNothing);
expect(find.textContaining('anthropic / claude-x'), findsNothing);
});
testWidgets('${platform.name} Back closes the visit pane', (tester) async {
await openVisit(tester, platform);
await tester.tap(find.byKey(const Key('run-visit-back')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('run-visit-pane')), findsNothing);
expect(find.byType(RunTimelineList), findsOneWidget);
expect(find.text('plan · visit 1'), findsOneWidget);
});
testWidgets('${platform.name} visit pane at 320 with 2x dark text', (
tester,
) async {
await openVisit(
tester,
platform,
size: const Size(320, 568),
scale: 2,
brightness: Brightness.dark,
);
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expect(tester.takeException(), isNull);
});
testWidgets('${platform.name} long stage identity fits the bar at 2x', (
tester,
) async {
final run = visitRunFixture();
firstVisitStep(run)['stage'] =
'review-generated-release-artifacts-and-verify-evidence';
await openVisit(
tester,
platform,
run: run,
size: const Size(320, 568),
scale: 2,
);
// The bar's one-line title ellipsises a long stage instead of
// overflowing.
expect(
find.text('review-generated-release-artifacts-and-verify-evidence'),
findsOneWidget,
);
expect(find.text('Visit 1 · Run 77 · Visit run'), findsOneWidget);
expect(tester.takeException(), isNull);
});
}
testWidgets('session export with no configured endpoint states the hint', (
tester,
) async {
final step = (visitRunFixture()['steps'] as List).first as JsonMap;
final artifacts = step['artifacts'] as List;
(artifacts[1] as JsonMap)['url'] = '/artifacts/session.html';
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: RunVisitSession(
run: visitRunFor(step),
step: step,
gateway: RunDetailFakeGateway(visitRunFor(step)),
onRunChanged: (_) {},
configuredEndpoint: '',
),
),
),
);
expect(find.text('Open session.html'), findsNothing);
expect(find.text(visitSessionEndpointMissing), findsOneWidget);
});
}