Keep turn documents out of the artifact viewer unless Debug is on

Opening a stage artifact paged through every visit's turn documents too,
although the list hides them; the viewer now pages through what the list
shows.
This commit is contained in:
2026-11-01 08:32:10 +00:00
parent ea134b38f2
commit 2808378823
2 changed files with 38 additions and 1 deletions
@@ -216,7 +216,19 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
],
),
]
: _groups;
// A stage artifact pages through what the list shows: turn
// documents only while Debug reveals them.
: _showTurnDocuments
? _groups
: [
for (final group in _groups)
if (group.artifacts.isNotEmpty)
ArtifactGroup(
stageKey: group.stageKey,
visit: group.visit,
artifacts: group.artifacts,
),
];
final previousFocus = FocusManager.instance.primaryFocus;
await Navigator.of(context).push<void>(
usesCupertinoHost(context)
@@ -196,6 +196,31 @@ void main() {
]);
});
testWidgets('${platform.name}: a stage artifact pages only through stage '
'artifacts while Debug is off', (tester) async {
await _pump(tester, platform);
// report.csv (visit 1) and notes.md (visit 2) are the only stage
// artifacts; the visits' turn documents stay out of the viewer.
await tester.tap(find.text('report.csv'));
await tester.pumpAndSettle();
expect(find.byType(ArtifactViewerPage), findsOneWidget);
expect(find.text('1 of 2 · text/csv'), findsOneWidget);
});
testWidgets('${platform.name}: with Debug on, a stage artifact pages '
'through turn documents too', (tester) async {
await _pump(tester, platform);
await _showTurnDocuments(tester);
await tester.tap(find.text('report.csv'));
await tester.pumpAndSettle();
expect(find.byType(ArtifactViewerPage), findsOneWidget);
// Both stage artifacts plus the recorded viewer documents
// (session.html opens externally only).
expect(find.text('1 of 6 · text/csv'), findsOneWidget);
});
testWidgets('${platform.name}: documents do not count as artifacts and '
'viewer paging stays within documents', (tester) async {
await _pump(