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:
@@ -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