Merge branch 'main' into run/formats-wording
This commit is contained in:
@@ -147,6 +147,11 @@ void main() {
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
final pagerPill = find.ancestor(
|
||||
of: find.byKey(ChangesVisitPager.nextKey),
|
||||
matching: find.byType(GlassPill),
|
||||
);
|
||||
expect(tester.getRect(pagerPill).width, lessThan(400));
|
||||
|
||||
await tester.tap(find.byKey(ChangesVisitPager.nextKey));
|
||||
await tester.pump();
|
||||
|
||||
@@ -206,5 +206,45 @@ void main() {
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
testWidgets('Cupertino mode is icon-only below 600px', (tester) async {
|
||||
if (!cupertino) return;
|
||||
final semantics = tester.ensureSemantics();
|
||||
_size(tester, const Size(560, 800));
|
||||
await _pump(
|
||||
tester,
|
||||
cupertino: true,
|
||||
messages: 1,
|
||||
session: const {
|
||||
'id': 's',
|
||||
'backend': 'opencode',
|
||||
'model': 'p/sonnet-4-5',
|
||||
'mode': 'default',
|
||||
'mode_name': 'Ask for permission',
|
||||
},
|
||||
);
|
||||
|
||||
final mode = find.byKey(const Key('chat-mode'));
|
||||
expect(mode, findsOneWidget);
|
||||
expect(
|
||||
find.descendant(of: mode, matching: find.text('Ask for permission')),
|
||||
findsNothing,
|
||||
);
|
||||
expect(
|
||||
tester.getSemantics(mode).label,
|
||||
contains('Change mode, currently Ask for permission'),
|
||||
);
|
||||
await tester.tap(mode);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('chat-mode-sheet')), findsOneWidget);
|
||||
// The fixture has no chat_modes catalog, but the recorded session mode
|
||||
// remains visible in the sheet.
|
||||
expect(
|
||||
find.byKey(const ValueKey('chat-mode-option-default')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.text('Ask for permission'), findsOneWidget);
|
||||
semantics.dispose();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/semantics.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/graph/viewport/graph_expanded_view.dart';
|
||||
import 'package:pipelines_app/features/graph/viewport/graph_viewport.dart';
|
||||
import 'package:pipelines_app/features/graph/viewport/graph_viewport_math.dart';
|
||||
import 'package:pipelines_app/features/graph/widgets/definition_graph_view.dart';
|
||||
import 'package:pipelines_app/features/graph/widgets/graph_stage_node.dart';
|
||||
@@ -103,7 +105,7 @@ void main() {
|
||||
isTrue,
|
||||
);
|
||||
|
||||
await tester.tap(find.byKey(const Key('graph-expanded-close')));
|
||||
await tester.tap(find.byType(BackButton));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(GraphExpandedView), findsNothing);
|
||||
@@ -195,14 +197,18 @@ void main() {
|
||||
await tester.tap(find.byKey(const Key('graph-expand')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(GraphExpandedView), findsOneWidget);
|
||||
expect(_inExpanded(find.text(graphExpandedClose)), findsOneWidget);
|
||||
expect(
|
||||
_inExpanded(find.byType(CupertinoNavigationBarBackButton)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(_inExpanded(find.byKey(const Key('graph-fit'))), findsOneWidget);
|
||||
expect(
|
||||
tester.widget<GraphStageNode>(_inExpanded(_node('build'))).selected,
|
||||
isTrue,
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
|
||||
await tester.tap(find.byKey(const Key('graph-expanded-close')));
|
||||
await tester.tap(find.byType(CupertinoNavigationBarBackButton));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(GraphExpandedView), findsNothing);
|
||||
expect(tester.widget<GraphStageNode>(_node('build')).selected, isTrue);
|
||||
@@ -210,4 +216,43 @@ void main() {
|
||||
expect(picked, isEmpty);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('expanded Fit is an activatable labelled button on both hosts', (
|
||||
tester,
|
||||
) async {
|
||||
for (final cupertino in [false, true]) {
|
||||
final host = cupertino ? 'Cupertino' : 'Material';
|
||||
await tester.pumpWidget(
|
||||
cupertino
|
||||
? CupertinoApp(
|
||||
home: CupertinoPageScaffold(
|
||||
child: DefinitionGraphView(
|
||||
graph: linearGraph(),
|
||||
selectedStage: 'build',
|
||||
onSelected: (_) {},
|
||||
),
|
||||
),
|
||||
)
|
||||
: _materialHost(
|
||||
graph: linearGraph(),
|
||||
selected: 'build',
|
||||
onSelected: (_) {},
|
||||
),
|
||||
);
|
||||
await _settle(tester);
|
||||
await tester.tap(find.byKey(const Key('graph-expand')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final fit = tester
|
||||
.getSemantics(_inExpanded(find.byKey(const Key('graph-fit'))))
|
||||
.getSemanticsData();
|
||||
expect(fit.label, graphFitLabel, reason: '$host Fit must be labelled');
|
||||
expect(fit.flagsCollection.isButton, isTrue);
|
||||
expect(
|
||||
fit.hasAction(SemanticsAction.tap),
|
||||
isTrue,
|
||||
reason: '$host Fit must expose its tap action on the labelled node',
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -82,6 +82,16 @@ void main() {
|
||||
expect(_text('error'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('the rendered/raw control remains compact', (tester) async {
|
||||
tester.view.physicalSize = const Size(800, 700);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
await tester.pumpWidget(_material(_view()));
|
||||
|
||||
final control = find.byKey(const Key('markdown-source-mode'));
|
||||
expect(tester.getRect(control).width, lessThan(221));
|
||||
});
|
||||
|
||||
testWidgets('the raw section keeps unknown fields exact and selectable', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
@@ -128,7 +128,7 @@ void main() {
|
||||
isTrue,
|
||||
);
|
||||
|
||||
await tester.tap(find.byKey(const Key('graph-expanded-close')));
|
||||
await tester.tap(find.byType(BackButton));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(GraphExpandedView), findsNothing);
|
||||
@@ -149,7 +149,7 @@ void main() {
|
||||
|
||||
await tester.tap(find.byKey(const Key('graph-expand')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('graph-expanded-close')));
|
||||
await tester.tap(find.byType(BackButton));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(GraphExpandedView), findsNothing);
|
||||
|
||||
@@ -56,4 +56,40 @@ void main() {
|
||||
expect(find.text('→ #failure'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
for (final cupertino in [false, true]) {
|
||||
testWidgets('outcome chips are coloured by name, not by status '
|
||||
'(${cupertino ? 'cupertino' : 'material'})', (tester) async {
|
||||
// Every step completed: before, all three chips were the success colour.
|
||||
final steps = [
|
||||
for (final (i, outcome) in [
|
||||
'success',
|
||||
'rejected',
|
||||
'success',
|
||||
'approved',
|
||||
].indexed)
|
||||
{
|
||||
'stage': 'stage$i',
|
||||
'sequence': i + 1,
|
||||
'status': 'completed',
|
||||
'outcome': outcome,
|
||||
},
|
||||
];
|
||||
final list = RunTimelineList(
|
||||
visits: detailTimeline(steps),
|
||||
cupertino: cupertino,
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
cupertino
|
||||
? CupertinoApp(home: CupertinoPageScaffold(child: list))
|
||||
: MaterialApp(home: Scaffold(body: list)),
|
||||
);
|
||||
Color chip(String text, [int at = 0]) =>
|
||||
tester.widget<Text>(find.text(text).at(at)).style!.color!;
|
||||
expect(chip('success'), chip('success', 1));
|
||||
expect(chip('rejected'), isNot(chip('success')));
|
||||
expect(chip('approved'), isNot(chip('success')));
|
||||
expect(chip('approved'), isNot(chip('rejected')));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ void main() {
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
await tester.pumpWidget(const MaterialApp(home: Scaffold(body: _Host())));
|
||||
expect(tester.getTopLeft(find.text('Input')).dx, 16);
|
||||
expect(find.text('line 0'), findsOneWidget);
|
||||
// Empty space well right of the short title, left of the chevron.
|
||||
final strip = tester.getRect(find.byType(StickySectionTitle));
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/status/outcome_palette.dart';
|
||||
|
||||
void main() {
|
||||
test('same outcome names share a colour; different names never do', () {
|
||||
final palette = OutcomePalette([
|
||||
'success',
|
||||
'rejected',
|
||||
'Success',
|
||||
'approved',
|
||||
'',
|
||||
'rejected ',
|
||||
]);
|
||||
expect(palette.indexOf('success'), 0);
|
||||
expect(palette.indexOf('SUCCESS'), 0);
|
||||
expect(palette.indexOf('rejected'), 1);
|
||||
expect(palette.indexOf('approved'), 2);
|
||||
expect(palette.indexOf(''), isNull);
|
||||
expect(palette.indexOf('never seen'), isNull);
|
||||
});
|
||||
|
||||
test('the first fifty outcome colours are all distinct in both themes', () {
|
||||
for (final brightness in Brightness.values) {
|
||||
final colours = {
|
||||
for (var i = 0; i < 50; i++) outcomeColorAt(i, brightness).toARGB32(),
|
||||
};
|
||||
expect(colours, hasLength(50), reason: '$brightness');
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user