c553b7d90d
Put the page summary and the recorded capture notes on one scrolling header, style Material section headings as muted titleSmall, and draw a hairline between Material rows only. Share the selection-facts hierarchy between the sheet and the viewer and order the sheet actions Close, Copy link, Open on both hosts. The header now rides inside the artifact list's scroll view, so many partial visits or a large text scale scroll with the rows instead of overflowing the page and collapsing the list. Tests cover per-host headings, dividers, notes, sheet order, and the constrained 2x large-text layouts.
87 lines
2.9 KiB
Dart
87 lines
2.9 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/core/api_gateway.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/ui/artifact_selection_facts.dart';
|
|
|
|
import '../domain/artifact_fixtures.dart';
|
|
|
|
JsonMap _recorded() => artifact(
|
|
'result.csv',
|
|
url: '/artifacts/1/1/result.csv',
|
|
contentType: 'text/csv',
|
|
sizeBytes: 2048,
|
|
);
|
|
|
|
ArtifactGroup _group() => ArtifactGroup(
|
|
stageKey: 'review',
|
|
visit: 1,
|
|
artifacts: [ArtifactRecord.fromJson(_recorded())],
|
|
);
|
|
|
|
Future<void> _pump(WidgetTester tester, {required bool cupertino}) async {
|
|
final group = _group();
|
|
final facts = Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: ArtifactSelectionFacts(
|
|
group: group,
|
|
artifact: group.artifacts.single,
|
|
step: step(
|
|
stage: 'review',
|
|
visit: 1,
|
|
artifacts: [_recorded()],
|
|
skipped: 2,
|
|
),
|
|
resolved: null,
|
|
),
|
|
);
|
|
await tester.pumpWidget(
|
|
cupertino
|
|
? CupertinoApp(
|
|
home: CupertinoPageScaffold(
|
|
backgroundColor: CupertinoColors.systemGroupedBackground,
|
|
child: facts,
|
|
),
|
|
)
|
|
: MaterialApp(home: Scaffold(body: facts)),
|
|
);
|
|
}
|
|
|
|
void main() {
|
|
for (final cupertino in <bool>[false, true]) {
|
|
testWidgets(
|
|
'${cupertino ? 'cupertino' : 'material'}: facts lead with metadata, then the visit, then its capture',
|
|
(tester) async {
|
|
await _pump(tester, cupertino: cupertino);
|
|
|
|
const metadata = 'text/csv · 2.0\u00a0KiB';
|
|
const visit = 'review · visit 1';
|
|
const summary = 'Artifacts · 1 recorded · partial capture';
|
|
const note = '2 files excluded from artifact capture.';
|
|
const urlState = 'The recorded artifact URL cannot be opened safely.';
|
|
|
|
double topOf(String text) => tester.getTopLeft(find.text(text)).dy;
|
|
|
|
expect(topOf(metadata), lessThan(topOf(visit)));
|
|
expect(topOf(visit), lessThan(topOf(summary)));
|
|
expect(topOf(summary), lessThan(topOf(note)));
|
|
expect(topOf(note), lessThan(topOf(urlState)));
|
|
|
|
final context = tester.element(find.text(metadata));
|
|
final secondary = cupertino
|
|
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
|
: Theme.of(context).colorScheme.onSurfaceVariant;
|
|
final metadataStyle = tester.widget<Text>(find.text(metadata)).style;
|
|
final visitStyle = tester.widget<Text>(find.text(visit)).style;
|
|
final summaryStyle = tester.widget<Text>(find.text(summary)).style;
|
|
|
|
expect(metadataStyle?.color, secondary);
|
|
expect(visitStyle?.color, secondary);
|
|
expect(summaryStyle?.color, isNot(secondary));
|
|
},
|
|
);
|
|
}
|
|
}
|