tests: fullscreen zoom, show metadata
This commit is contained in:
parent
55c6209bee
commit
d83d0e353a
4 changed files with 155 additions and 82 deletions
|
@ -40,6 +40,7 @@ class InfoPageState extends State<InfoPage> {
|
|||
|
||||
final appBar = SliverAppBar(
|
||||
leading: IconButton(
|
||||
key: Key('back-button'),
|
||||
icon: Icon(AIcons.goUp),
|
||||
onPressed: _goToImage,
|
||||
tooltip: 'Back to image',
|
||||
|
|
|
@ -87,6 +87,7 @@ class _MetadataSectionSliverState extends State<MetadataSectionSliver> with Auto
|
|||
accentColor: Colors.white,
|
||||
),
|
||||
child: ExpansionTileCard(
|
||||
key: Key('tilecard-${dir.name}'),
|
||||
value: dir.name,
|
||||
expandedNotifier: _expandedDirectoryNotifier,
|
||||
title: _DirectoryTitle(dir.name),
|
||||
|
|
|
@ -5,14 +5,16 @@ import 'package:pedantic/pedantic.dart';
|
|||
import 'package:test/test.dart';
|
||||
|
||||
import 'constants.dart';
|
||||
import 'driver_extension.dart';
|
||||
import 'utils.dart';
|
||||
|
||||
FlutterDriver driver;
|
||||
|
||||
void main() {
|
||||
group('Aves app', () {
|
||||
FlutterDriver driver;
|
||||
print('adb=${[adb, ...adbDeviceParam].join(' ')}');
|
||||
|
||||
setUpAll(() async {
|
||||
print('adb=${[adb, ...adbDeviceParam].join(' ')}');
|
||||
await copyContent(sourcePicturesDir, targetPicturesDir);
|
||||
await grantPermissions('deckers.thibault.aves.debug', [
|
||||
'android.permission.READ_EXTERNAL_STORAGE',
|
||||
|
@ -24,12 +26,26 @@ void main() {
|
|||
|
||||
tearDownAll(() async {
|
||||
await removeDirectory(targetPicturesDir);
|
||||
if (driver != null) {
|
||||
unawaited(driver.close());
|
||||
}
|
||||
unawaited(driver?.close());
|
||||
});
|
||||
|
||||
test('agree to terms and reach home', () async {
|
||||
agreeToTerms();
|
||||
sortCollection();
|
||||
groupCollection();
|
||||
searchAlbum();
|
||||
showFullscreen();
|
||||
toggleOverlay();
|
||||
zoom();
|
||||
showInfoMetadata();
|
||||
|
||||
test('contemplation', () async {
|
||||
await Future.delayed(Duration(seconds: 5));
|
||||
});
|
||||
}, timeout: Timeout(Duration(seconds: 10)));
|
||||
}
|
||||
|
||||
void agreeToTerms() {
|
||||
test('[welcome] agree to terms', () async {
|
||||
await driver.scroll(find.text('Terms of Service'), 0, -300, Duration(milliseconds: 500));
|
||||
|
||||
final buttonFinder = find.byValueKey('continue-button');
|
||||
|
@ -44,19 +60,10 @@ void main() {
|
|||
|
||||
expect(await driver.getText(find.byValueKey('appbar-title')), 'Aves');
|
||||
});
|
||||
}
|
||||
|
||||
test('sort collection', () async {
|
||||
await driver.tap(find.byValueKey('appbar-menu-button'));
|
||||
await driver.waitUntilNoTransientCallbacks();
|
||||
|
||||
await driver.tap(find.byValueKey('menu-sort'));
|
||||
await driver.waitUntilNoTransientCallbacks();
|
||||
|
||||
await driver.tap(find.byValueKey(SortFactor.date.toString()));
|
||||
await driver.tap(find.byValueKey('apply-button'));
|
||||
});
|
||||
|
||||
test('group collection', () async {
|
||||
void groupCollection() {
|
||||
test('[collection] group', () async {
|
||||
await driver.tap(find.byValueKey('appbar-menu-button'));
|
||||
await driver.waitUntilNoTransientCallbacks();
|
||||
|
||||
|
@ -66,8 +73,23 @@ void main() {
|
|||
await driver.tap(find.byValueKey(GroupFactor.album.toString()));
|
||||
await driver.tap(find.byValueKey('apply-button'));
|
||||
});
|
||||
}
|
||||
|
||||
test('search album', () async {
|
||||
void sortCollection() {
|
||||
test('[collection] sort', () async {
|
||||
await driver.tap(find.byValueKey('appbar-menu-button'));
|
||||
await driver.waitUntilNoTransientCallbacks();
|
||||
|
||||
await driver.tap(find.byValueKey('menu-sort'));
|
||||
await driver.waitUntilNoTransientCallbacks();
|
||||
|
||||
await driver.tap(find.byValueKey(SortFactor.date.toString()));
|
||||
await driver.tap(find.byValueKey('apply-button'));
|
||||
});
|
||||
}
|
||||
|
||||
void searchAlbum() {
|
||||
test('[collection] search album', () async {
|
||||
await driver.tap(find.byValueKey('search-button'));
|
||||
await driver.waitUntilNoTransientCallbacks();
|
||||
|
||||
|
@ -79,12 +101,18 @@ void main() {
|
|||
await driver.waitFor(albumChipFinder);
|
||||
await driver.tap(albumChipFinder);
|
||||
});
|
||||
}
|
||||
|
||||
test('show fullscreen', () async {
|
||||
void showFullscreen() {
|
||||
test('[collection] show fullscreen', () async {
|
||||
await driver.tap(find.byType('DecoratedThumbnail'));
|
||||
await driver.waitUntilNoTransientCallbacks();
|
||||
await Future.delayed(Duration(seconds: 2));
|
||||
});
|
||||
}
|
||||
|
||||
void toggleOverlay() {
|
||||
test('[fullscreen] toggle overlay', () async {
|
||||
final imageViewFinder = find.byValueKey('imageview');
|
||||
|
||||
print('* hide overlay');
|
||||
|
@ -95,18 +123,50 @@ void main() {
|
|||
await driver.tap(imageViewFinder);
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
});
|
||||
}
|
||||
|
||||
test('show info', () async {
|
||||
final verticalPageViewFinder = find.byValueKey('vertical-pageview');
|
||||
void zoom() {
|
||||
test('[fullscreen] zoom cycle', () async {
|
||||
final imageViewFinder = find.byValueKey('imageview');
|
||||
|
||||
print('* scroll to info');
|
||||
await driver.scroll(verticalPageViewFinder, 0, -600, Duration(milliseconds: 400));
|
||||
await driver.doubleTap(imageViewFinder);
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
|
||||
// TODO TLAD find.pageBack
|
||||
// print('* back to image');
|
||||
// await driver.tap(find.pageBack());
|
||||
// await Future.delayed(Duration(seconds: 5));
|
||||
await driver.doubleTap(imageViewFinder);
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
|
||||
await driver.doubleTap(imageViewFinder);
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
});
|
||||
}
|
||||
|
||||
void showInfoMetadata() {
|
||||
test('[fullscreen] show info', () async {
|
||||
final verticalPageViewFinder = find.byValueKey('vertical-pageview');
|
||||
|
||||
print('* scroll down to info');
|
||||
await driver.scroll(verticalPageViewFinder, 0, -600, Duration(milliseconds: 400));
|
||||
await Future.delayed(Duration(seconds: 2));
|
||||
|
||||
print('* scroll down to metadata details');
|
||||
await driver.scroll(verticalPageViewFinder, 0, -800, Duration(milliseconds: 600));
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
|
||||
print('* toggle GPS metadata');
|
||||
final gpsTileFinder = find.descendant(
|
||||
of: find.byValueKey('tilecard-GPS'),
|
||||
matching: find.byType('ListTile'),
|
||||
);
|
||||
await driver.tap(gpsTileFinder);
|
||||
await driver.waitUntilNoTransientCallbacks();
|
||||
await driver.tap(gpsTileFinder);
|
||||
await driver.waitUntilNoTransientCallbacks();
|
||||
|
||||
print('* scroll up to show app bar');
|
||||
await driver.scroll(verticalPageViewFinder, 0, 100, Duration(milliseconds: 400));
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
|
||||
print('* back to image');
|
||||
await driver.tap(find.byValueKey('back-button'));
|
||||
});
|
||||
}, timeout: Timeout(Duration(seconds: 10)));
|
||||
}
|
||||
|
|
11
test_driver/driver_extension.dart
Normal file
11
test_driver/driver_extension.dart
Normal file
|
@ -0,0 +1,11 @@
|
|||
import 'package:flutter_driver/flutter_driver.dart';
|
||||
|
||||
extension ExtraFlutterDriver on FlutterDriver {
|
||||
static const doubleTapDelay = Duration(milliseconds: 100); // in [kDoubleTapMinTime = 40 ms, kDoubleTapTimeout = 300 ms]
|
||||
|
||||
Future doubleTap(SerializableFinder finder, {Duration timeout}) async {
|
||||
await tap(finder, timeout: timeout);
|
||||
await Future.delayed(doubleTapDelay);
|
||||
await tap(finder, timeout: timeout);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue