feat(app): artifact viewer shows CSV and TSV files as tables

This commit is contained in:
2026-10-23 15:02:17 +01:00
parent 89675dcfa8
commit 5ac8fcc6ef
14 changed files with 411 additions and 91 deletions
@@ -23,9 +23,9 @@ const _endpoint = 'ws://127.0.0.1:8081/connect';
final Uint8List _bytes = Uint8List.fromList(<int>[7, 8, 9]);
final ArtifactRecord _record = ArtifactRecord.fromJson(<String, dynamic>{
'name': 'report.csv',
'url': '/artifacts/1/1/report.csv',
'content_type': 'text/csv',
'name': 'report.zip',
'url': '/artifacts/1/1/report.zip',
'content_type': 'application/zip',
'size_bytes': 3,
});
@@ -115,10 +115,10 @@ void main() {
await tester.pumpAndSettle();
expect(saved, hasLength(1));
expect(saved.single.name, 'report.csv');
expect(saved.single.mimeType, 'text/csv');
expect(saved.single.name, 'report.zip');
expect(saved.single.mimeType, 'application/zip');
expect(saved.single.bytes, _bytes);
expect(find.text('Downloaded report.csv.'), findsOneWidget);
expect(find.text('Downloaded report.zip.'), findsOneWidget);
});
testWidgets('Share starts one file transfer, not a link', (tester) async {
@@ -130,7 +130,7 @@ void main() {
await tester.tap(find.text('Share'));
await tester.pumpAndSettle();
expect(shared.single.name, 'report.csv');
expect(shared.single.name, 'report.zip');
expect(shared.single.byteLength, 3);
expect(find.text('File shared.'), findsOneWidget);
});
@@ -223,7 +223,7 @@ void main() {
stage: 'review',
visit: 1,
artifacts: <JsonMap>[
artifact('report.csv', contentType: 'text/csv', sizeBytes: 3),
artifact('report.zip', contentType: 'application/zip', sizeBytes: 3),
],
),
],
@@ -235,7 +235,7 @@ void main() {
);
await tester.pumpAndSettle();
await tester.tap(find.text('report.csv'));
await tester.tap(find.text('report.zip'));
await tester.pumpAndSettle();
expect(find.byType(AlertDialog), findsOneWidget);
expect(find.text('Download'), findsOneWidget);
@@ -246,7 +246,7 @@ void main() {
await tester.tap(find.text('Download'));
await tester.pumpAndSettle();
expect(saved.single.bytes, _bytes);
expect(find.text('Downloaded report.csv.'), findsOneWidget);
expect(find.text('Downloaded report.zip.'), findsOneWidget);
expect(find.byType(AlertDialog), findsOneWidget);
});
@@ -299,7 +299,7 @@ void main() {
stage: 'review',
visit: 1,
artifacts: <JsonMap>[
artifact('report.csv', contentType: 'text/csv', sizeBytes: 3),
artifact('report.zip', contentType: 'application/zip', sizeBytes: 3),
],
),
];
@@ -326,7 +326,7 @@ void main() {
),
);
await tester.pumpAndSettle();
await tester.tap(find.text('report.csv'));
await tester.tap(find.text('report.zip'));
await tester.pumpAndSettle();
expect(tester.takeException(), isNull);