feat(app): gallery switches between grid and thumbnail list, and each artifact or document group is collapsible with a pinned title
This commit is contained in:
@@ -91,7 +91,7 @@ void main() {
|
||||
tester,
|
||||
) async {
|
||||
await _pump(tester, platform);
|
||||
expect(find.text('Turn documents'), findsNWidgets(2));
|
||||
expect(find.textContaining('Turn documents'), findsNWidgets(2));
|
||||
expect(find.text('input.md'), findsNWidgets(2));
|
||||
expect(find.text('output.md'), findsNWidgets(2));
|
||||
expect(find.text('session.html'), findsNWidgets(2));
|
||||
|
||||
@@ -427,7 +427,7 @@ void main() {
|
||||
], surface: const Size(360, 640));
|
||||
|
||||
expect(tester.takeException(), isNull);
|
||||
final list = find.byType(ListView);
|
||||
final list = find.byType(CustomScrollView);
|
||||
expect(tester.getSize(list).height, greaterThan(0));
|
||||
// The header belongs to that scroll view, so it scrolls away instead of
|
||||
// shrinking the list.
|
||||
@@ -466,7 +466,7 @@ void main() {
|
||||
);
|
||||
|
||||
expect(tester.takeException(), isNull);
|
||||
expect(tester.getSize(find.byType(ListView)).height, greaterThan(0));
|
||||
expect(tester.getSize(find.byType(CustomScrollView)).height, greaterThan(0));
|
||||
expect(
|
||||
find.text('12 files excluded from artifact capture.'),
|
||||
findsOneWidget,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:ui' show Tristate;
|
||||
|
||||
import 'package:flutter/semantics.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/artifacts/ui/artifact_tile.dart';
|
||||
@@ -77,10 +79,11 @@ void main() {
|
||||
|
||||
final heading = tester.getSemantics(find.text('review · visit 2'));
|
||||
expect(heading, isSemantics(label: 'review · visit 2', isHeader: true));
|
||||
// The heading's own action opens or closes its section; it is a separate
|
||||
// node, so activating it never opens the artifact below.
|
||||
expect(
|
||||
heading.getSemanticsData().hasAction(SemanticsAction.tap),
|
||||
isFalse,
|
||||
reason: 'a heading must never activate the artifact below it',
|
||||
heading.getSemanticsData().flagsCollection.isExpanded,
|
||||
Tristate.isTrue,
|
||||
);
|
||||
|
||||
final button = tester.getSemantics(find.byType(ArtifactTile));
|
||||
|
||||
@@ -253,7 +253,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
final list = find.byType(ListView);
|
||||
final list = find.byType(CustomScrollView);
|
||||
expect(list, findsOneWidget);
|
||||
expect(
|
||||
find.descendant(of: list, matching: find.text('Artifacts · 1 recorded')),
|
||||
@@ -277,4 +277,39 @@ void main() {
|
||||
expect(find.text('Artifacts · 0 recorded'), findsOneWidget);
|
||||
expect(find.text('No stage artifacts recorded.'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('the gallery switches to a list with thumbnails and sections '
|
||||
'collapse', (tester) async {
|
||||
ArtifactVisitList.lastMode = ArtifactGalleryMode.grid;
|
||||
addTearDown(() => ArtifactVisitList.lastMode = ArtifactGalleryMode.grid);
|
||||
final group = visitGroup(
|
||||
visit: 1,
|
||||
artifacts: [
|
||||
recordedArtifact('a.csv', url: '/artifacts/7/1/a.csv'),
|
||||
recordedArtifact('b.png', url: '/artifacts/7/1/b.png'),
|
||||
],
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
artifactListHost(
|
||||
cupertino: false,
|
||||
groups: [group],
|
||||
onSelected: (_, _) {},
|
||||
),
|
||||
);
|
||||
expect(find.byType(ArtifactTile), findsNWidgets(2));
|
||||
|
||||
await tester.tap(find.byTooltip('List'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(ArtifactTile), findsNothing);
|
||||
expect(find.byType(ArtifactThumbnail), findsNWidgets(2));
|
||||
expect(find.text('a.csv'), findsOneWidget);
|
||||
|
||||
// The section title closes and reopens its section.
|
||||
await tester.tap(find.text('review · visit 1'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('a.csv'), findsNothing);
|
||||
await tester.tap(find.text('review · visit 1'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('a.csv'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user