feat(app): separate turn documents from artifacts
This commit is contained in:
@@ -53,6 +53,7 @@ Future<void> _pump(
|
||||
List<JsonMap>? steps,
|
||||
ArtifactFetch? fetch,
|
||||
ArtifactExternalOpen? openExternal,
|
||||
int? focusIndex,
|
||||
}) async {
|
||||
tester.view.physicalSize = const Size(900, 2600);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
@@ -60,6 +61,7 @@ Future<void> _pump(
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
final page = ArtifactGalleryPage(
|
||||
steps: steps ?? _steps(),
|
||||
focusIndex: focusIndex,
|
||||
configuredEndpoint: _endpoint,
|
||||
openExternal: openExternal ?? (_) async => true,
|
||||
fetch:
|
||||
@@ -78,6 +80,14 @@ Future<void> _pump(
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
Future<void> _expandTurnDocuments(WidgetTester tester) async {
|
||||
final headings = find.textContaining('Turn documents');
|
||||
for (var index = 0; index < headings.evaluate().length; index += 1) {
|
||||
await tester.tap(headings.at(index));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
}
|
||||
|
||||
Finder _dialog(_Platform platform, String text) => find.descendant(
|
||||
of: find.byType(
|
||||
platform == _Platform.material ? AlertDialog : CupertinoAlertDialog,
|
||||
@@ -92,6 +102,11 @@ void main() {
|
||||
) async {
|
||||
await _pump(tester, platform);
|
||||
expect(find.textContaining('Turn documents'), findsNWidgets(2));
|
||||
// The generated artifact grid remains primary; debugging evidence is
|
||||
// deliberately hidden until its own section is opened.
|
||||
expect(find.text('input.md'), findsNothing);
|
||||
expect(find.text('For debugging.'), findsNothing);
|
||||
await _expandTurnDocuments(tester);
|
||||
expect(find.text('input.md'), findsNWidgets(2));
|
||||
expect(find.text('output.md'), findsNWidgets(2));
|
||||
expect(find.text('session.html'), findsNWidgets(2));
|
||||
@@ -104,6 +119,7 @@ void main() {
|
||||
tester,
|
||||
) async {
|
||||
await _pump(tester, platform);
|
||||
await _expandTurnDocuments(tester);
|
||||
expect(find.text('No memory recorded for this visit.'), findsOneWidget);
|
||||
expect(find.text('No output recorded.'), findsOneWidget);
|
||||
expect(find.text('This visit has no harness session.'), findsOneWidget);
|
||||
@@ -114,6 +130,7 @@ void main() {
|
||||
tester,
|
||||
) async {
|
||||
await _pump(tester, platform);
|
||||
await _expandTurnDocuments(tester);
|
||||
await tester.tap(find.text('input.md').first);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(ArtifactViewerPage), findsOneWidget);
|
||||
@@ -128,6 +145,7 @@ void main() {
|
||||
'${platform.name}: absent rows are informational, not controls',
|
||||
(tester) async {
|
||||
await _pump(tester, platform);
|
||||
await _expandTurnDocuments(tester);
|
||||
final absence = find.text('No output recorded.');
|
||||
expect(absence, findsOneWidget);
|
||||
if (platform == _Platform.material) {
|
||||
@@ -169,6 +187,7 @@ void main() {
|
||||
},
|
||||
fetch: (_) async => throw StateError('x'),
|
||||
);
|
||||
await _expandTurnDocuments(tester);
|
||||
await tester.tap(find.text('session.html').first);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(ArtifactViewerPage), findsNothing);
|
||||
@@ -181,5 +200,99 @@ void main() {
|
||||
Uri.parse('http://127.0.0.1:8081/artifacts/1/1/session.html'),
|
||||
]);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name}: documents do not count as artifacts and '
|
||||
'viewer paging stays within documents', (tester) async {
|
||||
await _pump(
|
||||
tester,
|
||||
platform,
|
||||
steps: [
|
||||
step(
|
||||
stage: 'review',
|
||||
visit: 1,
|
||||
artifacts: [
|
||||
_recorded('report.csv', contentType: 'text/csv', sizeBytes: 23),
|
||||
_recorded('input.md', contentType: 'text/markdown', sizeBytes: 1),
|
||||
_recorded(
|
||||
'output.md',
|
||||
contentType: 'text/markdown',
|
||||
sizeBytes: 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
expect(find.text('Artifact · 1 recorded'), findsOneWidget);
|
||||
expect(find.text('report.csv'), findsOneWidget);
|
||||
expect(find.text('input.md'), findsNothing);
|
||||
await _expandTurnDocuments(tester);
|
||||
expect(find.text('For debugging.'), findsOneWidget);
|
||||
await tester.tap(find.text('input.md'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(ArtifactViewerPage), findsOneWidget);
|
||||
expect(find.text('1 of 2 · text/markdown'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name}: document-only visits retain an honest empty '
|
||||
'artifact state', (tester) async {
|
||||
await _pump(
|
||||
tester,
|
||||
platform,
|
||||
steps: [
|
||||
step(
|
||||
stage: 'review',
|
||||
visit: 1,
|
||||
artifacts: [
|
||||
_recorded('input.md', contentType: 'text/markdown', sizeBytes: 1),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
expect(find.text('No artifacts recorded for this run.'), findsOneWidget);
|
||||
expect(find.text('input.md'), findsNothing);
|
||||
await _expandTurnDocuments(tester);
|
||||
expect(find.text('input.md'), findsOneWidget);
|
||||
expect(find.text('For debugging.'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name}: focused document-only visits retain turn '
|
||||
'documents', (tester) async {
|
||||
await _pump(
|
||||
tester,
|
||||
platform,
|
||||
focusIndex: 0,
|
||||
steps: [
|
||||
step(
|
||||
stage: 'review',
|
||||
visit: 1,
|
||||
artifacts: [
|
||||
_recorded('input.md', contentType: 'text/markdown', sizeBytes: 1),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
expect(
|
||||
find.text('No artifacts recorded for this visit.'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.text('input.md'), findsNothing);
|
||||
await _expandTurnDocuments(tester);
|
||||
expect(find.text('input.md'), findsOneWidget);
|
||||
expect(find.text('For debugging.'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name}: focused visits retain session documents', (
|
||||
tester,
|
||||
) async {
|
||||
await _pump(tester, platform, focusIndex: 0);
|
||||
|
||||
expect(find.text('session.html'), findsNothing);
|
||||
await _expandTurnDocuments(tester);
|
||||
expect(find.text('session.html'), findsOneWidget);
|
||||
expect(find.text('For debugging.'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,12 +79,12 @@ void main() {
|
||||
expect(find.text('ok'), findsOneWidget);
|
||||
|
||||
await openVisitTab(tester, RunVisitSection.artifacts);
|
||||
// The section is the run's gallery, focused on this visit: exactly the
|
||||
// stage's files, without the session evidence file.
|
||||
// The focused gallery keeps generated files primary and makes the session
|
||||
// evidence reachable in its secondary turn-documents section.
|
||||
await _expandArtifactGroup(tester);
|
||||
expect(find.byType(ArtifactGalleryPage), findsOneWidget);
|
||||
expect(find.text('plan.csv'), findsOneWidget);
|
||||
expect(find.text('session.html'), findsNothing);
|
||||
expect(find.text('session.html'), findsOneWidget);
|
||||
|
||||
await openVisitTab(tester, RunVisitSection.session);
|
||||
expect(find.text('Session'), findsWidgets);
|
||||
|
||||
Reference in New Issue
Block a user