b4273a6492
Detail bodies are flat on the page on both hosts (no Cupertino inset groups, pinned headings on the page colour). Run and pipeline Summary share a FactsGrid that fills its width (no centred single-fact card). Missing run graph is one muted line. Beside a list the run tabs and header share one row; the duplicate Pipeline fact and the decision card-in-card are gone. Pipeline Summary: facts grid, Schedules heading with Add (no inline Refresh or paragraph), versions as AppListRow. Timeline rows are AppListRow.
76 lines
3.1 KiB
Dart
76 lines
3.1 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/features/pipelines/screen.dart';
|
|
import 'package:pipelines_app/features/pipelines/widgets/pipeline_summary_view.dart';
|
|
import 'package:pipelines_app/features/schedules/ui/pipeline/schedule_pipeline_wording.dart';
|
|
import 'package:pipelines_app/ui/layout/app_list_row.dart';
|
|
|
|
import 'fixtures.dart';
|
|
|
|
/// The pipeline Summary is flat on both hosts: facts in the shared grid,
|
|
/// Schedules with Add as its heading's only action (no body Refresh), and
|
|
/// versions as the shared list row.
|
|
void main() {
|
|
for (final cupertino in [false, true]) {
|
|
testWidgets('pipeline Summary is a facts grid with flat sections '
|
|
'(${cupertino ? 'cupertino' : 'material'})', (tester) async {
|
|
final gateway = FakeGateway((type, fields) {
|
|
return switch (type) {
|
|
'list_pipelines' => pipelineListReply([
|
|
pipelineSummary(id: 1, name: 'Alpha review', version: 3),
|
|
]),
|
|
'list_runs' => runListReply([]),
|
|
'get_pipeline' => pipelineDetailReply(
|
|
pipelineDetail(
|
|
id: 1,
|
|
name: 'Alpha review',
|
|
version: 3,
|
|
latestVersion: 3,
|
|
versions: [versionSummary(2), versionSummary(3)],
|
|
),
|
|
),
|
|
'list_schedules' => {'type': 'schedules', 'schedules': <dynamic>[]},
|
|
_ => errorReply('unexpected $type'),
|
|
};
|
|
});
|
|
tester.view.physicalSize = const Size(1100, 900);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.resetPhysicalSize);
|
|
addTearDown(tester.view.resetDevicePixelRatio);
|
|
final screen = PipelinesScreen(gateway: gateway);
|
|
await tester.pumpWidget(
|
|
cupertino
|
|
? CupertinoApp(home: CupertinoPageScaffold(child: screen))
|
|
: MaterialApp(home: screen),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
await tester.tap(find.byKey(const Key('pipeline-row-1')));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(find.byKey(pipelineSummaryFactsKey), findsOneWidget);
|
|
// Short facts share a line instead of one label/value row each.
|
|
final latest = tester.getRect(
|
|
find.byKey(const ValueKey('pipeline-summary-latest-version')),
|
|
);
|
|
final versionCreated = tester.getRect(
|
|
find.byKey(const ValueKey('pipeline-summary-version-created')),
|
|
);
|
|
expect(versionCreated.top, moreOrLessEquals(latest.top));
|
|
expect(versionCreated.left, greaterThan(latest.right));
|
|
|
|
expect(find.text('Refresh'), findsNothing);
|
|
expect(find.text(scheduleAddLabel), findsNothing);
|
|
expect(find.byKey(scheduleAddKey), findsOneWidget);
|
|
expect(find.byType(CupertinoListSection), findsNothing);
|
|
expect(find.byType(ListTile), findsNothing);
|
|
final row = tester.widget<AppListRow>(
|
|
find.byKey(const Key('pipeline-version-3')),
|
|
);
|
|
expect(row.selected, isTrue);
|
|
expect(row.cupertino, cupertino);
|
|
expect(tester.takeException(), isNull);
|
|
});
|
|
}
|
|
}
|