Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mobile][photos] Trim redundant album UI tests

r4khul284a42159659
diff --git a/mobile/apps/photos/test/ui/viewer/gallery/album_actions_sheet_test.dart b/mobile/apps/photos/test/ui/viewer/gallery/album_actions_sheet_test.dart
index 170b2164d8..338a3ec3c8 100644
--- a/mobile/apps/photos/test/ui/viewer/gallery/album_actions_sheet_test.dart
+++ b/mobile/apps/photos/test/ui/viewer/gallery/album_actions_sheet_test.dart
@@ -47,12 +47,6 @@ void main() {
expect(find.byType(BottomSheetComponent), findsNothing);
result = "pending";
await _openLauncher(tester);
- await tester.tapAt(const Offset(200, 150));
- await tester.pumpAndSettle();
- expect(result, isNull);
- expect(find.byType(BottomSheetComponent), findsNothing);
- result = "pending";
- await _openLauncher(tester);
await tester.longPressAt(const Offset(200, 150));
await tester.pumpAndSettle();
expect(result, isNull);
@@ -94,8 +88,6 @@ void main() {
.state<ScrollableState>(find.byType(Scrollable))
.position;
await _openLauncher(tester);
- expect(find.byType(DividerComponent), findsOneWidget);
- expect(find.byType(VerticalDivider), findsNothing);
final firstRow = [
"Edit",
"Pin",
@@ -114,20 +106,6 @@ void main() {
expect(sheet.left, greaterThanOrEqualTo(Spacing.lg));
expect(sheet.right, lessThanOrEqualTo(667 - Spacing.lg));
expect(sheet.bottom, 240);
- final scrollable = tester.state<ScrollableState>(
- find.descendant(
- of: find.byType(SingleChildScrollView),
- matching: find.byType(Scrollable),
- ),
- );
- expect(scrollable.position.maxScrollExtent, greaterThan(0));
- tester.view.physicalSize = const Size(375, 667);
- await tester.pumpAndSettle();
- expect(find.byType(DividerComponent), findsOneWidget);
- expect(tester.getSize(find.byType(BottomSheetComponent)).width, 375);
- tester.view.physicalSize = const Size(667, 240);
- await tester.pumpAndSettle();
- expect(find.byType(DividerComponent), findsOneWidget);
await tester.ensureVisible(find.text("Cast"));
await tester.pumpAndSettle();
await tester.tap(find.text("Cast"));
@@ -161,20 +139,6 @@ void main() {
semantics.dispose();
result = "pending";
await _openLauncher(tester);
- final drag = await tester.startGesture(
- Offset(sheet.left / 2, sheet.center.dy),
- );
- await drag.moveBy(const Offset(0, -24));
- await drag.moveBy(const Offset(0, -40));
- await drag.up();
- await tester.pumpAndSettle();
- expect(result, isNull);
- expect(albumScroll.pixels, greaterThan(0));
- expect(find.byType(BottomSheetComponent), findsNothing);
- albumScroll.jumpTo(0);
- await tester.pumpAndSettle();
- result = "pending";
- await _openLauncher(tester);
final cancelledDrag = await tester.startGesture(
Offset(sheet.left / 2, sheet.center.dy),
);
@@ -221,17 +185,12 @@ void main() {
addTearDown(tester.platformDispatcher.clearTextScaleFactorTestValue);
await tester.pumpAndSettle();
await _openLauncher(tester);
- expect(tester.getSize(find.byType(BottomSheetComponent)).width, 640);
await tester.drag(
find.byType(SingleChildScrollView),
const Offset(0, -200),
);
await tester.pumpAndSettle();
- await tester.tap(find.text("Add photos"));
- await tester.pumpAndSettle();
- expect(result, "add photos");
expect(tester.takeException(), isNull);
- await _openLauncher(tester);
for (final (size, width) in [
(const Size(1024, 1366), 640.0),
(const Size(1366, 1024), 640.0),
@@ -246,6 +205,8 @@ void main() {
expect(resizedSheet.bottom, size.height);
expect(tester.takeException(), isNull);
}
+ await tester.ensureVisible(find.text("Add photos"));
+ await tester.pumpAndSettle();
await tester.tap(find.text("Add photos"));
await tester.pumpAndSettle();
expect(result, "add photos");
diff --git a/mobile/apps/photos/test/ui/viewer/gallery/collection_page_cover_test.dart b/mobile/apps/photos/test/ui/viewer/gallery/collection_page_cover_test.dart
index acd6b2350a..9ef0045fe5 100644
--- a/mobile/apps/photos/test/ui/viewer/gallery/collection_page_cover_test.dart
+++ b/mobile/apps/photos/test/ui/viewer/gallery/collection_page_cover_test.dart
@@ -24,7 +24,6 @@ import "package:photos/models/file/file.dart";
import "package:photos/models/file/file_type.dart";
import "package:photos/models/ignored_file.dart";
import "package:photos/models/metadata/collection_magic.dart";
-import "package:photos/models/search/hierarchical/file_type_filter.dart";
import "package:photos/module/download/thumbnail.dart";
import "package:photos/service_locator.dart";
import "package:photos/services/collections_service.dart";
@@ -37,9 +36,6 @@ import "package:photos/ui/viewer/gallery/collection_page.dart";
import "package:photos/ui/viewer/gallery/component/album_cover_app_bar.dart";
import "package:photos/ui/viewer/gallery/gallery_app_bar_widget.dart";
import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";
-import "package:photos/ui/viewer/gallery/state/inherited_search_filter_data.dart";
-import "package:photos/ui/viewer/gallery/state/search_filter_data_provider.dart";
-import "package:photos/ui/viewer/hierarchicial_search/app_bar_filter_chips.dart";
import "package:shared_preferences/shared_preferences.dart";
void main() {
@@ -91,60 +87,6 @@ void main() {
await tempDir.delete(recursive: true);
});
- for (final disableAnimations in [false, true]) {
- testWidgets(
- "fades late album recommendations with reduced motion $disableAnimations",
- (tester) async {
- final provider = SearchFilterDataProvider(
- initialGalleryFilter: FileTypeFilter(
- fileType: FileType.video,
- typeName: "Videos",
- occurrence: 1,
- ),
- );
- await tester.pumpWidget(
- MaterialApp(
- theme: lightThemeData,
- localizationsDelegates: StringsLocalizations.localizationsDelegates,
- supportedLocales: StringsLocalizations.supportedLocales,
- home: MediaQuery(
- data: MediaQueryData(disableAnimations: disableAnimations),
- child: InheritedSearchFilterDataWrapper(
- searchFilterDataProvider: provider,
- child: const Scaffold(
- body: AppBarFilterChips(animateRecommendations: true),
- ),
- ),
- ),
- ),
- );
- provider.clearAndAddRecommendations([
- FileTypeFilter(
- fileType: FileType.image,
- typeName: "Photos",
- occurrence: 1,
- ),
- ]);
- await tester.pump();
- final fade = find
- .descendant(
- of: find.byType(AnimatedOpacity),
- matching: find.byType(FadeTransition),
- )
- .first;
- double opacity() => tester.widget<FadeTransition>(fade).opacity.value;
- expect(opacity(), disableAnimations ? 1 : 0);
- await tester.pump(const Duration(milliseconds: 90));
- if (!disableAnimations) {
- expect(opacity(), inExclusiveRange(0, 1));
- }
- await tester.pumpAndSettle();
- expect(opacity(), 1);
- await tester.pumpWidget(const SizedBox.shrink());
- },
- );
- }
-
testWidgets("uses a pending local photo and excludes ignored photos", (
tester,
) async {
@@ -290,8 +232,6 @@ void main() {
);
await tester.pump();
await tester.pump(const Duration(milliseconds: 75));
- final route = ModalRoute.of(tester.element(find.byType(CollectionPage)))!;
- expect(route, isA<PageRouteBuilder>());
final pageFade = find
.ancestor(
of: find.byType(CollectionPage),
@@ -338,16 +278,6 @@ void main() {
matching: find.byType(Hero),
);
expect(tester.widget<Hero>(headerHero).tag, heroTag);
- final tags = tester
- .widgetList<Hero>(
- find.descendant(
- of: find.byType(CollectionPage),
- matching: find.byType(Hero),
- ),
- )
- .map((hero) => hero.tag)
- .toList();
- expect(tags.toSet().length, tags.length);
collection.pubMagicMetadata = CollectionPubMagicMetadata(asc: true);
Bus.instance.fire(
diff --git a/mobile/apps/photos/test/ui/viewer/gallery/selection_action_sheet_test.dart b/mobile/apps/photos/test/ui/viewer/gallery/selection_action_sheet_test.dart
index cafa0feff6..17b037832e 100644
--- a/mobile/apps/photos/test/ui/viewer/gallery/selection_action_sheet_test.dart
+++ b/mobile/apps/photos/test/ui/viewer/gallery/selection_action_sheet_test.dart
@@ -20,9 +20,6 @@ void main() {
);
final controller = sheet.controller!;
expect(controller.size, sheet.initialChildSize);
- final previewHeight = tester
- .getSize(find.byType(DraggableScrollableSheet))
- .height;
gallery.jumpTo(30);
await tester.pumpAndSettle();
expect(controller.size, sheet.initialChildSize);
@@ -34,10 +31,6 @@ void main() {
await tester.pumpAndSettle();
expect(gallery.offset, greaterThan(0));
expect(controller.size, sheet.minChildSize);
- expect(
- tester.getSize(find.byType(DraggableScrollableSheet)).height,
- lessThan(previewHeight),
- );
await tester.drag(find.byType(CustomScrollView), const Offset(0, -320));
await tester.pumpAndSettle();
expect(controller.size, sheet.maxChildSize);
@@ -238,11 +231,7 @@ Future<void> _pumpSheet(
ListView(
controller: gallery,
children: [
- Container(
- key: const ValueKey("gallery"),
- height: 2000,
- color: Colors.transparent,
- ),
+ Container(height: 2000, color: Colors.transparent),
],
),
SelectionActionSheet(