Merge branch 'worktree-agent-a82ec5e9fdf8ca159' into integrate/gaps-e
# Conflicts: # app/test/features/search/search_bar_layout_test.dart
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/runs/actions/decision_wording.dart';
|
||||
import 'package:pipelines_app/features/runs/screen.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/glass_pill.dart';
|
||||
|
||||
class _DecisionGateway implements ApiGateway {
|
||||
final events = StreamController<JsonMap>.broadcast();
|
||||
@@ -73,16 +74,25 @@ void main() {
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(decisionWaitingTitle), findsOneWidget);
|
||||
// The web's decision banner spans the header at its 16px inset, with
|
||||
// The web's decision banner spans the header's glass strip (under
|
||||
// the top bar, 12 in from the pane) at the strip's 12px inset, with
|
||||
// Decide trailing.
|
||||
final banner = tester.getRect(
|
||||
find.byKey(const Key('run-decision-banner')),
|
||||
);
|
||||
final strip = tester.getRect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('run-detail-header')),
|
||||
matching: find.byType(GlassPill),
|
||||
),
|
||||
);
|
||||
final pane = tester.getRect(
|
||||
find.byKey(const ValueKey('list-detail-body')),
|
||||
);
|
||||
expect(banner.left, pane.left + 16);
|
||||
expect(banner.right, pane.right - 16);
|
||||
expect(strip.left, pane.left + 12);
|
||||
expect(strip.right, pane.right - 12);
|
||||
expect(banner.left, strip.left + 12);
|
||||
expect(banner.right, strip.right - 12);
|
||||
expect(
|
||||
tester.getCenter(find.byKey(decisionActionKey)).dx,
|
||||
greaterThan(banner.center.dx),
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/glass_pill.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart';
|
||||
|
||||
import 'run_detail_graph_support.dart';
|
||||
import 'run_detail_visit_support.dart';
|
||||
|
||||
/// The run detail and the stage page scroll behind their top bars: the run's
|
||||
/// status and actions are a glass strip under the bar (not a fixed block
|
||||
/// above the tab), and the stage page's bar names the stage while its
|
||||
/// sections, led by the facts, pass behind it.
|
||||
void main() {
|
||||
Rect pieceOf(WidgetTester tester, Finder owner) => tester.getRect(
|
||||
find.descendant(of: owner, matching: find.byType(GlassPill)).first,
|
||||
);
|
||||
|
||||
ScrollPosition positionIn(WidgetTester tester, Finder owner) => tester
|
||||
.state<ScrollableState>(
|
||||
find.descendant(of: owner, matching: find.byType(Scrollable)).first,
|
||||
)
|
||||
.position;
|
||||
|
||||
for (final platform in RunDetailTestPlatform.values) {
|
||||
testWidgets('${platform.name} run header floats under the bar and the '
|
||||
'tab scrolls behind both', (tester) async {
|
||||
await pumpRunDetail(tester, platform, size: const Size(390, 520));
|
||||
|
||||
final bar = pieceOf(tester, find.byType(SegmentedBar));
|
||||
final header = find.byKey(const Key('run-detail-header'));
|
||||
final strip = pieceOf(tester, header);
|
||||
// A glass strip just under the bar, at the bar's side inset.
|
||||
expect(strip.top, greaterThanOrEqualTo(bar.bottom));
|
||||
expect(strip.top - bar.bottom, lessThan(24));
|
||||
expect(strip.left, 12);
|
||||
expect(find.byKey(const Key('run-status-kicker')), findsWidgets);
|
||||
|
||||
// The tab fills the detail from the top edge; its content starts
|
||||
// below the strip at rest.
|
||||
final body = find.byKey(const Key('run-detail-tab-body-summary'));
|
||||
expect(tester.getTopLeft(body).dy, 0);
|
||||
final padding = MediaQuery.paddingOf(tester.element(body)).top;
|
||||
expect(padding, greaterThanOrEqualTo(strip.bottom));
|
||||
|
||||
// Scrolled, the content passes behind the strip and the bar.
|
||||
final position = positionIn(tester, body);
|
||||
expect(position.maxScrollExtent, greaterThan(0));
|
||||
final firstChild = find
|
||||
.descendant(of: body, matching: find.byType(Text))
|
||||
.first;
|
||||
final before = tester.getTopLeft(firstChild).dy;
|
||||
expect(before, greaterThanOrEqualTo(strip.bottom - 1));
|
||||
position.jumpTo(position.maxScrollExtent.clamp(0, 200).toDouble());
|
||||
await tester.pump();
|
||||
expect(tester.getTopLeft(firstChild).dy, lessThan(before));
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} stage page names the stage in its bar and '
|
||||
'its Summary scrolls behind it', (tester) async {
|
||||
await openVisit(tester, platform, size: const Size(390, 844));
|
||||
|
||||
final bar = find.ancestor(
|
||||
of: find.byKey(const Key('run-visit-back')),
|
||||
matching: find.byType(SegmentedBar),
|
||||
);
|
||||
final heading = find.byKey(const Key('run-visit-title'));
|
||||
expect(
|
||||
find.descendant(of: bar, matching: heading),
|
||||
findsOneWidget,
|
||||
reason: 'the stage is the bar title',
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: heading, matching: find.text('plan')),
|
||||
findsOneWidget,
|
||||
);
|
||||
final barBottom = pieceOf(tester, bar).bottom;
|
||||
|
||||
final summary = find.byKey(const Key('run-visit-body-summary'));
|
||||
expect(tester.getTopLeft(summary).dy, 0);
|
||||
final facts = find.byKey(const Key('run-visit-facts-grid'));
|
||||
final rest = tester.getTopLeft(facts).dy;
|
||||
expect(rest, greaterThanOrEqualTo(barBottom));
|
||||
// The tabs float at the bottom over the section.
|
||||
final tabs = pieceOf(tester, find.byKey(const Key('run-visit-tabs')));
|
||||
expect(tabs.bottom, 844 - 16);
|
||||
expect(tester.getRect(summary).bottom, 844);
|
||||
|
||||
// Open Input so the section is long enough to scroll, then scroll:
|
||||
// the facts pass behind the bar.
|
||||
await tester.tap(find.text('Input').first);
|
||||
await tester.pumpAndSettle();
|
||||
final position = positionIn(tester, summary);
|
||||
if (position.maxScrollExtent > 0) {
|
||||
position.jumpTo(position.maxScrollExtent.clamp(0, 60).toDouble());
|
||||
await tester.pump();
|
||||
expect(tester.getTopLeft(facts).dy, lessThan(rest));
|
||||
}
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -13,17 +13,20 @@ Finder runDetailText(String text) => find.descendant(
|
||||
matching: find.text(text),
|
||||
);
|
||||
|
||||
/// Stage identity and visit coordinates are separate rendered fields now.
|
||||
/// The stage page's bar names the stage over its visit (and run): the title
|
||||
/// is keyed `run-visit-title` and the subtitle starts `Visit <sequence>`.
|
||||
void expectVisitHeading(WidgetTester tester, String stage, num sequence) {
|
||||
final pane = find.byKey(const Key('run-visit-pane'));
|
||||
expect(pane, findsOneWidget);
|
||||
final title = find.descendant(
|
||||
of: pane,
|
||||
matching: find.byKey(const Key('run-visit-title')),
|
||||
);
|
||||
expect(tester.widget<Text>(title).data, stage);
|
||||
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
|
||||
final heading = find.byKey(const Key('run-visit-title'));
|
||||
expect(
|
||||
find.descendant(of: pane, matching: find.text('Visit $sequence')),
|
||||
find.descendant(of: heading, matching: find.text(stage)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: heading,
|
||||
matching: find.textContaining(RegExp('^Visit $sequence( ·|\$)')),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,9 +16,22 @@ void main() {
|
||||
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'), findsOneWidget);
|
||||
expect(find.text('Run 77'), 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'),
|
||||
@@ -36,20 +49,16 @@ void main() {
|
||||
expect(find.text('Verdict'), findsOneWidget);
|
||||
expect(find.text('Diagnostic'), findsOneWidget);
|
||||
|
||||
// Stage identity is a distinct, prominent heading; coordinates are
|
||||
// subordinate and the facts remain aligned with the heading.
|
||||
final titleFinder = find.byKey(const Key('run-visit-title'));
|
||||
final title = tester.getTopLeft(titleFinder).dx;
|
||||
final titleStyle = tester.widget<Text>(titleFinder).style!;
|
||||
expect(titleStyle.fontSize!, greaterThan(18));
|
||||
// The title is the bar's header; the facts lead the scrolled Summary
|
||||
// below the bar at rest.
|
||||
expect(
|
||||
tester.getTopLeft(find.text('Visit 1')).dy,
|
||||
greaterThan(tester.getTopLeft(titleFinder).dy),
|
||||
tester.getSemantics(find.text('plan')),
|
||||
matchesSemantics(isHeader: true, label: 'plan'),
|
||||
);
|
||||
expect(
|
||||
tester.getTopLeft(find.byKey(const Key('run-visit-facts-grid'))).dx,
|
||||
title,
|
||||
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,
|
||||
@@ -109,7 +118,7 @@ void main() {
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} long stage identity wraps at 2x', (
|
||||
testWidgets('${platform.name} long stage identity fits the bar at 2x', (
|
||||
tester,
|
||||
) async {
|
||||
final run = visitRunFixture();
|
||||
@@ -123,12 +132,13 @@ void main() {
|
||||
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'), findsOneWidget);
|
||||
expect(find.text('Run 77'), findsOneWidget);
|
||||
expect(find.text('Visit 1 · Run 77 · Visit run'), findsOneWidget);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user