545291e04a
- 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>
137 lines
4.8 KiB
Dart
137 lines
4.8 KiB
Dart
import 'dart:ui' show SemanticsRole;
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/features/pipelines/widgets/pipeline_tabs.dart';
|
|
import 'package:pipelines_app/features/runs/ui/run_detail_tab.dart';
|
|
import 'package:pipelines_app/features/runs/ui/run_detail_tab_strip.dart';
|
|
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';
|
|
|
|
/// 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.
|
|
void main() {
|
|
Widget host(Widget bar) => MaterialApp(
|
|
home: Scaffold(
|
|
body: Align(alignment: Alignment.bottomCenter, child: bar),
|
|
),
|
|
);
|
|
|
|
final bars = <String, (Widget, List<(String, String)>)>{
|
|
'run detail': (
|
|
RunDetailTabStrip(selected: RunDetailTab.summary, onSelected: (_) {}),
|
|
[
|
|
for (final tab in renderedRunDetailTabs)
|
|
('run-detail-tab-${tab.name}', tab.label),
|
|
],
|
|
),
|
|
'stage page': (
|
|
RunVisitSectionStrip(
|
|
selected: RunVisitSection.summary,
|
|
onSelected: (_) {},
|
|
),
|
|
[
|
|
for (final section in shownVisitSections)
|
|
('run-visit-tab-${section.name}', section.label),
|
|
],
|
|
),
|
|
'pipeline detail': (
|
|
PipelineDetailTabs(
|
|
selected: PipelineDetailTab.summary,
|
|
onSelected: (_) {},
|
|
),
|
|
[
|
|
for (final tab in PipelineDetailTab.values)
|
|
('pipeline-detail-tab-${tab.name}', tab.label),
|
|
],
|
|
),
|
|
};
|
|
|
|
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 {
|
|
final semantics = tester.ensureSemantics();
|
|
tester.view.physicalSize = const Size(390, 844);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.reset);
|
|
await tester.pumpWidget(host(bar));
|
|
await tester.pumpAndSettle();
|
|
|
|
final floating = find.byType(FloatingDestinationBar);
|
|
// 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)),
|
|
labelled.contains(label) ? findsNWidgets(tabs.length) : findsNothing,
|
|
);
|
|
for (final (index, (key, tabLabel)) in tabs.indexed) {
|
|
final finder = find.byKey(ValueKey(key));
|
|
final node = tester.getSemantics(finder);
|
|
expect(node.label, startsWith(tabLabel), reason: key);
|
|
expect(
|
|
node,
|
|
isSemantics(
|
|
isSelected: index == 0,
|
|
hasSelectedState: true,
|
|
isButton: true,
|
|
hasTapAction: true,
|
|
),
|
|
reason: key,
|
|
);
|
|
expect(node.role, SemanticsRole.tab, reason: key);
|
|
// "Tab n of m", as the host navigation controls announce it.
|
|
final position = 'Tab ${index + 1} of ${tabs.length}';
|
|
expect(node.label, contains(position), reason: key);
|
|
// Material names the tab in its tooltip too.
|
|
expect(
|
|
find.descendant(
|
|
of: finder,
|
|
matching: find.byWidgetPredicate(
|
|
(widget) => widget is Tooltip && widget.message == tabLabel,
|
|
),
|
|
),
|
|
findsOneWidget,
|
|
reason: key,
|
|
);
|
|
// A hit target at least the platform minimum.
|
|
expect(tester.getSize(finder).shortestSide, greaterThanOrEqualTo(48));
|
|
}
|
|
// The tabs make up one tab bar.
|
|
final tabBar = tester.getSemantics(
|
|
find.byKey(FloatingDestinationBar.rowKey),
|
|
);
|
|
expect(tabBar.role, SemanticsRole.tabBar);
|
|
// Distinct glyphs within the bar.
|
|
final icons = tester
|
|
.widgetList<Icon>(
|
|
find.descendant(of: floating, matching: find.byType(Icon)),
|
|
)
|
|
.map((icon) => icon.icon)
|
|
.toSet();
|
|
expect(icons.length, greaterThanOrEqualTo(tabs.length));
|
|
semantics.dispose();
|
|
});
|
|
}
|
|
|
|
test('detail tab icons differ from the shell tabs they float above', () {
|
|
final shell = {
|
|
for (final destination in shellTabDestinations) ...[
|
|
destinationDetails(destination).icon,
|
|
],
|
|
};
|
|
final details = [
|
|
for (final tab in renderedRunDetailTabs) tab.icon,
|
|
for (final section in shownVisitSections) ...[section.icon],
|
|
for (final tab in PipelineDetailTab.values) tab.icon,
|
|
];
|
|
for (final icon in details) {
|
|
expect(shell.contains(icon), isFalse, reason: '$icon');
|
|
}
|
|
});
|
|
}
|