WIP: search artifact hit opens the viewer (run #231)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/artifacts/domain/artifact_document.dart';
|
||||
import 'package:pipelines_app/features/artifacts/domain/artifact_groups.dart';
|
||||
import 'package:pipelines_app/features/artifacts/domain/artifact_record.dart';
|
||||
import 'package:pipelines_app/features/artifacts/domain/gallery_navigation.dart';
|
||||
@@ -171,6 +172,38 @@ void main() {
|
||||
expect(pagedArtifacts(groups), isEmpty);
|
||||
expect(viewerIndexByUrl(groups), isEmpty);
|
||||
});
|
||||
|
||||
test('search navigation can include an external-only session export', () {
|
||||
final groups = <ArtifactGroup>[
|
||||
ArtifactGroup(
|
||||
stageKey: 'a',
|
||||
visit: 1,
|
||||
artifacts: const <ArtifactRecord>[],
|
||||
documents: <ArtifactDocument>[
|
||||
ArtifactDocument(
|
||||
name: 'session.html',
|
||||
record: ArtifactRecord(
|
||||
name: 'session.html',
|
||||
url: '/artifacts/1/session.html',
|
||||
contentType: 'text/html',
|
||||
sizeBytes: 1,
|
||||
raw: <String, dynamic>{},
|
||||
),
|
||||
absence: '',
|
||||
),
|
||||
],
|
||||
),
|
||||
];
|
||||
|
||||
expect(pagedArtifacts(groups), isEmpty);
|
||||
expect(
|
||||
pagedArtifacts(
|
||||
groups,
|
||||
includeExternalDocuments: true,
|
||||
).single.artifact.name,
|
||||
'session.html',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
group('paging', () {
|
||||
|
||||
@@ -270,6 +270,23 @@ void main() {
|
||||
expect(target.timelineIndex, 1);
|
||||
});
|
||||
|
||||
test('an artifact selection keeps its URL while naming the visit', () {
|
||||
final target = resolveRunSearchSelection(
|
||||
const RunSearchSelection(
|
||||
runId: 77,
|
||||
sequence: 2,
|
||||
artifactUrl: '/artifacts/77/2/release-report.txt',
|
||||
),
|
||||
searchSelectionRun(),
|
||||
);
|
||||
|
||||
expect(target, isA<RunArtifactTarget>());
|
||||
final artifact = target as RunArtifactTarget;
|
||||
expect(artifact.url, '/artifacts/77/2/release-report.txt');
|
||||
expect(artifact.visit.stageKey, 'build');
|
||||
expect(artifact.visit.timelineIndex, 1);
|
||||
});
|
||||
|
||||
test('an unrecorded sequence falls back to the plain Summary', () {
|
||||
_expectSummarySection(
|
||||
resolveRunSearchSelection(
|
||||
|
||||
Reference in New Issue
Block a user