tests: search album
This commit is contained in:
parent
b07f15b5fb
commit
8e13625192
6 changed files with 29 additions and 4 deletions
|
@ -38,6 +38,9 @@ abstract class CollectionFilter implements Comparable<CollectionFilter> {
|
|||
|
||||
int get displayPriority => collectionFilterOrder.indexOf(typeKey);
|
||||
|
||||
// to be used as widget key
|
||||
String get key => '$typeKey-$label';
|
||||
|
||||
@override
|
||||
int compareTo(CollectionFilter other) {
|
||||
final c = displayPriority.compareTo(other.displayPriority);
|
||||
|
|
|
@ -169,6 +169,7 @@ class _CollectionAppBarState extends State<CollectionAppBar> with SingleTickerPr
|
|||
return [
|
||||
if (collection.isBrowsing)
|
||||
IconButton(
|
||||
key: Key('search-button'),
|
||||
icon: Icon(AIcons.search),
|
||||
onPressed: _goToSearch,
|
||||
),
|
||||
|
|
|
@ -104,6 +104,7 @@ class ExpandableFilterRow extends StatelessWidget {
|
|||
|
||||
Widget _buildFilterChip(CollectionFilter filter) {
|
||||
return AvesFilterChip(
|
||||
key: Key(filter.key),
|
||||
filter: filter,
|
||||
heroType: heroTypeBuilder?.call(filter) ?? HeroType.onTap,
|
||||
onPressed: onPressed,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:aves/main.dart' as app;
|
||||
import 'package:aves/services/android_file_service.dart';
|
||||
import 'package:flutter_driver/driver_extension.dart';
|
||||
import 'package:path/path.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:pedantic/pedantic.dart';
|
||||
|
||||
import 'constants.dart';
|
||||
|
@ -12,7 +12,7 @@ void main() {
|
|||
// scan files copied from test assets
|
||||
// we do it via the app instead of broadcasting via ADB
|
||||
// because `MEDIA_SCANNER_SCAN_FILE` intent got deprecated in API 29
|
||||
unawaited(AndroidFileService.scanFile(join(targetPicturesDir, 'ipse.jpg'), 'image/jpeg'));
|
||||
unawaited(AndroidFileService.scanFile(path.join(targetPicturesDir, 'ipse.jpg'), 'image/jpeg'));
|
||||
|
||||
app.main();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:aves/model/source/enums.dart';
|
||||
import 'package:flutter_driver/flutter_driver.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:pedantic/pedantic.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
|
@ -63,5 +66,22 @@ void main() {
|
|||
await driver.tap(find.byValueKey(GroupFactor.album.toString()));
|
||||
await driver.tap(find.byValueKey('apply-button'));
|
||||
});
|
||||
|
||||
test('search album', () async {
|
||||
await driver.tap(find.byValueKey('search-button'));
|
||||
await driver.waitUntilNoTransientCallbacks();
|
||||
|
||||
final album = path.split(targetPicturesDir).last;
|
||||
await driver.tap(find.byType('TextField'));
|
||||
await driver.enterText(album);
|
||||
|
||||
final albumChipFinder = find.byValueKey('album-$album');
|
||||
await driver.waitFor(albumChipFinder);
|
||||
await driver.tap(albumChipFinder);
|
||||
});
|
||||
|
||||
test('show fullscreen', () async {
|
||||
sleep(Duration(seconds: 5));
|
||||
});
|
||||
}, timeout: Timeout(Duration(seconds: 10)));
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_driver/flutter_driver.dart';
|
||||
import 'package:path/path.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
String get adb {
|
||||
final env = Platform.environment;
|
||||
final sdkDir = env['ANDROID_SDK_ROOT'] ?? env['ANDROID_SDK'];
|
||||
return join(sdkDir, 'platform-tools', Platform.isWindows ? 'adb.exe' : 'adb');
|
||||
return path.join(sdkDir, 'platform-tools', Platform.isWindows ? 'adb.exe' : 'adb');
|
||||
}
|
||||
|
||||
Future<void> createDirectory(String dir) async {
|
||||
|
|
Loading…
Reference in a new issue