Merge branch 'graph-stage-popover'
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:pipelines_app/features/graph/domain/stage_run_facts.dart';
|
||||
import 'package:pipelines_app/features/graph/domain/stage_summary.dart';
|
||||
|
||||
void main() {
|
||||
test('a model stage with no tools block runs the default tools', () {
|
||||
final summary = stageSummaryFor({
|
||||
'stages': [
|
||||
{'key': 'a', 'prompt': 'Do it', 'edges': {}},
|
||||
],
|
||||
}, 'a')!;
|
||||
expect(summary.kind, StageKind.model);
|
||||
expect(summary.tools, defaultStageTools);
|
||||
expect(summary.toolsDefault, isTrue);
|
||||
expect(summary.prompt, 'Do it');
|
||||
});
|
||||
|
||||
test('a delivery check reads as the delivery gate with its commands', () {
|
||||
final summary = stageSummaryFor({
|
||||
'stages': [
|
||||
{
|
||||
'key': 'land',
|
||||
'type': 'check',
|
||||
'configs': {'delivery': 'true', 'command_timeout': '10m'},
|
||||
'blocks': {'commands': 'make test\n\nmake lint'},
|
||||
'edges': {'pass': '#success'},
|
||||
},
|
||||
],
|
||||
}, 'land')!;
|
||||
expect(summary.typeLabel, 'Delivery gate');
|
||||
expect(summary.commands, ['make test', 'make lint']);
|
||||
expect(summary.tools, isEmpty);
|
||||
expect(summary.prompt, isNull);
|
||||
expect(summary.meta, ['10m timeout']);
|
||||
expect(summary.routes.single, (outcome: 'pass', target: 'Success'));
|
||||
});
|
||||
|
||||
test('an undeclared stage has no summary; a terminal lists routes in', () {
|
||||
final graph = {
|
||||
'stages': [
|
||||
{
|
||||
'key': 'a',
|
||||
'edges': {'success': '#success'},
|
||||
},
|
||||
],
|
||||
};
|
||||
expect(stageSummaryFor(graph, 'missing'), isNull);
|
||||
final end = stageSummaryFor(graph, '#success')!;
|
||||
expect(end.kind, StageKind.terminal);
|
||||
expect(end.routes.single, (outcome: 'success', target: 'a'));
|
||||
});
|
||||
|
||||
test('short model names drop the vendor and date', () {
|
||||
expect(
|
||||
shortModelName('anthropic/claude-opus-4-1-20250805'),
|
||||
'claude-opus-4-1',
|
||||
);
|
||||
expect(shortModelName('gpt-5'), 'gpt-5');
|
||||
});
|
||||
|
||||
test('an unvisited stage has no run facts', () {
|
||||
final facts = stageRunFacts({'steps': []}, 'a');
|
||||
expect(facts.visits, 0);
|
||||
expect(facts.status, isNull);
|
||||
});
|
||||
|
||||
test('a failure reason is read only from a failed latest visit', () {
|
||||
final facts = stageRunFacts({
|
||||
'steps': [
|
||||
{'sequence': 1, 'stage': 'a', 'status': 'failed', 'diagnostic': 'boom'},
|
||||
{
|
||||
'sequence': 2,
|
||||
'stage': 'a',
|
||||
'status': 'completed',
|
||||
'diagnostic': 'old',
|
||||
},
|
||||
],
|
||||
}, 'a');
|
||||
expect(facts.visits, 2);
|
||||
expect(facts.status, 'completed');
|
||||
expect(facts.failure, isNull);
|
||||
});
|
||||
}
|
||||
@@ -96,8 +96,13 @@ void main() {
|
||||
|
||||
// A tap in the larger canvas follows the same transform and updates the
|
||||
// presentation's own selection.
|
||||
// The tap opens the stage's popover; its "Open definition" reports it.
|
||||
await tester.tap(_inExpanded(_node('plan')));
|
||||
await tester.pump();
|
||||
expect(picked, isEmpty);
|
||||
expect(find.byKey(const Key('graph-stage-popover')), findsOneWidget);
|
||||
await tester.tap(find.byKey(const Key('stage-popover-open-definition')));
|
||||
await tester.pump();
|
||||
expect(picked, ['plan']);
|
||||
expect(
|
||||
tester.widget<GraphStageNode>(_inExpanded(_node('plan'))).selected,
|
||||
|
||||
@@ -98,6 +98,14 @@ Future<void> _tapNode(WidgetTester tester, String key) async {
|
||||
await tester.pump();
|
||||
}
|
||||
|
||||
/// Taps a node, then its popover's "Open definition", which reports the key.
|
||||
Future<void> _openDefinition(WidgetTester tester, String key) async {
|
||||
await _tapNode(tester, key);
|
||||
expect(find.byKey(const Key('graph-stage-popover')), findsOneWidget);
|
||||
await tester.tap(find.byKey(const Key('stage-popover-open-definition')));
|
||||
await tester.pump();
|
||||
}
|
||||
|
||||
void _expectNoOverlaps(WidgetTester tester) {
|
||||
final rects = <Rect>[
|
||||
for (final element in find.byType(GraphStageNode).evaluate())
|
||||
@@ -148,11 +156,10 @@ void main() {
|
||||
expect(tester.widget<GraphStageNode>(_node('build')).selected, isTrue);
|
||||
expect(tester.widget<GraphStageNode>(_node('plan')).selected, isFalse);
|
||||
|
||||
await tester.tap(_node('plan'));
|
||||
await tester.pump();
|
||||
await _openDefinition(tester, 'plan');
|
||||
expect(picked, ['plan']);
|
||||
|
||||
await _tapNode(tester, '#success');
|
||||
await _openDefinition(tester, '#success');
|
||||
expect(picked, ['plan', '#success']);
|
||||
});
|
||||
|
||||
@@ -189,7 +196,10 @@ void main() {
|
||||
);
|
||||
await tester.tapAt(build.center);
|
||||
await tester.pump();
|
||||
expect(picked, ['build']);
|
||||
expect(
|
||||
tester.widget<Text>(find.byKey(const Key('stage-popover-title'))).data,
|
||||
'build',
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('nodes use measured native sizes and never overlap', (
|
||||
|
||||
@@ -0,0 +1,369 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/graph/widgets/definition_graph_view.dart';
|
||||
import 'package:pipelines_app/features/graph/widgets/graph_stage_node.dart';
|
||||
import 'package:pipelines_app/features/graph/widgets/run_graph_view.dart';
|
||||
import 'package:pipelines_app/features/graph/widgets/stage_popover_position.dart';
|
||||
|
||||
/// One stage of every type, with the fields the popover shows.
|
||||
JsonMap _graph() => <String, dynamic>{
|
||||
'stages': <dynamic>[
|
||||
<String, dynamic>{
|
||||
'key': 'implement',
|
||||
'type': 'model',
|
||||
'prompt': 'Implement the feature.\n\nKeep the change small.',
|
||||
'configs': <String, dynamic>{
|
||||
'harness': 'claude',
|
||||
'model': 'anthropic/claude-sonnet-4-5-20250929',
|
||||
'reasoning_effort': 'high',
|
||||
'timeout': '30m',
|
||||
'retries': '2',
|
||||
'budget_usd': '5',
|
||||
},
|
||||
'blocks': <String, dynamic>{
|
||||
'tools': 'read\nglob\nedit\nshell\nmcp:pipelines',
|
||||
'permissions': '{"edit": ["app/**"], "shell": ["flutter test"]}',
|
||||
},
|
||||
'limits': <String, dynamic>{
|
||||
'max_visits': 3,
|
||||
'on': ['fail'],
|
||||
'on_exhausted': 'decide',
|
||||
},
|
||||
'edges': <String, dynamic>{'success': 'verify', 'error': '#failure'},
|
||||
},
|
||||
<String, dynamic>{
|
||||
'key': 'verify',
|
||||
'type': 'check',
|
||||
'blocks': <String, dynamic>{'commands': 'flutter analyze\nflutter test'},
|
||||
'edges': <String, dynamic>{
|
||||
'pass': 'triage',
|
||||
'fail': 'implement',
|
||||
'error': '#failure',
|
||||
},
|
||||
},
|
||||
<String, dynamic>{
|
||||
'key': 'triage',
|
||||
'type': 'findings',
|
||||
'configs': <String, dynamic>{'severity': 'critical', 'origin': 'any'},
|
||||
'edges': <String, dynamic>{'open': 'approve', 'clear': '#success'},
|
||||
},
|
||||
<String, dynamic>{
|
||||
'key': 'approve',
|
||||
'type': 'human',
|
||||
'prompt': 'Check the screenshots before landing.',
|
||||
'edges': <String, dynamic>{'accept': '#success', 'reject': 'implement'},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
JsonMap _run() => <String, dynamic>{
|
||||
'id': 7,
|
||||
'pipeline_id': 3,
|
||||
'name': 'feature',
|
||||
'version': 4,
|
||||
'steps': <dynamic>[
|
||||
<String, dynamic>{
|
||||
'sequence': 1,
|
||||
'stage': 'implement',
|
||||
'status': 'completed',
|
||||
'outcome': 'success',
|
||||
'target': 'verify',
|
||||
'started_at': '2026-10-21T10:00:00Z',
|
||||
'finished_at': '2026-10-21T10:01:00Z',
|
||||
},
|
||||
<String, dynamic>{
|
||||
'sequence': 2,
|
||||
'stage': 'verify',
|
||||
'status': 'failed',
|
||||
'outcome': 'fail',
|
||||
'target': 'implement',
|
||||
'diagnostic': 'flutter test: 2 failures',
|
||||
},
|
||||
<String, dynamic>{
|
||||
'sequence': 3,
|
||||
'stage': 'implement',
|
||||
'status': 'completed',
|
||||
'outcome': 'success',
|
||||
'target': 'verify',
|
||||
'started_at': '2026-10-21T10:02:00Z',
|
||||
'finished_at': '2026-10-21T10:04:05Z',
|
||||
'output': '# Fixed the two failing tests\nmore detail',
|
||||
'verdict': <String, dynamic>{'option': 'success', 'reason': 'All green'},
|
||||
},
|
||||
],
|
||||
'current_stage': '',
|
||||
'executing': false,
|
||||
};
|
||||
|
||||
Widget _host(Widget child, {Size size = const Size(1000, 760)}) => MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: SizedBox(width: size.width, height: size.height, child: child),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Future<void> _settle(WidgetTester tester) async {
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
}
|
||||
|
||||
Finder _node(String key) => find.byWidgetPredicate(
|
||||
(widget) => widget is GraphStageNode && widget.node.key == key,
|
||||
);
|
||||
|
||||
final Finder _popover = find.byKey(const Key('graph-stage-popover'));
|
||||
|
||||
String _title(WidgetTester tester) =>
|
||||
tester.widget<Text>(find.byKey(const Key('stage-popover-title'))).data!;
|
||||
|
||||
Future<void> _view(
|
||||
WidgetTester tester, {
|
||||
ValueChanged<String>? onSelected,
|
||||
Size size = const Size(1000, 760),
|
||||
}) async {
|
||||
tester.view.physicalSize = size;
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
await tester.pumpWidget(
|
||||
_host(
|
||||
DefinitionGraphView(graph: _graph(), onSelected: onSelected ?? (_) {}),
|
||||
size: size,
|
||||
),
|
||||
);
|
||||
await _settle(tester);
|
||||
}
|
||||
|
||||
void main() {
|
||||
testWidgets('a model stage shows its type, configs, tools and prompt', (
|
||||
tester,
|
||||
) async {
|
||||
await _view(tester);
|
||||
expect(_popover, findsNothing);
|
||||
|
||||
await tester.tap(_node('implement'));
|
||||
await tester.pump();
|
||||
|
||||
expect(_popover, findsOneWidget);
|
||||
expect(_title(tester), 'implement');
|
||||
expect(find.text('Model'), findsOneWidget);
|
||||
for (final chip in [
|
||||
'claude',
|
||||
'claude-sonnet-4-5',
|
||||
'high effort',
|
||||
'30m timeout',
|
||||
'2 retries',
|
||||
r'$5 budget',
|
||||
'mcp:pipelines',
|
||||
'max 3 visits',
|
||||
'on fail',
|
||||
'when exhausted: decide',
|
||||
]) {
|
||||
expect(find.text(chip), findsOneWidget, reason: chip);
|
||||
}
|
||||
for (final route in ['success to verify', 'error to Failure']) {
|
||||
expect(find.bySemanticsLabel(route), findsOneWidget, reason: route);
|
||||
}
|
||||
expect(find.textContaining('Implement the feature.'), findsOneWidget);
|
||||
// The permission allow-lists stay behind a collapsed line.
|
||||
expect(
|
||||
find.byKey(const Key('stage-popover-permission-lines')),
|
||||
findsNothing,
|
||||
);
|
||||
await tester.tap(find.byKey(const Key('stage-popover-permissions')));
|
||||
await tester.pump();
|
||||
expect(
|
||||
tester
|
||||
.widget<Text>(find.byKey(const Key('stage-popover-permission-lines')))
|
||||
.data,
|
||||
'edit: app/**\nshell: flutter test',
|
||||
);
|
||||
// The node is the open selection while its popover shows.
|
||||
expect(tester.widget<GraphStageNode>(_node('implement')).selected, isTrue);
|
||||
});
|
||||
|
||||
testWidgets('a check stage lists its commands instead of a prompt', (
|
||||
tester,
|
||||
) async {
|
||||
await _view(tester);
|
||||
await tester.tap(_node('verify'));
|
||||
await tester.pump();
|
||||
expect(find.text('Check'), findsWidgets);
|
||||
expect(find.byKey(const Key('stage-popover-commands')), findsOneWidget);
|
||||
expect(find.byKey(const Key('stage-popover-prompt')), findsNothing);
|
||||
final commands = tester.widget<SelectableText>(
|
||||
find.byKey(const Key('stage-popover-commands')),
|
||||
);
|
||||
expect(commands.textSpan!.toPlainText(), contains('flutter analyze'));
|
||||
expect(find.bySemanticsLabel('fail to implement'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a findings gate shows severity and origin', (tester) async {
|
||||
await _view(tester);
|
||||
await tester.tap(_node('triage'));
|
||||
await tester.pump();
|
||||
expect(find.text('Findings gate'), findsOneWidget);
|
||||
expect(find.text('min severity critical'), findsOneWidget);
|
||||
expect(find.text('origin any'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a human stage shows the operator instructions', (tester) async {
|
||||
await _view(tester);
|
||||
await tester.tap(_node('approve'));
|
||||
await tester.pump();
|
||||
expect(find.text('Human'), findsOneWidget);
|
||||
expect(find.text('Operator instructions'), findsOneWidget);
|
||||
expect(
|
||||
find.textContaining('Check the screenshots before landing.'),
|
||||
findsOneWidget,
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('the card sits inside the viewport with its nub on the node', (
|
||||
tester,
|
||||
) async {
|
||||
await _view(tester);
|
||||
await tester.tap(_node('verify'));
|
||||
await tester.pump();
|
||||
final card = tester.getRect(find.byKey(const Key('stage-popover-body')));
|
||||
final viewport = tester.getRect(find.byType(InteractiveViewer));
|
||||
expect(viewport.inflate(1).contains(card.topLeft), isTrue);
|
||||
expect(viewport.inflate(1).contains(card.bottomRight), isTrue);
|
||||
final position = tester.renderObject<RenderStagePopoverPosition>(_popover);
|
||||
expect(position.side, isNot(StagePopoverSide.over));
|
||||
});
|
||||
|
||||
testWidgets('an outside tap, Escape and the same node close it', (
|
||||
tester,
|
||||
) async {
|
||||
await _view(tester);
|
||||
await tester.tap(_node('implement'));
|
||||
await tester.pump();
|
||||
expect(_popover, findsOneWidget);
|
||||
|
||||
// Tapping inside the card keeps it open.
|
||||
await tester.tap(find.byKey(const Key('stage-popover-title')));
|
||||
await tester.pump();
|
||||
expect(_popover, findsOneWidget);
|
||||
|
||||
// An outside tap on the empty canvas closes it.
|
||||
final viewport = tester.getRect(find.byType(InteractiveViewer));
|
||||
await tester.tapAt(viewport.bottomRight - const Offset(10, 10));
|
||||
await tester.pump();
|
||||
expect(_popover, findsNothing);
|
||||
|
||||
// A drag pans the graph but keeps the card on its node.
|
||||
await tester.tap(_node('implement'));
|
||||
await tester.pump();
|
||||
await tester.dragFrom(
|
||||
viewport.bottomRight - const Offset(40, 40),
|
||||
const Offset(-60, -20),
|
||||
);
|
||||
await tester.pump();
|
||||
expect(_popover, findsOneWidget);
|
||||
|
||||
// Escape closes it.
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
|
||||
await tester.pump();
|
||||
expect(_popover, findsNothing);
|
||||
|
||||
// Tapping the same node again toggles it shut.
|
||||
await tester.tap(_node('implement'));
|
||||
await tester.pump();
|
||||
expect(_popover, findsOneWidget);
|
||||
await tester.tap(_node('implement'));
|
||||
await tester.pump();
|
||||
expect(_popover, findsNothing);
|
||||
|
||||
// Another node replaces it.
|
||||
await tester.tap(_node('triage'));
|
||||
await tester.pump();
|
||||
expect(_title(tester), 'triage');
|
||||
await tester.tap(_node('implement'));
|
||||
await tester.pump();
|
||||
expect(_title(tester), 'implement');
|
||||
});
|
||||
|
||||
testWidgets('Open definition reports the stage and closes the card', (
|
||||
tester,
|
||||
) async {
|
||||
final opened = <String>[];
|
||||
await _view(tester, onSelected: opened.add);
|
||||
await tester.tap(_node('approve'));
|
||||
await tester.pump();
|
||||
await tester.tap(find.byKey(const Key('stage-popover-open-definition')));
|
||||
await tester.pump();
|
||||
expect(opened, ['approve']);
|
||||
expect(_popover, findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('a focused node opens with Enter', (tester) async {
|
||||
await _view(tester);
|
||||
// The node's own focus: the nearest focus above its label.
|
||||
final label = find
|
||||
.descendant(of: _node('triage'), matching: find.byType(Text))
|
||||
.first;
|
||||
Focus.of(tester.element(label)).requestFocus();
|
||||
await tester.pump();
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
|
||||
await tester.pump();
|
||||
expect(_popover, findsOneWidget);
|
||||
expect(_title(tester), 'triage');
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
|
||||
await tester.pump();
|
||||
expect(_popover, findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('a phone-width graph opens the stage in a bottom sheet', (
|
||||
tester,
|
||||
) async {
|
||||
await _view(tester, size: const Size(390, 760));
|
||||
await tester.tap(_node('implement'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(_popover, findsNothing);
|
||||
expect(find.byKey(const Key('graph-stage-sheet')), findsOneWidget);
|
||||
expect(_title(tester), 'implement');
|
||||
expect(find.text('claude-sonnet-4-5'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('the run variant shows status, visits, verdict and failure', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(1000, 760);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final visits = <String>[];
|
||||
await tester.pumpWidget(
|
||||
_host(
|
||||
RunGraphView(graph: _graph(), run: _run(), onStageSelected: visits.add),
|
||||
),
|
||||
);
|
||||
await _settle(tester);
|
||||
|
||||
await tester.tap(_node('implement'));
|
||||
await tester.pump();
|
||||
expect(find.text('completed'), findsWidgets);
|
||||
expect(find.text('×2'), findsOneWidget);
|
||||
expect(find.text('2m 5s'), findsOneWidget);
|
||||
expect(find.text('success: All green'), findsOneWidget);
|
||||
expect(find.text('Fixed the two failing tests'), findsOneWidget);
|
||||
await tester.tap(find.byKey(const Key('stage-popover-open-visit')));
|
||||
await tester.pump();
|
||||
expect(visits, ['implement']);
|
||||
|
||||
await tester.tap(_node('verify'));
|
||||
await tester.pump();
|
||||
expect(find.text('×1'), findsOneWidget);
|
||||
expect(find.text('flutter test: 2 failures'), findsOneWidget);
|
||||
|
||||
// Open definition pushes the pinned stage definition page.
|
||||
await tester.tap(find.byKey(const Key('stage-popover-open-definition')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('verify definition'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
@@ -260,7 +260,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
'a visited stage reports its key and an unvisited node does not',
|
||||
'a visited stage opens its visit from the popover; an unvisited one has none',
|
||||
(tester) async {
|
||||
final picked = <String>[];
|
||||
await tester.pumpWidget(
|
||||
@@ -278,28 +278,26 @@ void main() {
|
||||
final visited = tester.getSemantics(_node('plan')).getSemanticsData();
|
||||
expect(visited.flagsCollection.isButton, isTrue);
|
||||
expect(visited.hasAction(SemanticsAction.tap), isTrue);
|
||||
// An unvisited stage still opens its declaration, with no status.
|
||||
final unvisited = tester.getSemantics(_node('build')).getSemanticsData();
|
||||
expect(unvisited.flagsCollection.isButton, isFalse);
|
||||
expect(unvisited.hasAction(SemanticsAction.tap), isFalse);
|
||||
expect(unvisited.flagsCollection.isButton, isTrue);
|
||||
expect(unvisited.label, 'build');
|
||||
|
||||
await tester.tap(_node('plan'));
|
||||
await tester.pump();
|
||||
expect(picked, isEmpty);
|
||||
await tester.tap(find.byKey(const Key('stage-popover-open-visit')));
|
||||
await tester.pump();
|
||||
expect(picked, ['plan']);
|
||||
|
||||
// `build` was never recorded in this run: it is a plain label, not a
|
||||
// button, and tapping it reports nothing (never a fabricated visit).
|
||||
await tester.tap(_node('build'), warnIfMissed: false);
|
||||
// `build` was never recorded in this run: its popover offers no visit,
|
||||
// so nothing is ever fabricated.
|
||||
await tester.tap(_node('build'));
|
||||
await tester.pump();
|
||||
expect(find.byKey(const Key('graph-stage-popover')), findsOneWidget);
|
||||
expect(find.byKey(const Key('stage-popover-open-visit')), findsNothing);
|
||||
expect(find.byKey(const Key('stage-popover-status')), findsNothing);
|
||||
expect(picked, ['plan']);
|
||||
expect(
|
||||
find.ancestor(
|
||||
of: _node('build'),
|
||||
matching: find.byWidgetPredicate(
|
||||
(widget) => widget is IgnorePointer && widget.ignoring,
|
||||
),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
handle.dispose();
|
||||
},
|
||||
);
|
||||
|
||||
@@ -30,6 +30,10 @@ Future<void> _tapNode(WidgetTester tester, Finder node) async {
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
await tester.tap(node);
|
||||
await tester.pump(); // A tap opens the stage's popover (or sheet); "Open definition" opens the
|
||||
// pinned definition page, as a tap did before the popover.
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('stage-popover-open-definition')));
|
||||
await tester.pump();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@ Future<void> _tapNode(WidgetTester tester, String key) async {
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
await tester.tap(_node(key));
|
||||
await tester.pump(); // A tap opens the stage's popover (or sheet); "Open definition" opens the
|
||||
// pinned definition page, as a tap did before the popover.
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('stage-popover-open-definition')));
|
||||
await tester.pump();
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ void main() {
|
||||
) async {
|
||||
await pumpDeepLink(tester, RunDetailTestPlatform.material);
|
||||
await openRunDetailTab(tester, RunDetailTab.graph);
|
||||
await tapGraphNode(tester, 'plan');
|
||||
await openGraphVisit(tester, 'plan');
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// The web client's graph click takes the last visit in sequence order, not
|
||||
|
||||
@@ -156,3 +156,11 @@ Future<void> tapGraphNode(WidgetTester tester, String key) async {
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
}
|
||||
|
||||
/// Opens [key]'s stage popover (or sheet), then its "Open visit".
|
||||
Future<void> openGraphVisit(WidgetTester tester, String key) async {
|
||||
await tapGraphNode(tester, key);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('stage-popover-open-visit')));
|
||||
await tester.pump();
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ void main() {
|
||||
) async {
|
||||
await pumpRunDetail(tester, platform);
|
||||
await openRunDetailTab(tester, RunDetailTab.graph);
|
||||
await tapGraphNode(tester, 'plan');
|
||||
await openGraphVisit(tester, 'plan');
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// The Graph reports the stage; the exact recorded visit opens as its
|
||||
@@ -76,9 +76,11 @@ void main() {
|
||||
) async {
|
||||
await pumpRunDetail(tester, platform);
|
||||
await openRunDetailTab(tester, RunDetailTab.graph);
|
||||
// `audit` was never recorded: its node is not a control and a click must
|
||||
// leave the detail on the Graph tab.
|
||||
// `audit` was never recorded: its popover shows the declaration but
|
||||
// offers no visit, and the detail stays on the Graph tab.
|
||||
await tapGraphNode(tester, 'audit');
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('stage-popover-open-visit')), findsNothing);
|
||||
expect(find.byType(RunGraphView), findsOneWidget);
|
||||
expect(
|
||||
find.byKey(const Key('run-detail-tab-body-timeline')),
|
||||
@@ -96,7 +98,7 @@ void main() {
|
||||
scale: 2,
|
||||
);
|
||||
await openRunDetailTab(tester, RunDetailTab.graph);
|
||||
await tapGraphNode(tester, 'plan');
|
||||
await openGraphVisit(tester, 'plan');
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Leaving the visit page lands on Timeline. At 320/2x the strip
|
||||
|
||||
Reference in New Issue
Block a user