App: run failure reasons, Run again, labelled tabs, actionable errors, nav fixes
- Run rows show a failed run's reason (else its diagnostic's first line, full text in a tooltip) or a short result preview; the Summary leads with "Why it failed". - Run again for succeeded/canceled/interrupted runs opens the New run form pre-filled (prompt, workspace, report format) at the latest version with the original offered. - Run detail and stage tabs show their names; touch shows captions on the Runs header and artifact viewer actions (desktop keeps tooltips). - ErrorNotice maps not connected / server too old / permission / timeout to what to do, raw detail behind Details (Schedules, create chat, Runs, Pipelines banners). - Settings has no Back arrow; Schedules keeps the rail on wide windows; phone Settings leads with Connection and Notifications and has a Jump to topic menu. - Walkthrough: Open Connection (skipped when connected), labelled Copy. - Pluralised counts; no duplicate status/rail names for screen readers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import 'package:pipelines_app/application/schedules_destination.dart';
|
||||
import 'package:pipelines_app/application/server_endpoint.dart';
|
||||
import 'package:pipelines_app/core/transport/pipelines_client.dart';
|
||||
import 'package:pipelines_app/features/schedules/ui/list/schedule_list_toolbar.dart';
|
||||
import 'package:pipelines_app/shell/destination.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart';
|
||||
|
||||
import '../core/transport/pipelines_client_test.dart' show FakeChannel;
|
||||
@@ -80,4 +81,41 @@ void main() {
|
||||
expect(find.byKey(scheduleRefreshKey), findsOneWidget);
|
||||
expect(find.byType(SegmentedBackButton), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a wide window keeps the navigation rail beside Schedules; a '
|
||||
'narrow one does not', (tester) async {
|
||||
final client = PipelinesClient(channelFactory: (_) => FakeChannel());
|
||||
final server = ServerEndpoint.resolve(
|
||||
base: Uri.parse('http://127.0.0.1:8096/'),
|
||||
web: true,
|
||||
);
|
||||
final session = AppSession(endpoint: server.uri, client: client);
|
||||
addTearDown(session.dispose);
|
||||
final selected = <AppDestination>[];
|
||||
Future<void> pumpAt(double width) async {
|
||||
tester.view.physicalSize = Size(width, 800);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: SchedulesDestination(
|
||||
session: session,
|
||||
server: server,
|
||||
onBack: () {},
|
||||
onOpenPipeline: (_) {},
|
||||
onSelectDestination: selected.add,
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
}
|
||||
|
||||
addTearDown(tester.view.reset);
|
||||
await pumpAt(1300);
|
||||
expect(find.byType(NavigationRail), findsOneWidget);
|
||||
await tester.tap(find.byKey(const ValueKey('shell.destination.runs')));
|
||||
expect(selected, [AppDestination.runs]);
|
||||
|
||||
await pumpAt(500);
|
||||
expect(find.byType(NavigationRail), findsNothing);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@ void main() {
|
||||
androidSupported: false,
|
||||
server: webServer(),
|
||||
client: PipelinesClient(
|
||||
replaceSilentSocket: false,
|
||||
channelFactory: (_) => channel,
|
||||
),
|
||||
replaceSilentSocket: false,
|
||||
channelFactory: (_) => channel,
|
||||
),
|
||||
routeInformationProvider: provider,
|
||||
),
|
||||
);
|
||||
@@ -143,8 +143,8 @@ void main() {
|
||||
await tester.pump();
|
||||
});
|
||||
|
||||
testWidgets('the /settings deep link opens Settings as a pushed page with '
|
||||
'Back, and the system Back closes it to Pipelines', (tester) async {
|
||||
testWidgets('the /settings deep link opens Settings with no Back arrow, and '
|
||||
'the system Back closes it to Pipelines', (tester) async {
|
||||
final provider = await pumpApp(
|
||||
tester,
|
||||
location: '/settings',
|
||||
@@ -152,7 +152,8 @@ void main() {
|
||||
);
|
||||
await tester.pump();
|
||||
expect(find.byType(SettingsScreen), findsOneWidget);
|
||||
expect(find.byKey(const ValueKey('shell.back')), findsOneWidget);
|
||||
// A top-level destination draws no Back arrow however it was reached.
|
||||
expect(find.byKey(const ValueKey('shell.back')), findsNothing);
|
||||
expect(selectedTab(tester), 4);
|
||||
|
||||
final handled = await tester.binding.handlePopRoute();
|
||||
|
||||
@@ -313,8 +313,10 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(provider.value.uri.path, '/settings');
|
||||
// A tab retap preserves Settings; explicit Back returns to Pipelines.
|
||||
await tester.tap(find.byKey(const Key('shell.back')));
|
||||
// Settings is a top-level destination with no Back arrow; the system
|
||||
// Back still returns to Pipelines.
|
||||
expect(find.byKey(const Key('shell.back')), findsNothing);
|
||||
await tester.binding.handlePopRoute();
|
||||
await tester.pumpAndSettle();
|
||||
expect(provider.value.uri.path, '/pipelines');
|
||||
expect(find.text('Probe release'), findsOneWidget);
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/navigation/labelled_icon_button.dart';
|
||||
import 'package:pipelines_app/features/artifacts/domain/artifact_groups.dart';
|
||||
import 'package:pipelines_app/features/artifacts/domain/artifact_record.dart';
|
||||
import 'package:pipelines_app/features/artifacts/ui/artifact_fullscreen.dart';
|
||||
@@ -76,7 +77,13 @@ Future<void> _enter(WidgetTester tester) async {
|
||||
}
|
||||
|
||||
/// A bar control by its Material tooltip.
|
||||
Finder _named(String name) => find.byTooltip(name);
|
||||
/// A control named [name]: by its tooltip on desktop, or by its accessible
|
||||
/// name where touch shows the name as a caption instead.
|
||||
Finder _named(String name) => find.byWidgetPredicate(
|
||||
(widget) =>
|
||||
(widget is Tooltip && widget.message == name) ||
|
||||
(widget is LabelledIconButton && widget.label == name),
|
||||
);
|
||||
|
||||
void main() {
|
||||
testWidgets('the bottom actions offer Full screen', (tester) async {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/navigation/labelled_icon_button.dart';
|
||||
import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_body.dart';
|
||||
import 'package:pipelines_app/features/changes/widgets/diff_form_control.dart';
|
||||
|
||||
@@ -56,7 +57,14 @@ void main() {
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.tap(find.byTooltip('Details'));
|
||||
// A tooltip on desktop; a caption under the icon on touch.
|
||||
await tester.tap(
|
||||
find.byWidgetPredicate(
|
||||
(widget) =>
|
||||
(widget is Tooltip && widget.message == 'Details') ||
|
||||
(widget is LabelledIconButton && widget.label == 'Details'),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Recorded artifact facts'), findsOneWidget);
|
||||
expect(find.byType(Dialog), width >= 600 ? findsOneWidget : findsNothing);
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
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/pipelines/pending_run_store.dart';
|
||||
import 'package:pipelines_app/features/pipelines/pipeline_repository.dart';
|
||||
import 'package:pipelines_app/features/pipelines/pipelines_controller.dart';
|
||||
import 'package:pipelines_app/features/pipelines/run_pipeline_intent.dart';
|
||||
import 'package:pipelines_app/features/pipelines/run_pipeline_seed.dart';
|
||||
import 'package:pipelines_app/features/pipelines/ui/run_pipeline_version_field.dart';
|
||||
import 'package:pipelines_app/features/pipelines/ui/run_pipeline_wording.dart';
|
||||
import 'package:pipelines_app/features/runs/actions/retry_eligibility.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_again_flow.dart';
|
||||
|
||||
import '../../pipelines/fixtures.dart';
|
||||
import '../../pipelines/ui/run_pipeline_launch_test.dart'
|
||||
show acceptedRun, launchGateway;
|
||||
|
||||
/// Run again: a finished run that did not fail opens the New run form for its
|
||||
/// pipeline, pre-filled with its prompt, workspace and report requirement,
|
||||
/// at the latest version with the original offered.
|
||||
void main() {
|
||||
JsonMap finished({String status = 'succeeded', bool withInput = true}) => {
|
||||
'id': 9,
|
||||
'status': status,
|
||||
'executing': false,
|
||||
'pipeline_id': 1,
|
||||
'version': 1,
|
||||
'workspace': '/work/alpha',
|
||||
'output_format': 'markdown',
|
||||
if (withInput) 'input': {'prompt': 'Ship the release notes.'},
|
||||
};
|
||||
|
||||
test('only finished runs that did not fail can run again', () {
|
||||
expect(canRunAgain(finished()), isTrue);
|
||||
expect(canRunAgain(finished(status: 'canceled')), isTrue);
|
||||
expect(canRunAgain(finished(status: 'interrupted')), isTrue);
|
||||
expect(canRunAgain(finished(status: 'failed')), isFalse);
|
||||
expect(canRunAgain(finished()..['executing'] = true), isFalse);
|
||||
expect(canRunAgain(finished()..remove('pipeline_id')), isFalse);
|
||||
});
|
||||
|
||||
test('the seed carries the run inputs and its version', () {
|
||||
final seed = runAgainSeed(finished());
|
||||
expect(seed.prompt, 'Ship the release notes.');
|
||||
expect(seed.workspace, '/work/alpha');
|
||||
expect(seed.originalVersion, 1);
|
||||
expect(seed.outputFormat, RunOutputFormat.markdown);
|
||||
expect(runPipelineVersionChoices(2, 1), [2, 1]);
|
||||
expect(runPipelineVersionChoices(2, 2), [2]);
|
||||
});
|
||||
|
||||
testWidgets('the form opens pre-filled at the latest version and can '
|
||||
'start the original one', (tester) async {
|
||||
tester.view.physicalSize = const Size(1100, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final launched = <JsonMap>[];
|
||||
final fixture = PipelineFixture();
|
||||
final gateway = launchGateway(
|
||||
fixture,
|
||||
onLaunch: (fields) {
|
||||
launched.add(fields);
|
||||
return acceptedRun(30);
|
||||
},
|
||||
onLookup: (_) => {'type': 'run', 'run_detail': finished()},
|
||||
);
|
||||
final controller = PipelinesController(
|
||||
PipelinesRepository(gateway),
|
||||
pendingRunStore: MemoryPendingRunStore(),
|
||||
);
|
||||
addTearDown(controller.dispose);
|
||||
final started = <int>[];
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Builder(
|
||||
builder: (context) => TextButton(
|
||||
onPressed: () => startRunAgainFlow(
|
||||
context: context,
|
||||
// A list row carries no input: the run is read first.
|
||||
run: finished(withInput: false),
|
||||
controller: controller,
|
||||
gateway: gateway,
|
||||
onRunStarted: started.add,
|
||||
),
|
||||
child: const Text('again'),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.tap(find.text('again'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final prompt = tester.widget<TextField>(find.byKey(runPipelinePromptKey));
|
||||
expect(prompt.controller!.text, 'Ship the release notes.');
|
||||
final workspace = tester.widget<TextField>(
|
||||
find.byKey(runPipelineWorkspaceKey),
|
||||
);
|
||||
expect(workspace.controller!.text, '/work/alpha');
|
||||
expect(find.text('Latest (v2)'), findsOneWidget);
|
||||
|
||||
await tester.tap(find.byKey(runPipelineVersionKey));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Original run (v1)').last);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(runPipelineConfirmKey));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(launched, hasLength(1));
|
||||
expect(launched.single['pipeline_id'], 1);
|
||||
expect(launched.single['version'], 1);
|
||||
expect(launched.single['workspace'], '/work/alpha');
|
||||
expect(launched.single['input'], {'prompt': 'Ship the release notes.'});
|
||||
expect(launched.single['output_format'], 'markdown');
|
||||
expect(started, [30]);
|
||||
});
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
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/floating_destination_bar.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart';
|
||||
|
||||
import 'run_detail_graph_support.dart';
|
||||
@@ -81,7 +82,13 @@ void main() {
|
||||
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')));
|
||||
// The labelled row (buttons over their captions) ends above the margin.
|
||||
final tabs = tester.getRect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('run-visit-tabs')),
|
||||
matching: find.byKey(FloatingDestinationBar.rowKey),
|
||||
),
|
||||
);
|
||||
expect(tabs.bottom, 844 - 16);
|
||||
expect(tester.getRect(summary).bottom, 844);
|
||||
|
||||
|
||||
@@ -97,11 +97,8 @@ void main() {
|
||||
),
|
||||
);
|
||||
final body = find.byKey(const Key('run-detail-tab-body-summary'));
|
||||
// Sized to its tabs at the right, floating above the bottom.
|
||||
expect(
|
||||
pill.width,
|
||||
FloatingDestinationBar.rowWidth(tabs: renderedRunDetailTabs.length),
|
||||
);
|
||||
// Sized to its labelled tabs at the right, floating above the bottom.
|
||||
expect(pill.width, lessThan(390 * 0.85));
|
||||
expect(pill.right, 390 - 16);
|
||||
expect(pill.bottom, 844 - 16);
|
||||
// The tab's content reaches the bottom edge, behind the bar.
|
||||
|
||||
@@ -294,8 +294,8 @@ void main() {
|
||||
);
|
||||
expect(pill.right, size.width - 16);
|
||||
expect(pill.bottom, size.height - 16);
|
||||
// Sized to its tabs at the right on every width.
|
||||
expect(pill.width, lessThan(size.width * 0.7));
|
||||
// Sized to its labelled tabs at the right on every width.
|
||||
expect(pill.width, lessThan(size.width * 0.8));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart' show SemanticsNode;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/runs/domain/run_outcome_line.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_again_flow.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_failure_banner.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/runs_list.dart';
|
||||
|
||||
JsonMap _run(String status, [JsonMap extra = const {}]) => {
|
||||
'id': 7,
|
||||
'title': 'Nightly release',
|
||||
'name': 'release',
|
||||
'status': status,
|
||||
'executing': false,
|
||||
'pipeline_id': 3,
|
||||
'created_at': '2026-10-21T12:00:00Z',
|
||||
'finished_at': '2026-10-21T12:02:05Z',
|
||||
...extra,
|
||||
};
|
||||
|
||||
class _FakeGateway implements ApiGateway {
|
||||
@override
|
||||
Future<JsonMap> call(String type, [JsonMap fields = const {}]) async => {};
|
||||
|
||||
@override
|
||||
Stream<JsonMap> get frames => const Stream.empty();
|
||||
}
|
||||
|
||||
/// A run row says why a run failed (its failure reason, else its
|
||||
/// diagnostic's first line) in one line with the full text in a tooltip, and
|
||||
/// a succeeded run's short result; its status is read once.
|
||||
void main() {
|
||||
test('the outcome line prefers the failure reason, then the diagnostic', () {
|
||||
final reason = runOutcomeLine(
|
||||
_run('failed', {
|
||||
'failure_reason': 'Stage review timed out',
|
||||
'diagnostic': 'trace\nmore',
|
||||
}),
|
||||
);
|
||||
expect(reason?.line, 'Stage review timed out');
|
||||
expect(reason?.failed, isTrue);
|
||||
final diagnostic = runOutcomeLine(
|
||||
_run('failed', {'diagnostic': '\n exit status 2\nstack trace'}),
|
||||
);
|
||||
expect(diagnostic?.line, 'exit status 2');
|
||||
expect(diagnostic?.full, 'exit status 2\nstack trace');
|
||||
expect(runOutcomeLine(_run('failed')), isNull);
|
||||
expect(
|
||||
runOutcomeLine(
|
||||
_run('succeeded', {'result_preview': 'Released 1.2'}),
|
||||
)?.line,
|
||||
'Released 1.2',
|
||||
);
|
||||
// A long or multi-line preview is left to the detail.
|
||||
expect(
|
||||
runOutcomeLine(_run('succeeded', {'result_preview': 'x' * 200})),
|
||||
isNull,
|
||||
);
|
||||
expect(
|
||||
runOutcomeLine(_run('succeeded', {'result_preview': 'a\nb'})),
|
||||
isNull,
|
||||
);
|
||||
expect(runOutcomeLine(_run('running', {'failure_reason': 'x'})), isNull);
|
||||
});
|
||||
|
||||
Future<void> pumpRow(WidgetTester tester, JsonMap run) async {
|
||||
tester.view.physicalSize = const Size(800, 400);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: RunListRow(
|
||||
run: run,
|
||||
now: DateTime.utc(2026, 10, 22),
|
||||
gateway: _FakeGateway(),
|
||||
onRunChanged: (_) {},
|
||||
onRunAgain: (_) {},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
testWidgets('a failed row shows its reason with the full text in a '
|
||||
'tooltip', (tester) async {
|
||||
const reason = 'Stage review timed out after 30 minutes';
|
||||
await pumpRow(tester, _run('failed', {'failure_reason': reason}));
|
||||
expect(find.text(reason), findsOneWidget);
|
||||
final tooltip = tester.widget<Tooltip>(
|
||||
find.byKey(const ValueKey('run-row-outcome-7')),
|
||||
);
|
||||
expect(tooltip.message, reason);
|
||||
});
|
||||
|
||||
testWidgets('the row reads its status once', (tester) async {
|
||||
final semantics = tester.ensureSemantics();
|
||||
await pumpRow(tester, _run('failed', {'failure_reason': 'Boom'}));
|
||||
final labels = <String>[];
|
||||
void collect(SemanticsNode node) {
|
||||
final data = node.getSemanticsData();
|
||||
labels.add('${data.label} ${data.tooltip}');
|
||||
node.visitChildren((child) {
|
||||
collect(child);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
collect(tester.getSemantics(find.byType(RunListRow)));
|
||||
final all = labels.join(' ');
|
||||
expect(RegExp(r'\bfailed\b').allMatches(all), hasLength(1), reason: all);
|
||||
semantics.dispose();
|
||||
});
|
||||
|
||||
testWidgets('a succeeded run offers Run again; a failed one does not', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpRow(tester, _run('succeeded'));
|
||||
await tester.tap(find.byKey(const ValueKey('run-list-more-menu-7')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(runAgainActionKey), findsOneWidget);
|
||||
await tester.tapAt(Offset.zero);
|
||||
await tester.pumpAndSettle();
|
||||
await pumpRow(tester, _run('failed', {'failure_reason': 'Boom'}));
|
||||
await tester.tap(find.byKey(const ValueKey('run-list-more-menu-7')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(runAgainActionKey), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('the Summary leads with why a failed run failed', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: RunFailureBanner(
|
||||
run: _run('failed', {'diagnostic': 'exit status 2'}),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(find.text('Why it failed'), findsOneWidget);
|
||||
expect(find.text('exit status 2'), findsOneWidget);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(home: RunFailureBanner(run: _run('succeeded'))),
|
||||
);
|
||||
expect(find.text('Why it failed'), findsNothing);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/settings/settings_phone_order.dart';
|
||||
import 'package:pipelines_app/features/settings/settings_search_page.dart';
|
||||
import 'package:pipelines_app/features/settings/settings_section.dart';
|
||||
|
||||
SettingsSection _section(String id, String title) => SettingsSection(
|
||||
id: id,
|
||||
title: title,
|
||||
keywords: '',
|
||||
builder: (_) => SizedBox(height: 400, child: Text('$title body')),
|
||||
);
|
||||
|
||||
/// A phone's Settings lead with Connection and Notifications and offer a
|
||||
/// "Jump to topic" menu; a wide window keeps its order and index column.
|
||||
void main() {
|
||||
final sections = [
|
||||
_section('interface-size', 'Interface size'),
|
||||
_section('font', 'Font'),
|
||||
_section('notifications', 'Notifications'),
|
||||
_section('connection', 'Connection'),
|
||||
_section('help', 'Help and about'),
|
||||
];
|
||||
|
||||
test('Connection, then Notifications, lead on a phone', () {
|
||||
expect(settingsPhoneOrder(sections).map((section) => section.id), [
|
||||
'connection',
|
||||
'notifications',
|
||||
'interface-size',
|
||||
'font',
|
||||
'help',
|
||||
]);
|
||||
});
|
||||
|
||||
Future<void> pumpAt(WidgetTester tester, double width) async {
|
||||
tester.view.physicalSize = Size(width, 800);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(body: SettingsSearchPage(sections: sections)),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
testWidgets('a phone jumps to a topic from its menu', (tester) async {
|
||||
await pumpAt(tester, 390);
|
||||
final connection = tester.getTopLeft(find.text('Connection body')).dy;
|
||||
final size = tester.getTopLeft(find.text('Interface size body')).dy;
|
||||
expect(connection, lessThan(size));
|
||||
|
||||
await tester.tap(find.byKey(settingsTopicMenuKey));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Help and about').last);
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
tester.getTopLeft(find.text('Help and about body')).dy,
|
||||
lessThan(400),
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('a wide window keeps its order and has no topic menu', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpAt(tester, 1300);
|
||||
expect(find.byKey(settingsTopicMenuKey), findsNothing);
|
||||
final connection = tester.getTopLeft(find.text('Connection body')).dy;
|
||||
final size = tester.getTopLeft(find.text('Interface size body')).dy;
|
||||
expect(size, lessThan(connection));
|
||||
});
|
||||
}
|
||||
@@ -232,6 +232,10 @@ void main() {
|
||||
|
||||
await tester.enterText(workspace, ' /srv/pipelines ');
|
||||
await tester.pump();
|
||||
// A phone leads with Connection and Notifications, so Save may sit
|
||||
// below the fold.
|
||||
await tester.ensureVisible(find.byKey(SettingsKeys.saveWorkspace));
|
||||
await tester.pump();
|
||||
await tester.tap(find.byKey(SettingsKeys.saveWorkspace));
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
@@ -359,7 +363,9 @@ void main() {
|
||||
expect(row, findsOneWidget);
|
||||
expect(
|
||||
tester
|
||||
.widget<ListTile>(find.descendant(of: row, matching: find.byType(ListTile)))
|
||||
.widget<ListTile>(
|
||||
find.descendant(of: row, matching: find.byType(ListTile)),
|
||||
)
|
||||
.enabled,
|
||||
isTrue,
|
||||
);
|
||||
@@ -391,7 +397,9 @@ void main() {
|
||||
expect(row, findsOneWidget);
|
||||
expect(
|
||||
tester
|
||||
.widget<ListTile>(find.descendant(of: row, matching: find.byType(ListTile)))
|
||||
.widget<ListTile>(
|
||||
find.descendant(of: row, matching: find.byType(ListTile)),
|
||||
)
|
||||
.enabled,
|
||||
isFalse,
|
||||
);
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/walkthrough/first_run_walkthrough.dart';
|
||||
import 'package:pipelines_app/features/walkthrough/walkthrough_steps.dart';
|
||||
|
||||
const _openConnectionKey = ValueKey<String>('walkthrough.open-connection');
|
||||
|
||||
/// The walkthrough acts as well as directs: Open Connection on the connect
|
||||
/// page (skipped once connected) and a labelled Copy command.
|
||||
void main() {
|
||||
Future<void> launch(
|
||||
WidgetTester tester, {
|
||||
required bool connected,
|
||||
required VoidCallback onOpenConnection,
|
||||
}) async {
|
||||
tester.view.physicalSize = const Size(390, 844);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Builder(
|
||||
builder: (context) => TextButton(
|
||||
onPressed: () => showFirstRunWalkthrough(
|
||||
context,
|
||||
connected: connected,
|
||||
onOpenConnection: onOpenConnection,
|
||||
),
|
||||
child: const Text('Open'),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.tap(find.text('Open'));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
testWidgets('Open Connection closes the walkthrough and opens it', (
|
||||
tester,
|
||||
) async {
|
||||
var opened = 0;
|
||||
await launch(tester, connected: false, onOpenConnection: () => opened++);
|
||||
expect(find.textContaining('enter the Server URL'), findsOneWidget);
|
||||
await tester.tap(find.byKey(_openConnectionKey));
|
||||
await tester.pumpAndSettle();
|
||||
expect(opened, 1);
|
||||
expect(find.text('Step 1 of 4'), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('a connected app skips the connect directions', (tester) async {
|
||||
await launch(tester, connected: true, onOpenConnection: () {});
|
||||
expect(find.text('Step 1 of 4'), findsOneWidget);
|
||||
expect(find.textContaining('this app is connected'), findsOneWidget);
|
||||
expect(find.textContaining('enter the Server URL'), findsNothing);
|
||||
expect(find.byKey(_openConnectionKey), findsNothing);
|
||||
expect(walkthroughStepsFor(connected: true), hasLength(4));
|
||||
});
|
||||
|
||||
testWidgets('the harness page labels its copy action', (tester) async {
|
||||
await launch(tester, connected: true, onOpenConnection: () {});
|
||||
await tester.tap(find.byKey(const ValueKey<String>('walkthrough.next')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const ValueKey<String>('walkthrough.copy')),
|
||||
matching: find.text('Copy command'),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -62,8 +62,7 @@ class _HeldStore implements WalkthroughStore {
|
||||
Future<void> markSeen() => inner.markSeen();
|
||||
|
||||
@override
|
||||
Future<bool> wasOffered(String serverScope) =>
|
||||
inner.wasOffered(serverScope);
|
||||
Future<bool> wasOffered(String serverScope) => inner.wasOffered(serverScope);
|
||||
|
||||
@override
|
||||
Future<void> markOffered(String serverScope) =>
|
||||
@@ -98,7 +97,10 @@ Widget _host({
|
||||
|
||||
Future<void> _finishWalkthrough(WidgetTester tester) async {
|
||||
for (var page = 0; page < 3; page++) {
|
||||
await tester.tap(find.byKey(const ValueKey<String>('walkthrough.next')));
|
||||
final next = find.byKey(const ValueKey<String>('walkthrough.next'));
|
||||
await tester.ensureVisible(next);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(next);
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
await tester.tap(find.text('Done'));
|
||||
|
||||
@@ -77,6 +77,20 @@ void main() {
|
||||
expect(settings.bottom, closeTo(railRect.bottom, 1));
|
||||
});
|
||||
|
||||
testWidgets('a rail tab is named once for assistive technology', (
|
||||
tester,
|
||||
) async {
|
||||
final semantics = tester.ensureSemantics();
|
||||
await pumpShell(tester, width: 1000);
|
||||
final node = tester.getSemantics(
|
||||
find.byKey(const ValueKey('shell.destination.pipelines')),
|
||||
);
|
||||
// The label and its tab position; the tooltip does not repeat the name.
|
||||
expect(node.label, startsWith('Pipelines'));
|
||||
expect(node.tooltip, isEmpty);
|
||||
semantics.dispose();
|
||||
});
|
||||
|
||||
testWidgets('the rail marks the selected tab and one tap selects another', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
@@ -3,9 +3,9 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
||||
import 'package:pipelines_app/shell/destination.dart';
|
||||
|
||||
/// Settings' Back: a destination reached from a shell control has none; a page
|
||||
/// pushed by a route (a first load or a route change, such as a deep link or
|
||||
/// the Pipelines gear) has one that returns to Pipelines.
|
||||
/// Settings is a top-level destination: it draws no Back arrow however it was
|
||||
/// reached (a shell control, a route change, a deep link or the Pipelines
|
||||
/// gear); the system Back still leaves it for the previous destination.
|
||||
void main() {
|
||||
AdaptiveShell shellAt(AppDestination destination) => AdaptiveShell(
|
||||
destination: destination,
|
||||
@@ -48,8 +48,8 @@ void main() {
|
||||
expect(find.byKey(const ValueKey('shell.back')), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('Settings pushed by a route change has Back, which returns to '
|
||||
'Pipelines', (tester) async {
|
||||
testWidgets('Settings reached by a route change has no Back arrow; the '
|
||||
'system Back returns to Pipelines', (tester) async {
|
||||
await pumpAt(tester, AppDestination.pipelines);
|
||||
// The route moves to Settings (as a gear or a deep link does).
|
||||
await tester.pumpWidget(
|
||||
@@ -57,34 +57,18 @@ void main() {
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('settings body'), findsOneWidget);
|
||||
expect(find.byKey(const ValueKey('shell.back')), findsOneWidget);
|
||||
expect(find.byKey(const ValueKey('shell.back')), findsNothing);
|
||||
|
||||
await tester.tap(find.byKey(const ValueKey('shell.back')));
|
||||
await tester.binding.handlePopRoute();
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('pipelines body'), findsOneWidget);
|
||||
expect(find.byKey(const ValueKey('shell.back')), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('a first load on Settings (a deep link) has Back', (
|
||||
testWidgets('a first load on Settings (a deep link) has no Back arrow', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpAt(tester, AppDestination.settings);
|
||||
expect(find.text('settings body'), findsOneWidget);
|
||||
expect(find.byKey(const ValueKey('shell.back')), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a nav selection after a pushed Settings clears its Back', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpAt(tester, AppDestination.settings);
|
||||
expect(find.byKey(const ValueKey('shell.back')), findsOneWidget);
|
||||
await tester.tap(find.byKey(const ValueKey('shell.destination.chat')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('chat body'), findsOneWidget);
|
||||
|
||||
// Settings opened again from its rail item is a destination, not a page.
|
||||
await tester.tap(find.byKey(const ValueKey('shell.destination.settings')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const ValueKey('shell.back')), findsNothing);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/navigation/labelled_icon_button.dart';
|
||||
import 'package:pipelines_app/features/artifacts/domain/artifact_groups.dart';
|
||||
import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_fetch.dart';
|
||||
import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_page.dart';
|
||||
@@ -46,7 +47,9 @@ Future<void> _setUp(WidgetTester tester, double scale) async {
|
||||
List<Rect> _controls(WidgetTester tester, Finder pill) {
|
||||
final found = find.descendant(
|
||||
of: pill,
|
||||
matching: find.byWidgetPredicate((widget) => widget is IconButton),
|
||||
matching: find.byWidgetPredicate(
|
||||
(widget) => widget is IconButton || widget is LabelledIconButton,
|
||||
),
|
||||
);
|
||||
final rects = [
|
||||
for (var i = 0; i < found.evaluate().length; i++)
|
||||
|
||||
@@ -9,7 +9,8 @@ import 'package:pipelines_app/features/runs/ui/run_detail_visit_sections.dart';
|
||||
import 'package:pipelines_app/shell/destination.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
|
||||
|
||||
/// Every bottom tab bar shows icons only, yet each tab keeps its name for
|
||||
/// The pipeline detail's bottom tabs show icons only and a run's show their
|
||||
/// names under them; either way each tab keeps its name for
|
||||
/// assistive technology (and a Material tooltip), its selected state and its
|
||||
/// test key; the icons within a bar, and against the shell's tabs a detail's
|
||||
/// bar floats above, are distinct.
|
||||
@@ -50,6 +51,7 @@ void main() {
|
||||
),
|
||||
};
|
||||
|
||||
const labelled = {'run detail', 'stage page'};
|
||||
for (final MapEntry(key: label, value: (bar, tabs)) in bars.entries) {
|
||||
testWidgets('$label tabs are icons named for assistive '
|
||||
'technology', (tester) async {
|
||||
@@ -61,10 +63,11 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final floating = find.byType(FloatingDestinationBar);
|
||||
// No label is drawn at all.
|
||||
// A run's tabs name themselves on screen (a phone has no tooltip);
|
||||
// the pipeline detail's stay icons.
|
||||
expect(
|
||||
find.descendant(of: floating, matching: find.byType(Text)),
|
||||
findsNothing,
|
||||
labelled.contains(label) ? findsNWidgets(tabs.length) : findsNothing,
|
||||
);
|
||||
for (final (index, (key, tabLabel)) in tabs.indexed) {
|
||||
final finder = find.byKey(ValueKey(key));
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/navigation/labelled_icon_button.dart';
|
||||
|
||||
/// Touch shows an action's caption under its icon (no hover tooltip there);
|
||||
/// desktop keeps the icon with its tooltip. Both are named once for
|
||||
/// assistive technology.
|
||||
void main() {
|
||||
Future<void> pump(WidgetTester tester) => tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Center(
|
||||
child: LabelledIconButton(
|
||||
icon: Icons.sort,
|
||||
label: 'Sort runs: Newest first',
|
||||
caption: 'Sort',
|
||||
onPressed: () {},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'touch draws the caption and names the full action',
|
||||
(tester) async {
|
||||
final semantics = tester.ensureSemantics();
|
||||
await pump(tester);
|
||||
expect(find.text('Sort'), findsOneWidget);
|
||||
expect(find.byType(Tooltip), findsNothing);
|
||||
expect(find.bySemanticsLabel('Sort runs: Newest first'), findsOneWidget);
|
||||
expect(tester.getSize(find.byType(LabelledIconButton)).height, 48);
|
||||
semantics.dispose();
|
||||
},
|
||||
variant: TargetPlatformVariant.only(TargetPlatform.android),
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'desktop keeps the icon with its tooltip',
|
||||
(tester) async {
|
||||
await pump(tester);
|
||||
expect(find.text('Sort'), findsNothing);
|
||||
expect(find.byTooltip('Sort runs: Newest first'), findsOneWidget);
|
||||
expect(find.byType(IconButton), findsOneWidget);
|
||||
},
|
||||
variant: TargetPlatformVariant.only(TargetPlatform.linux),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/error_advice.dart';
|
||||
import 'package:pipelines_app/core/transport/connection_state.dart';
|
||||
import 'package:pipelines_app/ui/status/error_notice.dart';
|
||||
import 'package:pipelines_app/ui/text/plural.dart';
|
||||
|
||||
/// Common failures read as what to do, with the raw detail kept behind
|
||||
/// Details; any other failure reads exactly as reported.
|
||||
void main() {
|
||||
test('common failures map to their kind', () {
|
||||
expect(
|
||||
errorAdviceKind(const NotConnectedError()),
|
||||
ErrorAdviceKind.notConnected,
|
||||
);
|
||||
expect(
|
||||
errorAdviceKind(StateError('Connection closed')),
|
||||
ErrorAdviceKind.notConnected,
|
||||
);
|
||||
expect(
|
||||
errorAdviceKind(const ProtocolError('unknown command: list_schedules')),
|
||||
ErrorAdviceKind.serverTooOld,
|
||||
);
|
||||
expect(
|
||||
errorAdviceKind(const ProtocolError('x', code: 'elevation_required')),
|
||||
ErrorAdviceKind.permission,
|
||||
);
|
||||
expect(
|
||||
errorAdviceKind('permission denied: /srv'),
|
||||
ErrorAdviceKind.permission,
|
||||
);
|
||||
expect(
|
||||
errorAdviceKind(TimeoutException('request timed out after 30000ms')),
|
||||
ErrorAdviceKind.timeout,
|
||||
);
|
||||
expect(errorAdviceKind('pipeline 4 has no stage review'), isNull);
|
||||
final advice = errorAdvice(StateError('Connection closed'));
|
||||
expect(advice?.detail, 'Connection closed');
|
||||
expect(advice?.sentence, contains('Settings'));
|
||||
});
|
||||
|
||||
testWidgets('a common failure says what to do and keeps its detail', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: ErrorNotice(error: 'unknown command: list_schedules'),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(
|
||||
find.text(errorAdviceSentence(ErrorAdviceKind.serverTooOld)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.text('unknown command: list_schedules'), findsNothing);
|
||||
await tester.tap(find.byKey(errorNoticeDetailsKey));
|
||||
await tester.pump();
|
||||
expect(find.text('unknown command: list_schedules'), findsOneWidget);
|
||||
expect(find.byKey(errorNoticeCopyKey), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('any other failure reads as reported', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(body: ErrorNotice(error: 'Bad state: pipeline gone')),
|
||||
),
|
||||
);
|
||||
expect(find.text('Bad state: pipeline gone'), findsOneWidget);
|
||||
expect(find.byKey(errorNoticeDetailsKey), findsNothing);
|
||||
});
|
||||
|
||||
test('counts are pluralised', () {
|
||||
expect(countLabel(1, 'stage'), '1 stage');
|
||||
expect(countLabel(3, 'stage'), '3 stages');
|
||||
expect(countLabel(0, 'file'), '0 files');
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user