feat(app): previous/next for visits, artifacts and diffs are chevrons in one row at the bottom right
This commit is contained in:
@@ -5,6 +5,7 @@ import 'dart:typed_data';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_body.dart';
|
||||
import 'package:pipelines_app/features/artifacts/ui/artifact_video_player.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/artifacts/domain/artifact_groups.dart';
|
||||
@@ -59,14 +60,6 @@ Future<void> _pumpViewer(
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
TextButton _textButton(WidgetTester tester, String label) {
|
||||
return tester.widget<TextButton>(
|
||||
find
|
||||
.ancestor(of: find.text(label), matching: find.byType(TextButton))
|
||||
.first,
|
||||
);
|
||||
}
|
||||
|
||||
const String _markdownBody =
|
||||
'# Report\n'
|
||||
'\n'
|
||||
@@ -359,24 +352,36 @@ void main() {
|
||||
);
|
||||
|
||||
expect(find.text('1 of 3 · image/png'), findsOneWidget);
|
||||
expect(_textButton(tester, 'Previous artifact').onPressed, isNull);
|
||||
expect(_textButton(tester, 'Next artifact').onPressed, isNotNull);
|
||||
expect(
|
||||
tester.widget<IconButton>(find.byKey(artifactPreviousKey)).onPressed,
|
||||
isNull,
|
||||
);
|
||||
expect(
|
||||
tester.widget<IconButton>(find.byKey(artifactNextKey)).onPressed,
|
||||
isNotNull,
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Next artifact'));
|
||||
await tester.tap(find.byKey(artifactNextKey));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('2 of 3 · image/png'), findsOneWidget);
|
||||
expect(find.text('review · visit 2'), findsOneWidget);
|
||||
expect(_textButton(tester, 'Previous artifact').onPressed, isNotNull);
|
||||
expect(
|
||||
tester.widget<IconButton>(find.byKey(artifactPreviousKey)).onPressed,
|
||||
isNotNull,
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Next artifact'));
|
||||
await tester.tap(find.byKey(artifactNextKey));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('3 of 3 · image/png'), findsOneWidget);
|
||||
expect(_textButton(tester, 'Next artifact').onPressed, isNull);
|
||||
await tester.tap(find.text('Next artifact'));
|
||||
expect(
|
||||
tester.widget<IconButton>(find.byKey(artifactNextKey)).onPressed,
|
||||
isNull,
|
||||
);
|
||||
await tester.tap(find.byKey(artifactNextKey));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('3 of 3 · image/png'), findsOneWidget);
|
||||
|
||||
await tester.tap(find.text('Previous artifact'));
|
||||
await tester.tap(find.byKey(artifactPreviousKey));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('2 of 3 · image/png'), findsOneWidget);
|
||||
});
|
||||
@@ -544,9 +549,12 @@ void main() {
|
||||
);
|
||||
|
||||
expect(tester.takeException(), isNull);
|
||||
// Both labelled controls are whole: a clipped Row overflowed the viewport.
|
||||
for (final label in ['Previous artifact', 'Next artifact']) {
|
||||
final rect = tester.getRect(find.text(label));
|
||||
// Both chevrons are whole and on screen at the bottom right.
|
||||
for (final (label, key) in [
|
||||
('Previous artifact', artifactPreviousKey),
|
||||
('Next artifact', artifactNextKey),
|
||||
]) {
|
||||
final rect = tester.getRect(find.byKey(key));
|
||||
expect(rect.left, greaterThanOrEqualTo(0), reason: label);
|
||||
expect(rect.right, lessThanOrEqualTo(320), reason: label);
|
||||
expect(rect.width, greaterThan(0), reason: label);
|
||||
|
||||
Reference in New Issue
Block a user