Merge branch 'worktree-agent-a75e04ded5a42e4fb' into integrate/detail-bodies
# Conflicts: # app/lib/features/runs/ui/run_detail_timeline.dart
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,14 @@ void main() {
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.byType(CupertinoListTile), findsWidgets);
|
||||
// Versions are the shared row in its Cupertino form, flat on the page.
|
||||
expect(
|
||||
tester
|
||||
.widget<AppListRow>(find.byKey(const Key('pipeline-version-1')))
|
||||
.cupertino,
|
||||
isTrue,
|
||||
);
|
||||
expect(find.byType(CupertinoListSection), findsNothing);
|
||||
|
||||
await tester.tap(find.byKey(const Key('pipeline-version-1')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
Reference in New Issue
Block a user