feat(app): artifact viewer actions are bottom icons; swipe pages; native download, share and open in browser
This commit is contained in:
@@ -223,7 +223,11 @@ void main() {
|
||||
stage: 'review',
|
||||
visit: 1,
|
||||
artifacts: <JsonMap>[
|
||||
artifact('report.zip', contentType: 'application/zip', sizeBytes: 3),
|
||||
artifact(
|
||||
'report.zip',
|
||||
contentType: 'application/zip',
|
||||
sizeBytes: 3,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -262,6 +266,14 @@ void main() {
|
||||
artifact: _record,
|
||||
resolved: resolveArtifactUrl(_endpoint, _record.url)!,
|
||||
fetch: _fetch,
|
||||
bridge: const ArtifactFileBridge(
|
||||
downloadSupported: false,
|
||||
shareSupported: false,
|
||||
downloadUnsupportedMessage:
|
||||
'Downloading files is not supported on this platform yet.',
|
||||
shareUnsupportedMessage:
|
||||
'File sharing is not supported on this platform yet.',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -374,8 +386,8 @@ void main() {
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Download'), findsOneWidget);
|
||||
expect(find.text('Share'), findsOneWidget);
|
||||
expect(find.byKey(const Key('artifact-download')), findsOneWidget);
|
||||
expect(find.byKey(const Key('artifact-share')), findsOneWidget);
|
||||
|
||||
final externalGroup = visitGroup(artifacts: <ArtifactRecord>[external]);
|
||||
await tester.pumpWidget(
|
||||
@@ -395,9 +407,9 @@ void main() {
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Download'), findsNothing);
|
||||
expect(find.text('Share'), findsNothing);
|
||||
expect(find.text('Open'), findsOneWidget);
|
||||
expect(find.byKey(const Key('artifact-download')), findsNothing);
|
||||
expect(find.byKey(const Key('artifact-share')), findsNothing);
|
||||
expect(find.byKey(const Key('artifact-open')), findsOneWidget);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -466,7 +466,10 @@ void main() {
|
||||
);
|
||||
|
||||
expect(tester.takeException(), isNull);
|
||||
expect(tester.getSize(find.byType(CustomScrollView)).height, greaterThan(0));
|
||||
expect(
|
||||
tester.getSize(find.byType(CustomScrollView)).height,
|
||||
greaterThan(0),
|
||||
);
|
||||
expect(
|
||||
find.text('12 files excluded from artifact capture.'),
|
||||
findsOneWidget,
|
||||
|
||||
@@ -150,10 +150,9 @@ void main() {
|
||||
expect(find.byType(ArtifactViewerPage), findsOneWidget);
|
||||
// The gallery's thumbnail and the viewer read the same recorded file.
|
||||
expect(fetched, isNotEmpty);
|
||||
expect(
|
||||
fetched.toSet(),
|
||||
{Uri.parse('http://127.0.0.1:8081/artifacts/1/1/shot.png')},
|
||||
);
|
||||
expect(fetched.toSet(), {
|
||||
Uri.parse('http://127.0.0.1:8081/artifacts/1/1/shot.png'),
|
||||
});
|
||||
expect(find.byType(Image), findsOneWidget);
|
||||
expect(find.text('1 of 1 · image/png'), findsOneWidget);
|
||||
expect(find.text('image/png · 1.0\u00a0KiB'), findsOneWidget);
|
||||
@@ -247,7 +246,7 @@ void main() {
|
||||
);
|
||||
expect(fetched, isEmpty);
|
||||
expect(find.byType(Image), findsNothing);
|
||||
await tester.tap(find.text('Open'));
|
||||
await tester.tap(find.byKey(const Key('artifact-open')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(opened, [Uri.parse('https://elsewhere.test/shot.png')]);
|
||||
});
|
||||
@@ -320,8 +319,8 @@ void main() {
|
||||
// The player streams the url itself; the viewer never fetches its bytes.
|
||||
expect(find.byType(ArtifactVideoPlayer), findsOneWidget);
|
||||
expect(find.text('This file type cannot be previewed here.'), findsNothing);
|
||||
expect(find.text('Open'), findsOneWidget);
|
||||
expect(find.text('Copy link'), findsOneWidget);
|
||||
expect(find.byKey(const Key('artifact-open')), findsOneWidget);
|
||||
expect(find.byKey(const Key('artifact-copy-link')), findsOneWidget);
|
||||
expect(fetches, 0);
|
||||
});
|
||||
|
||||
@@ -523,6 +522,37 @@ void main() {
|
||||
expect(find.byType(Material), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('a swipe moves to the next and previous artifact', (
|
||||
tester,
|
||||
) async {
|
||||
final first = recordedArtifact(
|
||||
'a.png',
|
||||
url: '/artifacts/1/1/a.png',
|
||||
contentType: 'image/png',
|
||||
);
|
||||
final second = recordedArtifact(
|
||||
'b.png',
|
||||
url: '/artifacts/1/2/b.png',
|
||||
contentType: 'image/png',
|
||||
);
|
||||
final groups = [
|
||||
_group([first], visit: 1),
|
||||
_group([second], visit: 2),
|
||||
];
|
||||
await _pumpViewer(
|
||||
tester,
|
||||
groups: groups,
|
||||
selected: artifactVisitIdentity(groups[0], first),
|
||||
);
|
||||
final swipe = find.byKey(const Key('artifact-viewer-swipe'));
|
||||
await tester.fling(swipe, const Offset(-300, 0), 1000);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.textContaining('2 of 2'), findsWidgets);
|
||||
await tester.fling(swipe, const Offset(300, 0), 1000);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.textContaining('1 of 2'), findsWidgets);
|
||||
});
|
||||
|
||||
testWidgets('Material paging stays inside 320px at 2x text', (tester) async {
|
||||
tester.view.physicalSize = const Size(640, 1200);
|
||||
tester.view.devicePixelRatio = 2;
|
||||
|
||||
Reference in New Issue
Block a user