Merge branch 'main' into run/artifacts-split
This commit is contained in:
@@ -181,7 +181,7 @@ void main() {
|
||||
await pumpDeepLink(tester, RunDetailTestPlatform.material, stage: 'plan');
|
||||
|
||||
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
|
||||
expectVisitHeading(tester, 'plan', 5);
|
||||
expectVisitHeading(tester, 'plan', 2);
|
||||
});
|
||||
|
||||
testWidgets('a Graph click opens the same latest visit as the stage route', (
|
||||
@@ -195,7 +195,7 @@ void main() {
|
||||
// The web client's graph click takes the last visit in sequence order, not
|
||||
// the last row in reply order, so both entry points agree.
|
||||
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
|
||||
expectVisitHeading(tester, 'plan', 5);
|
||||
expectVisitHeading(tester, 'plan', 2);
|
||||
});
|
||||
|
||||
testWidgets('an out-of-range visit is clamped to the stage last visit', (
|
||||
@@ -209,7 +209,7 @@ void main() {
|
||||
);
|
||||
|
||||
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
|
||||
expectVisitHeading(tester, 'plan', 5);
|
||||
expectVisitHeading(tester, 'plan', 2);
|
||||
});
|
||||
|
||||
testWidgets('a declared but unvisited stage selects its graph node', (
|
||||
@@ -259,7 +259,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
|
||||
expectVisitHeading(tester, 'plan', 5);
|
||||
expectVisitHeading(tester, 'plan', 2);
|
||||
});
|
||||
|
||||
testWidgets('a route change applies its visit and a plain route closes it', (
|
||||
@@ -301,7 +301,7 @@ void main() {
|
||||
|
||||
rebuild(() => visit = 1);
|
||||
await tester.pumpAndSettle();
|
||||
expectVisitHeading(tester, 'plan', 5);
|
||||
expectVisitHeading(tester, 'plan', 2);
|
||||
|
||||
rebuild(() => stage = null);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -14,8 +14,8 @@ Finder runDetailText(String text) => find.descendant(
|
||||
);
|
||||
|
||||
/// The stage page's bar names the stage over its visit (and run): the title
|
||||
/// is keyed `run-visit-title` and the subtitle starts `Visit <sequence>`.
|
||||
void expectVisitHeading(WidgetTester tester, String stage, num sequence) {
|
||||
/// is keyed `run-visit-title` and the subtitle starts `Visit <stage visit>`.
|
||||
void expectVisitHeading(WidgetTester tester, String stage, num visit) {
|
||||
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
|
||||
final heading = find.byKey(const Key('run-visit-title'));
|
||||
expect(
|
||||
@@ -25,7 +25,7 @@ void expectVisitHeading(WidgetTester tester, String stage, num sequence) {
|
||||
expect(
|
||||
find.descendant(
|
||||
of: heading,
|
||||
matching: find.textContaining(RegExp('^Visit $sequence( ·|\$)')),
|
||||
matching: find.textContaining(RegExp('^Visit $visit( ·|\$)')),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/runs/data/runs_repository.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_tab.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_visit_sections.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/runs_controller.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart';
|
||||
import 'package:pipelines_app/ui/layout/section_heading.dart';
|
||||
|
||||
import 'run_detail_graph_support.dart';
|
||||
import 'run_detail_visit_support.dart';
|
||||
|
||||
/// The run and stage detail bodies are flat on the page on both hosts: no
|
||||
/// Cupertino inset group (so none nested in another), pinned headings on the
|
||||
/// page colour, and beside a list one row of tabs and header.
|
||||
void main() {
|
||||
for (final platform in RunDetailTestPlatform.values) {
|
||||
testWidgets('${platform.name} Summary and Timeline draw no grouped '
|
||||
'card', (tester) async {
|
||||
await pumpRunDetail(tester, platform);
|
||||
expect(find.byType(CupertinoListSection), findsNothing);
|
||||
await openRunDetailTab(tester, RunDetailTab.timeline);
|
||||
expect(find.byType(CupertinoListSection), findsNothing);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} the stage Session nests no group in a '
|
||||
'group', (tester) async {
|
||||
await openVisit(tester, platform);
|
||||
await openVisitTab(tester, RunVisitSection.session);
|
||||
expect(find.text('Turn documents'), findsOneWidget);
|
||||
expect(find.byType(CupertinoListSection), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} beside a list the tabs and the header '
|
||||
'share one row', (tester) async {
|
||||
tester.view.physicalSize = const Size(720, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final gateway = RunDetailFakeGateway(graphRunFixture());
|
||||
final controller = RunsController(RunsRepository(gateway));
|
||||
addTearDown(controller.dispose);
|
||||
await controller.select(51);
|
||||
final view = PageTabsEdge(
|
||||
edge: FloatingBarEdge.top,
|
||||
child: RunDetailView(
|
||||
controller: controller,
|
||||
gateway: gateway,
|
||||
onBack: () {},
|
||||
),
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
platform == RunDetailTestPlatform.material
|
||||
? MaterialApp(home: Scaffold(body: view))
|
||||
: CupertinoApp(home: CupertinoPageScaffold(child: view)),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final tabs = tester.getRect(find.byKey(const Key('run-detail-tabs')));
|
||||
final header = tester.getRect(find.byKey(const Key('run-detail-header')));
|
||||
// Side by side, not stacked: the header starts after the tabs and
|
||||
// overlaps them vertically.
|
||||
expect(header.left, greaterThanOrEqualTo(tabs.right - 12));
|
||||
expect(header.top, lessThan(tabs.bottom));
|
||||
expect(header.bottom, greaterThan(tabs.top));
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
testWidgets('Cupertino pinned headings take the page colour', (tester) async {
|
||||
for (final brightness in Brightness.values) {
|
||||
late SectionHeadingStyle style;
|
||||
late Color page;
|
||||
await tester.pumpWidget(
|
||||
CupertinoApp(
|
||||
theme: CupertinoThemeData(brightness: brightness),
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
style = SectionHeadingStyle.of(context);
|
||||
page = CupertinoTheme.of(context).scaffoldBackgroundColor;
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(style.background, page, reason: '$brightness');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
@@ -132,10 +133,12 @@ void main() {
|
||||
size: const Size(900, 1600),
|
||||
);
|
||||
|
||||
for (final label in recordedLabels) {
|
||||
// The bar's subtitle names the pipeline, so no Pipeline fact repeats it.
|
||||
for (final label in recordedLabels.where((l) => l != 'Pipeline')) {
|
||||
expect(find.text(label), findsOneWidget, reason: label);
|
||||
}
|
||||
expect(find.text('id 3 · v2'), findsOneWidget);
|
||||
expect(find.text('Pipeline'), findsNothing);
|
||||
expect(find.text('id 3 · v2'), findsNothing);
|
||||
expect(find.text('review'), findsOneWidget);
|
||||
expect(find.text('/srv/workspaces/run-51'), findsOneWidget);
|
||||
expect(find.text('abc123def456'), findsOneWidget);
|
||||
@@ -199,6 +202,29 @@ void main() {
|
||||
expect(hash.width, greaterThan(300));
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} a single fact starts at the leading edge, '
|
||||
'with no grouped card', (tester) async {
|
||||
await pumpRunDetail(
|
||||
tester,
|
||||
platform,
|
||||
run: absentRunFixture()..['current_stage'] = 'review',
|
||||
size: const Size(900, 1600),
|
||||
);
|
||||
final grid = tester.getRect(
|
||||
find.byKey(const Key('run-detail-summary-facts')),
|
||||
);
|
||||
final stage = tester.getRect(
|
||||
find.byKey(const ValueKey('run-detail-summary-stage')),
|
||||
);
|
||||
// The grid spans the Summary, and its one fact is at the start of the
|
||||
// line rather than a half-width block centred on the page.
|
||||
// Full Summary width, up to the shared reading cap (840) on wide panes.
|
||||
expect(grid.width, moreOrLessEquals(840));
|
||||
expect(stage.left, moreOrLessEquals(16));
|
||||
expect(stage.center.dx, lessThan(450));
|
||||
expect(find.byType(CupertinoListSection), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} summary sections state their exact empty '
|
||||
'wording', (tester) async {
|
||||
await pumpRunDetail(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/layout/reading_width.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_graph_preview.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_more_menu.dart';
|
||||
import 'package:pipelines_app/features/graph/widgets/run_graph_view.dart';
|
||||
@@ -113,18 +114,33 @@ void main() {
|
||||
expect(widePill.right, 1000 - 16);
|
||||
expect(widePill.bottom, 844 - 16);
|
||||
expect(widePill.width, lessThan(1000 * 0.6));
|
||||
// Beside the bar the content takes taps: the body spans the width.
|
||||
expect(tester.getRect(body).width, 1000);
|
||||
// Beside the bar the content takes taps: the body spans the reading
|
||||
// width from the leading edge (Summary is capped on a wide pane).
|
||||
expect(tester.getRect(body).left, 0);
|
||||
expect(tester.getRect(body).width, kReadingMaxWidth);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} missing graph states the exact wording', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpRunDetail(tester, platform, run: graphRunFixture(graph: false));
|
||||
await openRunDetailTab(tester, RunDetailTab.graph);
|
||||
await openRunDetailTab(tester, RunDetailTab.summary);
|
||||
|
||||
// One muted line on the Summary: no framed, tappable empty preview.
|
||||
expect(find.text(runGraphMissing), findsOneWidget);
|
||||
expect(find.byKey(runGraphPreviewMissingKey), findsOneWidget);
|
||||
expect(find.byKey(runGraphPreviewKey), findsNothing);
|
||||
expect(find.byType(RunGraphView), findsNothing);
|
||||
expect(find.byType(InteractiveViewer), findsNothing);
|
||||
final line = tester.getSize(find.byKey(runGraphPreviewMissingKey));
|
||||
expect(line.height, lessThan(60));
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(runGraphPreviewMissingKey),
|
||||
matching: find.byType(DecoratedBox),
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} Graph stays bounded at 320 with 2x text', (
|
||||
|
||||
@@ -100,7 +100,7 @@ void main() {
|
||||
|
||||
expect(find.byKey(const Key('run-visit-pane')), findsNothing);
|
||||
expect(find.byType(RunTimelineList), findsOneWidget);
|
||||
expect(find.text('plan · visit 1'), findsOneWidget);
|
||||
expect(find.text('plan · Visit 1'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} visit pane at 320 with 2x dark text', (
|
||||
|
||||
@@ -201,17 +201,17 @@ void main() {
|
||||
matching: find.byType(Scrollable),
|
||||
);
|
||||
await tester.scrollUntilVisible(
|
||||
find.textContaining('build · visit 3'),
|
||||
find.textContaining('build · Visit 1').last,
|
||||
200,
|
||||
scrollable: timelineScroll,
|
||||
);
|
||||
expect(find.textContaining('build · visit 3'), findsOneWidget);
|
||||
expect(find.textContaining('build · Visit 1').last, findsOneWidget);
|
||||
await tester.scrollUntilVisible(
|
||||
find.textContaining('test · visit 4'),
|
||||
find.textContaining('test · Visit 1').last,
|
||||
200,
|
||||
scrollable: timelineScroll,
|
||||
);
|
||||
expect(find.textContaining('test · visit 4'), findsOneWidget);
|
||||
expect(find.textContaining('test · Visit 1').last, findsOneWidget);
|
||||
|
||||
final before = tester
|
||||
.state<ScrollableState>(timelineScroll)
|
||||
|
||||
@@ -58,7 +58,7 @@ void main() {
|
||||
);
|
||||
Rect at(String text) => tester.getRect(find.text(text));
|
||||
final title = at('Ship the release notes');
|
||||
final age = at('12h ago');
|
||||
final age = at('12h');
|
||||
final subtitle = at('release · 2m 5s · 3 steps');
|
||||
|
||||
expect(age.center.dy, moreOrLessEquals(title.center.dy));
|
||||
@@ -81,10 +81,13 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
expect(
|
||||
find.text('Pipeline unavailable · 2m 5s · 3 steps'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.text('Pipeline unavailable · 2m 5s · 3 steps'), findsOneWidget);
|
||||
});
|
||||
|
||||
test('the run action sheet is titled with the run', () {
|
||||
expect(runMoreMenuTitle(_finished), 'Ship the release notes');
|
||||
expect(runMoreMenuTitle({'id': 5, 'name': 'nightly'}), 'nightly');
|
||||
expect(runMoreMenuTitle({'id': 5}), 'Run 5');
|
||||
});
|
||||
|
||||
testWidgets('gives a list action menu a per-run key', (tester) async {
|
||||
|
||||
@@ -113,7 +113,7 @@ void main() {
|
||||
);
|
||||
|
||||
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
|
||||
expectVisitHeading(tester, 'build', 2);
|
||||
expectVisitHeading(tester, 'build', 1);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_content.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_timeline.dart';
|
||||
import 'package:pipelines_app/ui/layout/app_list_row.dart';
|
||||
import 'package:pipelines_app/ui/status/run_status_icon.dart';
|
||||
|
||||
final _steps = [
|
||||
@@ -52,8 +53,49 @@ void main() {
|
||||
|
||||
expect(find.text('success'), findsOneWidget);
|
||||
expect(find.text('error'), findsOneWidget);
|
||||
expect(find.text('→ build · 2m 5s'), findsOneWidget);
|
||||
// The target is the line; the duration is the row's time.
|
||||
expect(find.text('→ build'), findsOneWidget);
|
||||
expect(find.text('2m 5s'), findsOneWidget);
|
||||
expect(find.text('→ #failure'), findsOneWidget);
|
||||
// The shared flat row, with no grouped card on either host.
|
||||
expect(find.byType(AppListRow), findsNWidgets(3));
|
||||
expect(find.byType(CupertinoListSection), findsNothing);
|
||||
});
|
||||
}
|
||||
|
||||
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')));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,13 +65,13 @@ void main() {
|
||||
await _openVisitChanges(tester);
|
||||
|
||||
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
|
||||
// The body keeps the landed viewer's own identity for that visit.
|
||||
// The stage is already named in the page bar, so Changes does not repeat it.
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(ChangesViewer),
|
||||
matching: find.text('plan'),
|
||||
),
|
||||
findsOneWidget,
|
||||
findsNothing,
|
||||
);
|
||||
expect(find.text('Visit 1 · completed'), findsOneWidget);
|
||||
expect(find.text('lib/plan.dart'), findsOneWidget);
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/runs/screen.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
|
||||
import 'run_detail_finders.dart';
|
||||
import 'package:pipelines_app/shell/empty_detail_pane.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart';
|
||||
|
||||
class _Gateway implements ApiGateway {
|
||||
@@ -154,6 +155,11 @@ void main() {
|
||||
) async {
|
||||
await tester.pumpWidget(_materialScreen(gateway));
|
||||
await _mountList(tester, gateway);
|
||||
// Beside the list, nothing open yet: the shared empty-pane placeholder.
|
||||
expect(
|
||||
find.widgetWithText(EmptyDetailPane, 'Select a run to open it here.'),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Beta run'));
|
||||
await tester.pump();
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
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/runs/data/runs_repository.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/runs_controller.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/runs_filter_sheet.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/runs_filters.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/runs_list.dart';
|
||||
import 'package:pipelines_app/ui/layout/app_sheet_header.dart';
|
||||
|
||||
class _Gateway implements ApiGateway {
|
||||
final framesController = StreamController<JsonMap>.broadcast();
|
||||
JsonMap? reply;
|
||||
|
||||
@override
|
||||
Stream<JsonMap> get frames => framesController.stream;
|
||||
|
||||
@override
|
||||
Future<JsonMap> call(String type, [JsonMap fields = const {}]) async =>
|
||||
reply ?? {'runs': []};
|
||||
}
|
||||
|
||||
/// The Runs sheets share one header (title and Done), single-choice groups
|
||||
/// use check rows, statuses read in sentence case, and the usage page neither
|
||||
/// repeats its title nor draws a chart of zeros.
|
||||
void main() {
|
||||
late _Gateway gateway;
|
||||
late RunsController controller;
|
||||
|
||||
setUp(() {
|
||||
gateway = _Gateway();
|
||||
controller = RunsController(RunsRepository(gateway));
|
||||
});
|
||||
|
||||
tearDown(() async {
|
||||
controller.dispose();
|
||||
await gateway.framesController.close();
|
||||
});
|
||||
|
||||
Future<void> mount(
|
||||
WidgetTester tester, {
|
||||
required bool cupertino,
|
||||
String? createdAt,
|
||||
}) async {
|
||||
tester.view.physicalSize = const Size(800, 1400);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
final at = createdAt ?? DateTime.now().toIso8601String();
|
||||
gateway.reply = {
|
||||
'runs': [
|
||||
{
|
||||
'id': 1,
|
||||
'pipeline_id': 9,
|
||||
'name': 'Alpha',
|
||||
'status': 'running',
|
||||
'created_at': at,
|
||||
'scheduled': true,
|
||||
},
|
||||
],
|
||||
};
|
||||
await controller.load();
|
||||
final list = AnimatedBuilder(
|
||||
animation: controller,
|
||||
builder: (context, _) =>
|
||||
RunsList(controller: controller, onSelected: (_) {}),
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
cupertino
|
||||
? CupertinoApp(home: CupertinoPageScaffold(child: list))
|
||||
: MaterialApp(home: Scaffold(body: list)),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
for (final cupertino in [false, true]) {
|
||||
final host = cupertino ? 'Cupertino' : 'Material';
|
||||
|
||||
testWidgets('$host filter sheet has a header whose Done closes it', (
|
||||
tester,
|
||||
) async {
|
||||
await mount(tester, cupertino: cupertino);
|
||||
await tester.tap(find.byKey(const ValueKey('runs.filter')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(AppSheetHeader), findsOneWidget);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(AppSheetHeader),
|
||||
matching: find.text(runsFilterTitle),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.text('Queued'), findsOneWidget);
|
||||
expect(find.text('queued'), findsNothing);
|
||||
expect(find.byKey(runsFilterClearKey), findsNothing);
|
||||
|
||||
await tester.tap(find.text('Last 7 days'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(controller.timeRange, 'last_7_days');
|
||||
// An active filter offers Clear in the header.
|
||||
expect(find.byKey(runsFilterClearKey), findsOneWidget);
|
||||
|
||||
await tester.tap(find.byKey(runsFilterDoneKey));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const ValueKey('runs.filter.sheet')), findsNothing);
|
||||
// The applied chip reads in sentence case too.
|
||||
expect(find.textContaining('Last 7 days'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
testWidgets('Material single-choice groups are check rows, not checkboxes', (
|
||||
tester,
|
||||
) async {
|
||||
await mount(tester, cupertino: false);
|
||||
await tester.tap(find.byKey(const ValueKey('runs.filter')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Seven statuses may be combined: those keep their checkboxes.
|
||||
expect(find.byType(CheckboxListTile), findsNWidgets(7));
|
||||
final anyTime = find.widgetWithText(ListTile, 'Any time');
|
||||
expect(anyTime, findsOneWidget);
|
||||
expect(
|
||||
find.descendant(of: anyTime, matching: find.byIcon(Icons.check)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: anyTime, matching: find.byType(Checkbox)),
|
||||
findsNothing,
|
||||
);
|
||||
final today = find.widgetWithText(ListTile, 'Today');
|
||||
expect(
|
||||
find.descendant(of: today, matching: find.byIcon(Icons.check)),
|
||||
findsNothing,
|
||||
);
|
||||
expect(tester.widget<ListTile>(anyTime).selected, isTrue);
|
||||
});
|
||||
|
||||
testWidgets('Material sort sheet has the same header', (tester) async {
|
||||
await mount(tester, cupertino: false);
|
||||
await tester.tap(find.byKey(const ValueKey('runs.sort')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(runsSortTitle), findsOneWidget);
|
||||
await tester.tap(find.byKey(runsSortDoneKey));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(runsSortTitle), findsNothing);
|
||||
expect(controller.sort, 'newest_first');
|
||||
});
|
||||
|
||||
testWidgets('the usage page is honest when nothing was reported', (
|
||||
tester,
|
||||
) async {
|
||||
await mount(
|
||||
tester,
|
||||
cupertino: false,
|
||||
createdAt: DateTime(2020, 1, 1).toIso8601String(),
|
||||
);
|
||||
await tester.tap(find.byKey(const ValueKey('runs.stats')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// The bar says Usage; the body does not repeat it.
|
||||
expect(find.text('Usage'), findsOneWidget);
|
||||
expect(find.byKey(const ValueKey('runs.stats.usage.empty')), findsOne);
|
||||
expect(find.byKey(const ValueKey('runs.stats.days')), findsNothing);
|
||||
expect(find.byKey(const ValueKey('runs.stats.days.empty')), findsOne);
|
||||
expect(find.text('Running'), findsOneWidget);
|
||||
expect(find.text('0'), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('the 7-day chart shows bars over an axis when runs started', (
|
||||
tester,
|
||||
) async {
|
||||
await mount(tester, cupertino: true);
|
||||
await tester.tap(find.byKey(const ValueKey('runs.stats')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const ValueKey('runs.stats.days')), findsOneWidget);
|
||||
expect(find.byKey(const ValueKey('runs.stats.days.empty')), findsNothing);
|
||||
// Only the day with a run is labelled with its count.
|
||||
final days = find.byKey(const ValueKey('runs.stats.days'));
|
||||
expect(find.descendant(of: days, matching: find.text('1')), findsOne);
|
||||
expect(find.text('0'), findsNothing);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
@@ -70,18 +70,22 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
Future<void> reveal(WidgetTester tester, Finder target) =>
|
||||
tester.scrollUntilVisible(
|
||||
target,
|
||||
80,
|
||||
// The sheet's own list, not the search field's inner scrollable.
|
||||
scrollable: find
|
||||
.descendant(
|
||||
of: find.byKey(const ValueKey('runs.filter.sheet')),
|
||||
matching: find.byType(Scrollable),
|
||||
)
|
||||
.first,
|
||||
);
|
||||
Future<void> reveal(WidgetTester tester, Finder target) async {
|
||||
await tester.scrollUntilVisible(
|
||||
target,
|
||||
80,
|
||||
// The sheet's own list, not the search field's inner scrollable.
|
||||
scrollable: find
|
||||
.descendant(
|
||||
of: find.byKey(const ValueKey('runs.filter.sheet')),
|
||||
matching: find.byType(Scrollable),
|
||||
)
|
||||
.first,
|
||||
);
|
||||
// Built is not on screen: bring the row fully inside the sheet.
|
||||
await tester.ensureVisible(target);
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
Future<void> closeSheet(WidgetTester tester) async {
|
||||
await tester.tapAt(const Offset(4, 4));
|
||||
@@ -148,7 +152,7 @@ void main() {
|
||||
await tester.tap(find.byKey(const ValueKey('runs.filter')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(CupertinoSearchTextField), findsOneWidget);
|
||||
final failed = find.widgetWithText(CupertinoListTile, 'failed');
|
||||
final failed = find.widgetWithText(CupertinoListTile, 'Failed');
|
||||
await reveal(tester, failed);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(failed);
|
||||
@@ -156,7 +160,7 @@ void main() {
|
||||
expect(controller.statuses, {'failed'});
|
||||
await closeSheet(tester);
|
||||
|
||||
final failedChip = find.widgetWithText(CupertinoButton, 'failed');
|
||||
final failedChip = find.widgetWithText(CupertinoButton, 'Failed');
|
||||
expect(failedChip, findsOneWidget);
|
||||
expect(find.text('Alpha'), findsNothing);
|
||||
await tester.tap(failedChip);
|
||||
|
||||
Reference in New Issue
Block a user