π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Prune low-value tests
Manav Rathia9e014f26196
diff --git a/mobile/apps/auth/lib/ui/home_page.dart b/mobile/apps/auth/lib/ui/home_page.dartindex 4f24adb81a..b80973132a 100644--- a/mobile/apps/auth/lib/ui/home_page.dart+++ b/mobile/apps/auth/lib/ui/home_page.dart@@ -61,7 +61,6 @@ import 'package:ente_ui/components/buttons/button_widget.dart';import 'package:ente_ui/components/buttons/models/button_type.dart';import 'package:ente_ui/components/loading_widget.dart';import 'package:ente_ui/pages/base_home_page.dart';-import 'package:flutter/foundation.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter/widgets.dart' as widgets;@@ -79,7 +78,6 @@ class HomePage extends BaseHomePage {State<HomePage> createState() => _HomePageState();}-@visibleForTestingString addedCodeFocusSearchQuery(Code code) {return code.issuer.trim().isNotEmpty ? code.issuer : code.account;}diff --git a/mobile/apps/auth/test/ui/code_widget_layout_test.dart b/mobile/apps/auth/test/ui/code_widget_layout_test.dartdeleted file mode 100644index b3f7796901..0000000000--- a/mobile/apps/auth/test/ui/code_widget_layout_test.dart+++ /dev/null@@ -1,24 +0,0 @@-import 'package:ente_auth/ui/code_widget_layout_utils.dart';-import 'package:flutter_test/flutter_test.dart';--void main() {- group('capCodeWidgetTextScaleForIOS', () {- test('caps iOS text scale at 2.0', () {- final value = capCodeWidgetTextScaleForIOS(3.12);-- expect(value, 2.0);- });-- test('preserves iOS text scale exactly at 2.0', () {- final value = capCodeWidgetTextScaleForIOS(2.0);-- expect(value, 2.0);- });-- test('preserves smaller iOS text scales', () {- final value = capCodeWidgetTextScaleForIOS(0.85);-- expect(value, 0.85);- });- });-}diff --git a/mobile/apps/auth/test/ui/home_page_test.dart b/mobile/apps/auth/test/ui/home_page_test.dartdeleted file mode 100644index 9e46cbf4e0..0000000000--- a/mobile/apps/auth/test/ui/home_page_test.dart+++ /dev/null@@ -1,21 +0,0 @@-import 'package:ente_auth/models/code.dart';-import 'package:ente_auth/ui/home_page.dart';-import 'package:flutter_test/flutter_test.dart';--void main() {- test('newly added code focus search prefers issuer', () {- final code = Code.fromOTPAuthUrl(- 'otpauth://totp/[email protected]?secret=ASKZNWOU6SVYAMVS&issuer=GitHub',- );-- expect(addedCodeFocusSearchQuery(code), 'GitHub');- });-- test('newly added code focus search falls back to account', () {- final code = Code.fromOTPAuthUrl(- 'otpauth://totp/[email protected]?secret=ASKZNWOU6SVYAMVS',- );-- expect(addedCodeFocusSearchQuery(code), '[email protected]');- });-}diff --git a/mobile/apps/auth/test/utils/debug_build_flags_test.dart b/mobile/apps/auth/test/utils/debug_build_flags_test.dartdeleted file mode 100644index 481c9875ae..0000000000--- a/mobile/apps/auth/test/utils/debug_build_flags_test.dart+++ /dev/null@@ -1,8 +0,0 @@-import 'package:ente_auth/utils/debug_build_flags.dart';-import 'package:flutter_test/flutter_test.dart';--void main() {- test('screen capture stays disabled without the debug build flag', () {- expect(shouldAllowAuthScreenCapture, isFalse);- });-}diff --git a/mobile/apps/photos/test/module/upload/service/existing_upload_resolver_test.dart b/mobile/apps/photos/test/module/upload/service/existing_upload_resolver_test.dartindex 474d5f7855..88ac3ccdb9 100644--- a/mobile/apps/photos/test/module/upload/service/existing_upload_resolver_test.dart+++ b/mobile/apps/photos/test/module/upload/service/existing_upload_resolver_test.dart@@ -15,34 +15,6 @@ void main() {expect(fixture.calls, isEmpty);});- test("missing owner skips lookup and mapping", () async {- final fixture = _Fixture();-- expect(- await fixture.resolve(_file(localID: "local"), ownerID: null),- isNull,- );- expect(fixture.calls, isEmpty);- });-- test("no hash matches continues uploading", () async {- final fixture = _Fixture();-- expect(await fixture.resolve(_file(localID: "local")), isNull);- expect(fixture.calls, ["find:hash:${FileType.image.index}:10"]);- });-- test("hash lookup failure propagates without side effects", () async {- final fixture = _Fixture()..findError = _Error();-- await expectLater(- fixture.resolve(_file(localID: "local")),- throwsA(isA<_Error>()),- );- expect(fixture.calls, ["find:hash:${FileType.image.index}:10"]);- expect(fixture.events, isEmpty);- });-test("case a deletes pending row before emitting deletion", () async {final existing = _file(localID: "local",@@ -65,25 +37,6 @@ void main() {);});- test(- "case a emits deletion without deleting an absent pending row",- () async {- final existing = _file(- localID: "local",- uploadedFileID: 11,- collectionID: 20,- );- final fixture = _Fixture(existingFiles: [existing]);- final pending = _file(localID: "local");-- expect(await fixture.resolve(pending), same(existing));- expect(fixture.calls, [- "find:hash:${FileType.image.index}:10",- "event:deletedFromEverywhere:sameLocalSameCollection",- ]);- },- );-test("case b updates local ID, deletes pending row, then emits", () async {final existing = _file(uploadedFileID: 12, collectionID: 30);final fixture = _Fixture(existingFiles: [existing]);@@ -124,19 +77,6 @@ void main() {expect(fixture.events, isEmpty);});- test("case d leaves a different local file untouched", () async {- final existing = _file(- localID: "other",- uploadedFileID: 14,- collectionID: 30,- );- final fixture = _Fixture(existingFiles: [existing]);-- expect(await fixture.resolve(_file(localID: "local")), isNull);- expect(fixture.calls, ["find:hash:${FileType.image.index}:10"]);- expect(fixture.events, isEmpty);- });-test("case priority remains a then b then c", () async {final caseC = _file(localID: "local", uploadedFileID: 13, collectionID: 30);final caseB = _file(uploadedFileID: 12, collectionID: 30);@@ -208,26 +148,6 @@ void main() {expect(fixture.events, isEmpty);});- test("event failure propagates after case a deletion", () async {- final existing = _file(- localID: "local",- uploadedFileID: 11,- collectionID: 20,- );- final fixture = _Fixture(existingFiles: [existing])..emitError = _Error();-- await expectLater(- fixture.resolve(_file(localID: "local", generatedID: 7)),- throwsA(isA<_Error>()),- );- expect(fixture.calls, [- "find:hash:${FileType.image.index}:10",- "delete:7",- "event:deletedFromEverywhere:sameLocalSameCollection",- ]);- expect(fixture.events, hasLength(1));- });-test("update failure prevents case b deletion and event", () async {final existing = _file(uploadedFileID: 12, collectionID: 30);final fixture = _Fixture(existingFiles: [existing])..updateError = _Error();@@ -243,25 +163,6 @@ void main() {expect(existing.localID, isNull);expect(fixture.events, isEmpty);});-- test("link failure propagates without resolver event", () async {- final existing = _file(- localID: "local",- uploadedFileID: 13,- collectionID: 30,- );- final fixture = _Fixture(existingFiles: [existing])..linkError = _Error();-- await expectLater(- fixture.resolve(_file(localID: "local")),- throwsA(isA<_Error>()),- );- expect(fixture.calls, [- "find:hash:${FileType.image.index}:10",- "link:20:local:13",- ]);- expect(fixture.events, isEmpty);- });}void _expectDeletionEvent(@@ -294,7 +195,6 @@ class _Fixture {resolver = ExistingUploadResolver(findUploadedFiles: (hash, fileType, ownerID) async {calls.add("find:$hash:${fileType.index}:$ownerID");- if (findError != null) throw findError!;return this.existingFiles;},deleteGeneratedFile: (generatedID) async {@@ -317,13 +217,11 @@ class _Fixture {);linkedLocalFile = localFileToUpload;linkedExistingFile = existingUploadedFile;- if (linkError != null) throw linkError!;return this.linkedFile;},emitLocalPhotosUpdated: (event) {calls.add("event:${event.type.name}:${event.source}");events.add(event);- if (emitError != null) throw emitError!;},);}@@ -340,18 +238,12 @@ class _Fixture {EnteFile? linkedLocalFile;EnteFile? linkedExistingFile;Object? deleteError;- Object? findError;- Object? emitError;Object? updateError;- Object? linkError;- Future<EnteFile?> resolve(- EnteFile pending, {- int? ownerID = defaultOwnerID,- }) => resolver.resolve(+ Future<EnteFile?> resolve(EnteFile pending) => resolver.resolve(fileHash: fileHash,fileToUpload: pending,targetCollectionID: targetCollectionID,- ownerID: ownerID,+ ownerID: defaultOwnerID,);}diff --git a/mobile/apps/photos/test/ui/payment/subscription_toggle_test.dart b/mobile/apps/photos/test/ui/payment/subscription_toggle_test.dartindex a186a810b4..aaaf16c052 100644--- a/mobile/apps/photos/test/ui/payment/subscription_toggle_test.dart+++ b/mobile/apps/photos/test/ui/payment/subscription_toggle_test.dart@@ -1,10 +1,7 @@-import "package:ente_components/theme/colors.dart" show ComponentApp;-import "package:ente_components/theme/theme.dart" show ComponentTheme;import "package:flutter/material.dart";import "package:flutter_test/flutter_test.dart";import "package:photos/ente_theme_data.dart";import "package:ente_strings/ente_strings.dart";-import "package:photos/theme/text_style.dart" as ente_text;import "package:photos/ui/payment/subscription_common_widgets.dart";void main() {@@ -43,48 +40,6 @@ void main() {);expect(togglePosition.left, 0);});-- testWidgets("uses readable inactive text color in light theme", (- tester,- ) async {- await tester.pumpWidget(- _buildTestApp(- const SubscriptionToggle(isYearly: true, onToggle: _noopToggle),- theme: lightThemeData,- ),- );-- final monthlyLabel = tester.widget<Text>(find.text("Monthly"));- expect(- monthlyLabel.style?.color,- ente_text.lightTextTheme.bodyMuted.color,- );- });-- testWidgets("uses Figma selected pill color in light theme", (- tester,- ) async {- await tester.pumpWidget(- _buildTestApp(- const SubscriptionToggle(isYearly: true, onToggle: _noopToggle),- theme: lightThemeData,- ),- );-- final selectedPill = tester.widget<Container>(- find- .ancestor(- of: find.text("Yearly").last,- matching: find.byType(Container),- )- .first,- );- final decoration = selectedPill.decoration! as BoxDecoration;- expect(- decoration.color,- ComponentTheme.colorsForApp(ComponentApp.photos).fillLight,- );- });});}diff --git a/mobile/apps/photos/test/ui/viewer/file/zoomable_live_image_new_test.dart b/mobile/apps/photos/test/ui/viewer/file/zoomable_live_image_new_test.dartdeleted file mode 100644index 51de3f9db6..0000000000--- a/mobile/apps/photos/test/ui/viewer/file/zoomable_live_image_new_test.dart+++ /dev/null@@ -1,30 +0,0 @@-import "package:flutter/material.dart";-import "package:flutter_test/flutter_test.dart";-import "package:mockito/mockito.dart";-import "package:photos/models/file/file.dart";-import "package:photos/models/file/file_type.dart";-import "package:photos/ui/viewer/file/file_widget.dart";-import "package:photos/ui/viewer/file/zoomable_live_image_new.dart";--void main() {- test("FileWidget forwards still-photo long presses", () {- final file = EnteFile()- ..generatedID = 1- ..fileType = FileType.image;- void onTextSelectionStart(LongPressStartDetails _) {}-- final built = FileWidget(- file,- tagPrefix: "test",- onTextSelectionStart: onTextSelectionStart,- ).build(_MockBuildContext());-- expect(built, isA<ZoomableLiveImageNew>());- expect(- (built as ZoomableLiveImageNew).onTextSelectionStart,- same(onTextSelectionStart),- );- });-}--class _MockBuildContext extends Mock implements BuildContext {}diff --git a/mobile/packages/ente_components/example/test/smoke_test.dart b/mobile/packages/ente_components/example/test/smoke_test.dartdeleted file mode 100644index 066b8423cf..0000000000--- a/mobile/packages/ente_components/example/test/smoke_test.dart+++ /dev/null@@ -1,72 +0,0 @@-import 'package:ente_components/ente_components.dart' show ComponentTheme;-import 'package:ente_components_catalog/main.dart';-import 'package:flutter/material.dart';-import 'package:flutter_test/flutter_test.dart';--void main() {- testWidgets('catalog app mounts', (tester) async {- await tester.pumpWidget(const ComponentsCatalogApp());-- expect(find.text('Components'), findsOneWidget);- });-- testWidgets('catalog header theme button toggles theme mode', (tester) async {- await tester.pumpWidget(const ComponentsCatalogApp());-- expect(find.byTooltip('Theme: Light. Tap for Dark'), findsOneWidget);-- await tester.tap(find.byTooltip('Theme: Light. Tap for Dark'));- await tester.pump();-- expect(find.byTooltip('Theme: Dark. Tap for Light'), findsOneWidget);- });-- testWidgets('banner catalog shows all Figma states', (tester) async {- await tester.pumpWidget(const ComponentsCatalogApp());-- await tester.tap(find.byKey(const ValueKey('catalog-section-Banner')));- await tester.pump();- await tester.pump(const Duration(milliseconds: 350));-- expect(find.text('Failure!'), findsOneWidget);- expect(find.text('Informative!'), findsOneWidget);- expect(find.text('Success!'), findsOneWidget);- expect(find.text('Warning!'), findsOneWidget);- expect(find.text('Neutral!'), findsOneWidget);- expect(find.text('Syncing backup'), findsOneWidget);- });-- testWidgets('button transition preview surfaces loading and success', (- tester,- ) async {- await tester.pumpWidget(- MaterialApp(- theme: ComponentTheme.lightTheme(),- home: const Scaffold(body: ButtonStateCyclePreview()),- ),- );-- final button = find.byKey(const ValueKey('button-cycle'));- expect(button, findsOneWidget);- expect(find.text('Continue'), findsOneWidget);-- await tester.tap(button);- await tester.pump(const Duration(milliseconds: 299));-- expect(find.byKey(const ValueKey('loading')), findsNothing);-- await tester.pump(const Duration(milliseconds: 1));-- expect(find.byKey(const ValueKey('loading')), findsOneWidget);-- await tester.pump(const Duration(milliseconds: 900));- await tester.pump();-- expect(find.byKey(const ValueKey('success')), findsOneWidget);-- await tester.pump(const Duration(seconds: 2));- await tester.pumpAndSettle();-- expect(find.text('Continue'), findsOneWidget);- });-}diff --git a/mobile/packages/ente_components/test/components/app_surface_widgets_test.dart b/mobile/packages/ente_components/test/components/app_surface_widgets_test.dartindex 5f627d55e0..a27d58391b 100644--- a/mobile/packages/ente_components/test/components/app_surface_widgets_test.dart+++ b/mobile/packages/ente_components/test/components/app_surface_widgets_test.dart@@ -3,10 +3,8 @@ import 'dart:ui';import 'package:ente_components/components/app_bar_component.dart';import 'package:ente_components/components/menu_component.dart';-import 'package:ente_components/components/menu_group_component.dart';import 'package:ente_components/components/tooltip_component.dart';import 'package:ente_components/theme/colors.dart';-import 'package:ente_components/theme/icon_sizes.dart';import 'package:ente_components/theme/text_styles.dart';import 'package:ente_components/theme/theme.dart';import 'package:flutter/material.dart';@@ -37,71 +35,6 @@ Future<void> pumpComponent(}void main() {- testWidgets('MenuComponent renders slots, states, and handles taps', (- tester,- ) async {- var tapped = false;-- await pumpComponent(- tester,- MenuComponent(- title: 'Camera uploads',- subtitle: 'Enabled on Wi-Fi',- leading: const Icon(Icons.cloud_upload_outlined),- trailing: Icon(- Icons.chevron_right,- color: ColorTokens.light.textLight,- size: IconSizes.small,- ),- selected: true,- titleColor: ColorTokens.light.warning,- subtitleColor: ColorTokens.light.primary,- titleBold: true,- iconColor: ColorTokens.light.primary,- onTap: () async => tapped = true,- ),- );-- expect(find.text('Camera uploads'), findsOneWidget);- expect(find.text('Enabled on Wi-Fi'), findsOneWidget);- expect(find.byIcon(Icons.cloud_upload_outlined), findsOneWidget);- expect(find.byIcon(Icons.chevron_right), findsOneWidget);- expect(tester.getSize(find.byType(MenuComponent)).height, 60);- final surface = tester.widget<AnimatedContainer>(- find.byKey(const ValueKey('menu-item-surface')),- );- final decoration = surface.decoration! as BoxDecoration;- expect(decoration.border, isNotNull);- expect(tester.widget<Text>(find.text('Camera uploads')).maxLines, 2);- expect(tester.widget<Text>(find.text('Enabled on Wi-Fi')).maxLines, 2);- expect(- tester.widget<Text>(find.text('Camera uploads')).style?.color,- ColorTokens.light.warning,- );- expect(- tester.widget<Text>(find.text('Camera uploads')).style?.fontWeight,- TextStyles.bodyBold.fontWeight,- );- expect(- tester.widget<Text>(find.text('Enabled on Wi-Fi')).style?.color,- ColorTokens.light.primary,- );- expect(- IconTheme.of(- tester.element(find.byIcon(Icons.cloud_upload_outlined)),- ).color,- ColorTokens.light.primary,- );- expect(- tester.widget<Icon>(find.byIcon(Icons.chevron_right)).color,- ColorTokens.light.textLight,- );-- await tester.tap(find.text('Camera uploads'));- await tester.pump();- expect(tapped, isTrue);- });-testWidgets('MenuComponent delays loading, blocks repeat taps, and shows success',(tester) async {@@ -259,284 +192,6 @@ void main() {expect(find.byKey(const ValueKey('menu-item-success')), findsNothing);});- testWidgets('MenuComponent can disable gestures for display-only rows', (- tester,- ) async {- var tapCount = 0;-- await pumpComponent(- tester,- MenuComponent(- title: 'Storage plan',- isDisabled: true,- onTap: () {- tapCount += 1;- },- ),- );-- await tester.tap(find.text('Storage plan'));- await tester.pump();- expect(tapCount, 0);- });-- testWidgets('MenuComponent handles double tap gestures', (tester) async {- var doubleTapCount = 0;-- await pumpComponent(- tester,- MenuComponent(- title: 'Verify email',- onDoubleTap: () => doubleTapCount += 1,- ),- );-- await tester.tap(find.text('Verify email'));- await tester.pump(const Duration(milliseconds: 50));- await tester.tap(find.text('Verify email'));- await tester.pump(const Duration(milliseconds: 100));-- expect(doubleTapCount, 1);- });-- testWidgets('MenuComponent handles long press gestures', (tester) async {- var longPressCount = 0;-- await pumpComponent(- tester,- MenuComponent(- title: 'Share logs',- onLongPress: () => longPressCount += 1,- ),- );-- await tester.longPress(find.text('Share logs'));- await tester.pump();-- expect(longPressCount, 1);- });-- testWidgets('MenuComponent disables double tap and long press gestures', (- tester,- ) async {- var doubleTapCount = 0;- var longPressCount = 0;-- await pumpComponent(- tester,- MenuComponent(- title: 'Disabled row',- isDisabled: true,- onDoubleTap: () => doubleTapCount += 1,- onLongPress: () => longPressCount += 1,- ),- );-- await tester.tap(find.text('Disabled row'));- await tester.pump(const Duration(milliseconds: 50));- await tester.tap(find.text('Disabled row'));- await tester.pump();- await tester.longPress(find.text('Disabled row'));- await tester.pump();-- expect(doubleTapCount, 0);- expect(longPressCount, 0);- });-- testWidgets('MenuGroupComponent shapes a list of menu items', (tester) async {- var tapped = false;- var disabledTapped = false;-- await pumpComponent(- tester,- MenuGroupComponent(- backgroundColor: Colors.orange,- items: [- MenuComponent(- title: 'Account',- leading: const Icon(Icons.person_outline),- selected: true,- titleColor: ColorTokens.light.warning,- trailing: const Icon(Icons.chevron_right),- onTap: () => tapped = true,- ),- MenuComponent(- title: 'Security',- leading: const Icon(Icons.lock_outline),- isDisabled: true,- onTap: () => disabledTapped = true,- ),- const MenuComponent(- title: 'Appearance',- leading: Icon(Icons.palette_outlined),- ),- ],- ),- height: 180,- );-- expect(find.text('Account'), findsOneWidget);- expect(find.text('Security'), findsOneWidget);- expect(find.text('Appearance'), findsOneWidget);- expect(find.byIcon(Icons.chevron_right), findsOneWidget);- expect(- tester.widget<Text>(find.text('Account')).style?.color,- ColorTokens.light.warning,- );-- final groupSurface = tester.widget<Container>(- find.byKey(const ValueKey('menu-group-surface')),- );- final groupDecoration = groupSurface.decoration! as BoxDecoration;- expect(- groupDecoration.borderRadius,- const BorderRadius.all(Radius.circular(20)),- );-- final itemSurfaces = tester.widgetList<AnimatedContainer>(- find.byKey(const ValueKey('menu-item-surface')),- );- final itemRadii = itemSurfaces- .map((surface) => (surface.decoration! as BoxDecoration).borderRadius)- .toList();- final itemColors = itemSurfaces- .map((surface) => (surface.decoration! as BoxDecoration).color)- .toList();-- expect(itemRadii[0], const BorderRadius.vertical(top: Radius.circular(20)));- expect(itemRadii[1], BorderRadius.zero);- expect(- itemRadii[2],- const BorderRadius.vertical(bottom: Radius.circular(20)),- );- expect(itemColors, everyElement(Colors.orange));-- await tester.tap(find.text('Account'));- await tester.tap(find.text('Security'));- await tester.pump();-- expect(tapped, isTrue);- expect(disabledTapped, isFalse);- });-- testWidgets('MenuComponent supports pressed and execution visuals', (- tester,- ) async {- final loadingCompleter = Completer<void>();- var tapCount = 0;- await pumpComponent(- tester,- Column(- children: [- MenuComponent(- title: 'Pressed row',- onTap: () {- tapCount += 1;- },- ),- MenuComponent(- title: 'Loading row',- trailing: const Icon(Icons.chevron_right),- showOnlyLoadingState: true,- shouldSurfaceExecutionStates: true,- onTap: () => loadingCompleter.future,- ),- MenuComponent(- title: 'Success row',- trailing: const Icon(Icons.chevron_right),- shouldSurfaceExecutionStates: true,- shouldShowSuccessConfirmation: true,- onTap: () async {},- ),- ],- ),- height: 180,- );-- await tester.press(find.text('Pressed row'));- await tester.pump();- await tester.tap(find.text('Loading row'));- await tester.pump(const Duration(milliseconds: 300));- await tester.tap(find.text('Success row'));- await tester.pump();- await tester.pump(const Duration(milliseconds: 200));-- final surfaces = tester.widgetList<AnimatedContainer>(- find.byKey(const ValueKey('menu-item-surface')),- );- final pressedDecoration = surfaces.first.decoration! as BoxDecoration;- expect(pressedDecoration.color, ColorTokens.light.fillDarker);- expect(find.byKey(const ValueKey('menu-item-loading')), findsOneWidget);- expect(find.byKey(const ValueKey('menu-item-success')), findsOneWidget);- expect(find.byIcon(Icons.chevron_right), findsNothing);- expect(tapCount, 0);- loadingCompleter.complete();- await tester.pump();- await tester.pump(const Duration(seconds: 1));- await tester.pump(const Duration(milliseconds: 200));- });-- testWidgets('MenuComponent allows two subtitle lines for one-line titles', (- tester,- ) async {- const subtitle =- 'This subtitle can use two lines when the title fits on one line';-- await pumpComponent(- tester,- const MenuComponent(- title: 'Camera uploads',- subtitle: subtitle,- leading: Icon(Icons.image_outlined),- trailing: Icon(Icons.chevron_right),- ),- width: 320,- );-- expect(tester.widget<Text>(find.text('Camera uploads')).maxLines, 2);- expect(tester.widget<Text>(find.text(subtitle)).maxLines, 2);- expect(tester.getSize(find.byType(MenuComponent)).height, greaterThan(60));- });-- testWidgets('MenuComponent long text uses two title lines and one subtitle line', (- tester,- ) async {- await pumpComponent(- tester,- const MenuComponent(- title:- 'Camera uploads from this device and shared albums waiting for review',- subtitle:- 'This subtitle remains one line and truncates like app menu rows',- leading: Icon(Icons.image_outlined),- trailing: Icon(Icons.chevron_right),- ),- width: 260,- );-- expect(- tester- .widget<Text>(- find.text(- 'Camera uploads from this device and shared albums waiting for review',- ),- )- .maxLines,- 2,- );- expect(- tester- .widget<Text>(- find.text(- 'This subtitle remains one line and truncates like app menu rows',- ),- )- .maxLines,- 1,- );- expect(tester.getSize(find.byType(MenuComponent)).height, greaterThan(60));- });-testWidgets('SliverAppBarComponent scrolls without narrow width overflow', (tester,) async {@@ -743,35 +398,6 @@ void main() {expect(tester.takeException(), isNull);});- testWidgets('SliverAppBarComponent can disable tap tooltip title reveal', (- tester,- ) async {- await pumpComponent(- tester,- CustomScrollView(- slivers: [- const SliverAppBarComponent(- title: 'Aman',- disableTitleTapReveal: true,- actions: [Icon(Icons.search)],- ),- SliverList.builder(- itemCount: 8,- itemBuilder: (context, index) {- return SizedBox(height: 60, child: Text('Item $index'));- },- ),- ],- ),- width: 320,- height: 360,- );-- expect(find.byType(TooltipComponent), findsNothing);- expect(find.byType(TooltipBubbleComponent), findsNothing);- expect(tester.takeException(), isNull);- });-testWidgets('SliverAppBarComponent preserves title callbacks with eyebrow', (tester,) async {@@ -808,24 +434,6 @@ void main() {expect(tester.takeException(), isNull);});- testWidgets('TooltipBubbleComponent renders top pointer bubble', (- tester,- ) async {- await pumpComponent(- tester,- const TooltipBubbleComponent(message: 'Tooltip text'),- width: 390,- height: 200,- );-- expect(find.byType(TooltipBubbleComponent), findsOneWidget);- final tooltipText = tester.widget<Text>(find.text('Tooltip text'));- expect(tooltipText.style?.fontSize, 12);- expect(tooltipText.style?.fontWeight, FontWeight.w500);- expect(tooltipText.style?.height, 16 / 12);- expect(tester.takeException(), isNull);- });-testWidgets('SliverAppBarComponent collapses title content and reserved space',(tester) async {diff --git a/mobile/packages/ente_components/test/components/avatar_test.dart b/mobile/packages/ente_components/test/components/avatar_test.dartindex 5ea15c55ac..d5f9e93b0b 100644--- a/mobile/packages/ente_components/test/components/avatar_test.dart+++ b/mobile/packages/ente_components/test/components/avatar_test.dart@@ -1,8 +1,4 @@-import 'dart:convert';-import 'dart:typed_data';-import 'package:ente_components/ente_components.dart';-import 'package:flutter/material.dart';import 'package:flutter_test/flutter_test.dart';void main() {@@ -39,99 +35,4 @@ void main() {expect(avatarInitials(' '), '?');},);-- testWidgets('AvatarComponent renders the Figma sizes', (tester) async {- await tester.pumpWidget(- _wrap(- const Column(- children: [- AvatarComponent(initials: 'E', size: AvatarComponentSize.xs),- AvatarComponent(initials: 'E', size: AvatarComponentSize.small),- AvatarComponent(initials: 'E'),- AvatarComponent(initials: 'E', size: AvatarComponentSize.medium),- AvatarComponent(initials: 'E', size: AvatarComponentSize.large),- AvatarComponent(- initials: 'E',- size: AvatarComponentSize.contactHuge,- ),- ],- ),- ),- );-- final surfaces = find.byKey(const ValueKey('avatar-surface'));- expect(tester.getSize(surfaces.at(0)), const Size(16, 16));- expect(tester.getSize(surfaces.at(1)), const Size(20, 20));- expect(tester.getSize(surfaces.at(2)), const Size(24, 24));- expect(tester.getSize(surfaces.at(3)), const Size(28, 28));- expect(tester.getSize(surfaces.at(4)), const Size(32, 32));- expect(tester.getSize(surfaces.at(5)), const Size(56, 56));- for (final text in tester.widgetList<Text>(find.text('E'))) {- expect(text.style?.fontFamily, TextStyles.body.fontFamily);- }- });-- testWidgets(- 'AvatarComponent supports image, icon, named colors, and seed colors',- (tester) async {- await tester.pumpWidget(- _wrap(- Column(- children: [- AvatarComponent.image(image: MemoryImage(_transparentPng)),- const AvatarComponent.icon(),- const AvatarComponent(- initials: 'K',- color: AvatarComponentColor.green,- ),- const AvatarComponent(- initials: 'C',- color: AvatarComponentColor.cyan,- ),- const AvatarComponent.seeded(initials: 'A', seed: 0),- ],- ),- ),- );-- expect(find.byIcon(Icons.add_rounded), findsOneWidget);- expect(find.text('K'), findsOneWidget);- expect(find.text('C'), findsOneWidget);- expect(find.text('A'), findsOneWidget);- expect(avatarLight.length, avatarDark.length);-- final cyanAvatar = tester.widget<DecoratedBox>(- find- .ancestor(of: find.text('C'), matching: find.byType(DecoratedBox))- .first,- );- expect((cyanAvatar.decoration as BoxDecoration).color, avatarCyan);- },- );-- testWidgets('AvatarComponent renders at most two supplied initials', (- tester,- ) async {- final semantics = tester.ensureSemantics();- await tester.pumpWidget(_wrap(const AvatarComponent(initials: 'SJK')));-- expect(find.text('SJ'), findsOneWidget);- expect(find.text('SJK'), findsNothing);- expect(- tester.getSemantics(find.byType(AvatarComponent)).label,- contains('AvatarComponent SJ'),- );- semantics.dispose();- });}--Widget _wrap(Widget child) {- return MaterialApp(- theme: ComponentTheme.lightTheme(),- home: Scaffold(body: Center(child: child)),- );-}--final Uint8List _transparentPng = base64Decode(- 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+/p9sAAAAASUVORK5CYII=',-);diff --git a/mobile/packages/ente_components/test/components/banner_component_test.dart b/mobile/packages/ente_components/test/components/banner_component_test.dartdeleted file mode 100644index 5d3c16a8d2..0000000000--- a/mobile/packages/ente_components/test/components/banner_component_test.dart+++ /dev/null@@ -1,223 +0,0 @@-import "package:ente_components/ente_components.dart";-import "package:flutter/material.dart";-import "package:flutter_test/flutter_test.dart";-import "package:hugeicons/hugeicons.dart";--void main() {- testWidgets("BannerComponent renders copy and handles taps", (tester) async {- var tapCount = 0;-- await tester.pumpWidget(- _wrap(- BannerComponent(- title: "Subscribe",- subtitle: "Your subscription has expired",- state: BannerComponentState.failure,- trailingWidget: const Icon(Icons.arrow_forward),- onTap: () => tapCount += 1,- ),- ),- );-- expect(find.text("Subscribe"), findsOneWidget);- expect(find.text("Your subscription has expired"), findsOneWidget);- expect(find.byType(HugeIcon), findsOneWidget);- expect(find.byIcon(Icons.arrow_forward), findsOneWidget);-- final size = tester.getSize(- find.byKey(const ValueKey("banner-component-surface")),- );- expect(size.width, 351);- expect(size.height, greaterThanOrEqualTo(BannerComponent.minHeight));-- await tester.tap(find.text("Subscribe"));- await tester.pump();-- expect(tapCount, 1);- });-- testWidgets("BannerComponent supports no-subtitle banners", (tester) async {- await tester.pumpWidget(- _wrap(- BannerComponent(- leadingIcon: HugeIcons.strokeRoundedAlertCircle,- title: "Confirm your recovery key",- onTap: () {},- ),- ),- );-- final title = tester.widget<Text>(find.text("Confirm your recovery key"));- expect(title.maxLines, 2);- expect(title.overflow, TextOverflow.ellipsis);- expect(find.byIcon(Icons.arrow_forward), findsNothing);- expect(- find.byKey(const ValueKey("banner-component-trailing-slot")),- findsNothing,- );- });-- testWidgets("BannerComponent maps state colors from component tokens", (- tester,- ) async {- await _expectTitleColor(- tester,- state: BannerComponentState.failure,- title: "Failure",- expectedColor: ComponentTheme.colorsForApp(ComponentApp.photos).warning,- );- await _expectTitleColor(- tester,- state: BannerComponentState.informative,- title: "Informative",- expectedColor: ComponentTheme.colorsForApp(ComponentApp.photos).blue,- );- await _expectTitleColor(- tester,- state: BannerComponentState.success,- title: "Success",- expectedColor: ComponentTheme.colorsForApp(- ComponentApp.photos,- ).primaryDark,- );- await _expectTitleColor(- tester,- state: BannerComponentState.warning,- title: "Warning",- expectedColor: ComponentTheme.colorsForApp(ComponentApp.photos).caution,- );- await _expectTitleColor(- tester,- state: BannerComponentState.neutral,- title: "Neutral",- expectedColor: ComponentTheme.colorsForApp(ComponentApp.photos).textBase,- );- });-- testWidgets("BannerComponent uses component surface styling", (tester) async {- await tester.pumpWidget(- _wrap(- BannerComponent(- leadingIcon: HugeIcons.strokeRoundedDatabase,- title: "Upgrade",- subtitle: "Storage limit exceeded",- state: BannerComponentState.failure,- onTap: () {},- ),- brightness: Brightness.dark,- ),- );-- final surface = tester.widget<DecoratedBox>(- find.byKey(const ValueKey("banner-component-surface")),- );- final decoration = surface.decoration as BoxDecoration;- final colors = ComponentTheme.colorsForApp(- ComponentApp.photos,- brightness: Brightness.dark,- );-- expect(decoration.color, colors.fillLight);- expect(decoration.borderRadius, BorderRadius.circular(Radii.button));- expect(decoration.boxShadow, isNull);- });-- testWidgets("BannerComponent supports a custom trailing widget", (- tester,- ) async {- await tester.pumpWidget(- _wrap(- BannerComponent(- title: "Informative",- subtitle: "Custom trailing affordance",- state: BannerComponentState.informative,- trailingWidget: const SizedBox(- key: ValueKey("custom-trailing"),- width: 24,- height: 24,- child: HugeIcon(icon: HugeIcons.strokeRoundedCancel01),- ),- onTap: () {},- ),- ),- );-- expect(find.byKey(const ValueKey("custom-trailing")), findsOneWidget);- final trailingSlotSize = tester.getSize(- find.byKey(const ValueKey("banner-component-trailing-slot")),- );- expect(trailingSlotSize.width, BannerComponent.actionSize);- expect(trailingSlotSize.height, BannerComponent.actionSize);- expect(- find.descendant(- of: find.byKey(const ValueKey("custom-trailing")),- matching: find.byType(HugeIcon),- ),- findsOneWidget,- );- expect(find.byType(HugeIcon), findsNWidgets(2));- expect(find.byIcon(Icons.arrow_forward), findsNothing);- });-- testWidgets("BannerComponent supports a custom leading widget", (- tester,- ) async {- await tester.pumpWidget(- _wrap(- BannerComponent(- leadingIcon: HugeIcons.strokeRoundedInformationCircle,- leadingWidget: const SizedBox(- key: ValueKey("custom-leading"),- width: 16,- height: 16,- child: CircularProgressIndicator(strokeWidth: 2),- ),- title: "Syncing",- subtitle: "Preparing secure upload",- state: BannerComponentState.informative,- trailingWidget: const Icon(Icons.arrow_forward),- onTap: () {},- ),- ),- );-- expect(find.byKey(const ValueKey("custom-leading")), findsOneWidget);- expect(find.byType(CircularProgressIndicator), findsOneWidget);- expect(find.byType(HugeIcon), findsNothing);- expect(find.byIcon(Icons.arrow_forward), findsOneWidget);- });-}--Future<void> _expectTitleColor(- WidgetTester tester, {- required BannerComponentState state,- required String title,- required Color expectedColor,-}) async {- await tester.pumpWidget(- _wrap(- BannerComponent(- leadingIcon: HugeIcons.strokeRoundedInformationCircle,- title: title,- state: state,- onTap: () {},- ),- ),- );-- final text = tester.widget<Text>(find.text(title));- expect(text.style?.color, expectedColor);-}--Widget _wrap(Widget child, {Brightness brightness = Brightness.light}) {- return MaterialApp(- themeAnimationDuration: Duration.zero,- theme: ComponentTheme.themeForApp(- ComponentApp.photos,- brightness: brightness,- ),- home: Scaffold(- body: Center(child: SizedBox(width: 351, child: child)),- ),- );-}diff --git a/mobile/packages/ente_components/test/components/bottom_sheet_component_test.dart b/mobile/packages/ente_components/test/components/bottom_sheet_component_test.dartindex 51d41f88fb..ebf89a1026 100644--- a/mobile/packages/ente_components/test/components/bottom_sheet_component_test.dart+++ b/mobile/packages/ente_components/test/components/bottom_sheet_component_test.dart@@ -5,82 +5,6 @@ import 'package:flutter/material.dart';import 'package:flutter_test/flutter_test.dart';void main() {- testWidgets('BottomSheetComponent renders title and close action', (- tester,- ) async {- var closeCount = 0;-- await tester.pumpWidget(- _wrap(- BottomSheetComponent(- title: 'Title',- content: const Text('Body copy'),- onClose: () => closeCount += 1,- ),- ),- );-- expect(find.text('Title'), findsOneWidget);- expect(find.text('Body copy'), findsOneWidget);- expect(find.byTooltip('Close'), findsOneWidget);-- await tester.tap(find.byTooltip('Close'));- await tester.pump();-- expect(closeCount, 1);- });-- testWidgets('BottomSheetComponent renders custom content and actions', (- tester,- ) async {- await tester.pumpWidget(- _wrap(- const BottomSheetComponent(- title: 'Title',- content: Text('Body copy'),- actions: [- ButtonComponent(label: 'Primary'),- ButtonComponent(- label: 'Secondary',- variant: ButtonComponentVariant.secondary,- ),- ],- ),- ),- );-- expect(find.text('Title'), findsOneWidget);- expect(find.text('Body copy'), findsOneWidget);- expect(find.text('Primary'), findsOneWidget);- expect(find.text('Secondary'), findsOneWidget);- });-- testWidgets('BottomSheetComponent respects explicit action spacing', (- tester,- ) async {- await tester.pumpWidget(- _wrap(- const BottomSheetComponent(- title: 'Title',- message: 'Centered message',- actionsTopSpacing: 7,- actions: [- ButtonComponent(key: ValueKey('action-button'), label: 'Action'),- ],- ),- ),- );-- final messageBottom = tester- .getBottomLeft(find.text('Centered message'))- .dy;- final actionTop = tester- .getTopLeft(find.byKey(const ValueKey('action-button')))- .dy;-- expect(actionTop - messageBottom, 7);- });-testWidgets('BottomSheetComponent dismisses from close button by default', (tester,) async {@@ -215,54 +139,6 @@ void main() {expect(find.text('New route'), findsOneWidget);});- testWidgets('showErrorBottomSheetComponent presents error content', (- tester,- ) async {- var closeCount = 0;-- await _pumpLauncher(- tester,- (context) => showErrorBottomSheetComponent<void>(- context: context,- message: 'Something went wrong.',- onClose: () => closeCount += 1,- actionLabel: 'Contact support',- ),- label: 'Show error',- );-- await _openLauncher(tester, label: 'Show error');-- expect(find.text('Error'), findsOneWidget);- expect(find.text('Something went wrong.'), findsOneWidget);- expect(find.text('Contact support'), findsOneWidget);-- await tester.tap(find.byTooltip('Close'));- await tester.pumpAndSettle();-- expect(closeCount, 1);- expect(find.text('Error'), findsNothing);- });-- testWidgets('showErrorBottomSheetComponent can hide close button', (- tester,- ) async {- await _pumpLauncher(- tester,- (context) => showErrorBottomSheetComponent<void>(- context: context,- message: 'Something went wrong.',- showCloseButton: false,- ),- label: 'Show error',- );-- await _openLauncher(tester, label: 'Show error');-- expect(find.text('Error'), findsOneWidget);- expect(find.byTooltip('Close'), findsNothing);- });-testWidgets('BottomSheetComponent applies keyboard inset padding', (tester,) async {@@ -287,52 +163,6 @@ void main() {);expect(animatedPadding.padding, const EdgeInsets.only(bottom: 120));});-- testWidgets('BottomSheetComponent passes initial scrollable size', (- tester,- ) async {- await tester.pumpWidget(- _wrap(- const BottomSheetComponent(- content: SizedBox(key: ValueKey('scrollable-content')),- isScrollable: true,- initialChildSize: 0.7,- ),- ),- );- final sheet = tester.widget<DraggableScrollableSheet>(- find.byType(DraggableScrollableSheet),- );- expect(sheet.initialChildSize, 0.7);- });-- testWidgets('BottomSheetComponent keeps default layout non-scrollable', (- tester,- ) async {- await tester.pumpWidget(- _wrap(- const BottomSheetComponent(- content: SizedBox(key: ValueKey('plain-content')),- initialChildSize: 0.7,- ),- ),- );- expect(find.byType(DraggableScrollableSheet), findsNothing);- expect(find.byType(Padding), findsWidgets);- expect(find.byKey(const ValueKey('plain-content')), findsOneWidget);- });-}--Widget _wrap(Widget child) {- return MaterialApp(- theme: ComponentTheme.lightTheme(),- home: Scaffold(- body: Align(- alignment: Alignment.topLeft,- child: SizedBox(width: 375, child: child),- ),- ),- );}Future<void> _pumpLauncher<T>(diff --git a/mobile/packages/ente_components/test/components/button_test.dart b/mobile/packages/ente_components/test/components/button_test.dartindex 6374d61bc9..c9028b7822 100644--- a/mobile/packages/ente_components/test/components/button_test.dart+++ b/mobile/packages/ente_components/test/components/button_test.dart@@ -1,5 +1,4 @@import "dart:async";-import "dart:ui";import "package:ente_components/ente_components.dart";import "package:flutter/material.dart";@@ -7,83 +6,6 @@ import "package:flutter_test/flutter_test.dart";import "package:hugeicons/hugeicons.dart";void main() {- testWidgets("ButtonComponent renders label and expected size", (- tester,- ) async {- await tester.pumpWidget(- _wrap(ButtonComponent(label: "Continue", onTap: () {})),- );-- expect(find.text("Continue"), findsOneWidget);- expect(tester.getSize(find.byType(AnimatedContainer)).height, 52);- });-- testWidgets("Compact ButtonComponent uses 48px geometry and body type", (- tester,- ) async {- await tester.pumpWidget(- _wrap(- ButtonComponent(- label: "Save",- density: ButtonComponentDensity.compact,- onTap: () {},- ),- ),- );-- expect(tester.getSize(find.byType(AnimatedContainer)).height, 48);- final style = tester.widget<Text>(find.text("Save")).style!;- expect(style.fontWeight, TextStyles.body.fontWeight);- expect(style.fontSize, TextStyles.body.fontSize);- });-- testWidgets("ButtonComponent calls onTap when tapped", (tester) async {- var tapCount = 0;-- await tester.pumpWidget(- _wrap(ButtonComponent(label: "Save", onTap: () => tapCount += 1)),- );-- await tester.tap(find.text("Save"));- await tester.pump();-- expect(tapCount, 1);- });-- testWidgets("ButtonComponent renders leading content", (tester) async {- await tester.pumpWidget(- _wrap(- ButtonComponent(- label: "Share",- leading: const Icon(Icons.share_outlined),- onTap: () {},- ),- ),- );-- expect(find.text("Share"), findsOneWidget);- expect(find.byIcon(Icons.share_outlined), findsOneWidget);- });-- testWidgets(- "Small ButtonComponent shrink-wraps content without a minimum width",- (tester) async {- await tester.pumpWidget(- _wrap(- ButtonComponent(- label: "OK",- size: ButtonComponentSize.small,- onTap: () {},- ),- ),- );-- final size = tester.getSize(find.byType(AnimatedContainer));- expect(size.height, 52);- expect(size.width, lessThan(100));- },- );-testWidgets("ButtonComponent surfaces loading after debounce and blocks repeat taps",(tester) async {@@ -402,273 +324,6 @@ void main() {expect(find.text("Fail"), findsOneWidget);});- testWidgets(- "ButtonComponent remains disabled when onTap is null or disabled",- (tester) async {- var tapCount = 0;-- await tester.pumpWidget(- _wrap(- Column(- children: [- const ButtonComponent(label: "No callback", onTap: null),- ButtonComponent(- label: "Disabled",- isDisabled: true,- onTap: () => tapCount += 1,- ),- ],- ),- ),- );-- expect(find.text("No callback"), findsOneWidget);- expect(find.text("Disabled"), findsOneWidget);- expect(- _buttonContainerColor(tester, "Disabled"),- ColorTokens.light.fillDark,- );- expect(_textColor(tester, "No callback"), ColorTokens.light.textLightest);- expect(_textColor(tester, "Disabled"), ColorTokens.light.textLightest);- await tester.tap(find.text("Disabled"));- await tester.pump();-- expect(tapCount, 0);- },- );-- testWidgets("ButtonComponent renders pressed visual state from gesture", (- tester,- ) async {- await tester.pumpWidget(- _wrap(ButtonComponent(label: "Continue", onTap: () {})),- );-- expect(_containerColor(tester), const Color(0xFF08C225));-- final gesture = await tester.startGesture(- tester.getCenter(find.text("Continue")),- );- await tester.pump();-- expect(_containerColor(tester), const Color(0xFF057C18));-- await gesture.up();- await tester.pump(const Duration(milliseconds: 140));-- expect(_containerColor(tester), const Color(0xFF08C225));- });-- testWidgets("Large secondary and link buttons match the catalog layout", (- tester,- ) async {- await tester.pumpWidget(- _wrap(- ButtonComponent(- label: "Cancel",- variant: ButtonComponentVariant.secondary,- size: ButtonComponentSize.large,- onTap: () {},- ),- ),- );-- expect(_containerColor(tester), ColorTokens.light.fillDark);- expect(_textColor(tester, "Cancel"), ColorTokens.light.textBase);- expect(tester.getSize(find.byType(AnimatedContainer)).height, 52);-- await tester.pumpWidget(- _wrap(- ButtonComponent(- label: "Forgot password?",- variant: ButtonComponentVariant.link,- size: ButtonComponentSize.large,- onTap: () {},- ),- ),- );-- expect(tester.getSize(find.byType(AnimatedContainer)).height, 52);- });-- testWidgets("Tertiary critical buttons retain the standard typography", (- tester,- ) async {- await tester.pumpWidget(- _wrap(- ButtonComponent(- label: "Remove access",- variant: ButtonComponentVariant.tertiaryCritical,- size: ButtonComponentSize.small,- onTap: () {},- ),- ),- );-- final style = tester.widget<Text>(find.text("Remove access")).style!;- expect(style.fontFamily, TextStyles.bodyBold.fontFamily);- expect(style.fontSize, 14);- expect(style.height, 20 / 14);- expect(style.fontWeight, TextStyles.bodyBold.fontWeight);- expect(style.decoration, TextDecoration.underline);- expect(style.color, ColorTokens.light.warning);- });-- testWidgets("Compact tertiary critical buttons use Body Link typography", (- tester,- ) async {- await tester.pumpWidget(- _wrap(- ButtonComponent(- label: "Remove access",- variant: ButtonComponentVariant.tertiaryCritical,- density: ButtonComponentDensity.compact,- onTap: () {},- ),- ),- );-- final style = tester.widget<Text>(find.text("Remove access")).style!;- expect(style.fontFamily, TextStyles.body.fontFamily);- expect(style.fontWeight, TextStyles.body.fontWeight);- expect(style.decoration, TextDecoration.underline);- });-- testWidgets("Secondary button states follow Figma fill and text tokens", (- tester,- ) async {- Future<void> pumpSecondary({- required String label,- required ComponentApp app,- Brightness brightness = Brightness.light,- }) {- return tester.pumpWidget(- _wrap(- ButtonComponent(- label: label,- variant: ButtonComponentVariant.secondary,- size: ButtonComponentSize.large,- onTap: () {},- ),- app: app,- brightness: brightness,- ),- );- }-- await pumpSecondary(label: "Photos", app: ComponentApp.photos);- expect(_containerColor(tester), ColorTokens.light.fillDark);- expect(_textColor(tester, "Photos"), ColorTokens.light.textBase);-- final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);- addTearDown(mouse.removePointer);- await mouse.addPointer(location: Offset.zero);- await tester.pump();- await mouse.moveTo(tester.getCenter(find.text("Photos")));- await tester.pumpAndSettle();-- expect(_containerColor(tester), ColorTokens.light.fillDarker);-- final photosGesture = await tester.startGesture(- tester.getCenter(find.text("Photos")),- );- await tester.pump();-- expect(_containerColor(tester), ColorTokens.light.fillDarkest);- expect(_textColor(tester, "Photos"), ColorTokens.light.textBase);-- await photosGesture.up();- await tester.pump(const Duration(milliseconds: 140));- await mouse.moveTo(Offset.zero);- await tester.pumpAndSettle();-- await pumpSecondary(label: "Locker", app: ComponentApp.locker);- expect(_containerColor(tester), ColorTokens.light.fillDark);- expect(_textColor(tester, "Locker"), ColorTokens.light.textBase);-- await pumpSecondary(label: "Auth", app: ComponentApp.auth);- expect(_containerColor(tester), ColorTokens.light.fillDark);- expect(_textColor(tester, "Auth"), ColorTokens.light.textBase);-- await pumpSecondary(- label: "Auth dark",- app: ComponentApp.auth,- brightness: Brightness.dark,- );- expect(_containerColor(tester), ColorTokens.dark.fillDark);- expect(_textColor(tester, "Auth dark"), ColorTokens.dark.textBase);-- final gesture = await tester.startGesture(- tester.getCenter(find.text("Auth dark")),- );- await tester.pump();-- expect(_containerColor(tester), ColorTokens.dark.fillDarkest);- expect(_textColor(tester, "Auth dark"), ColorTokens.dark.textBase);-- await gesture.up();- });-- testWidgets("IconButtonComponent renders Figma size and pressed state", (- tester,- ) async {- await tester.pumpWidget(- _wrap(- IconButtonComponent(- icon: const Icon(Icons.add),- variant: IconButtonComponentVariant.primary,- onTap: () {},- ),- ),- );-- final surfaceFinder = find.byKey(const ValueKey('icon-button-surface'));- final surface = tester.widget<AnimatedContainer>(surfaceFinder);- final decoration = surface.decoration! as BoxDecoration;-- expect(tester.getSize(surfaceFinder), const Size(36, 36));- expect(decoration.color, ColorTokens.light.fillLight);-- final gesture = await tester.startGesture(tester.getCenter(surfaceFinder));- await tester.pump(const Duration(milliseconds: 200));-- final pressedSurface = tester.widget<AnimatedContainer>(surfaceFinder);- final pressedDecoration = pressedSurface.decoration! as BoxDecoration;- expect(pressedDecoration.color, ColorTokens.light.fillDarker);-- await gesture.up();- });-- testWidgets("IconButtonComponent default variant is secondary", (- tester,- ) async {- await tester.pumpWidget(- _wrap(IconButtonComponent(icon: const Icon(Icons.add), onTap: () {})),- );-- expect(_iconButtonColor(tester), Colors.transparent);- });-- testWidgets("IconButtonComponent calls taps only when enabled", (- tester,- ) async {- var tapCount = 0;-- await tester.pumpWidget(- _wrap(- IconButtonComponent(- icon: const Icon(Icons.add),- onTap: () => tapCount += 1,- ),- ),- );-- await tester.tap(find.byType(GestureDetector));- await tester.pump();-- expect(tapCount, 1);- });-testWidgets("IconButtonComponent can handle tap down without onTap", (tester,) async {@@ -693,26 +348,6 @@ void main() {await gesture.up();});- testWidgets("IconButtonComponent mutes disabled foreground", (tester) async {- await tester.pumpWidget(- _wrap(- const IconButtonComponent(- icon: Icon(Icons.add),- variant: IconButtonComponentVariant.primary,- onTap: null,- ),- ),- );-- final iconTheme = tester.widget<IconTheme>(- find.descendant(- of: find.byKey(const ValueKey('icon-button-surface')),- matching: find.byType(IconTheme),- ),- );- expect(iconTheme.data.color, ColorTokens.light.textLighter);- });-testWidgets("IconButtonComponent resets state after async errors", (tester,) async {@@ -864,31 +499,9 @@ Widget _wrapModalTestApp({);}-Color _containerColor(WidgetTester tester) {- final container = tester.widget<AnimatedContainer>(- find.byType(AnimatedContainer),- );- return (container.decoration! as BoxDecoration).color!;-}--Color _buttonContainerColor(WidgetTester tester, String label) {- final container = tester.widget<AnimatedContainer>(- find.ancestor(- of: find.text(label),- matching: find.byType(AnimatedContainer),- ),- );- return (container.decoration! as BoxDecoration).color!;-}-Color _iconButtonColor(WidgetTester tester) {final container = tester.widget<AnimatedContainer>(find.byKey(const ValueKey('icon-button-surface')),);return (container.decoration! as BoxDecoration).color!;}--Color _textColor(WidgetTester tester, String label) {- final text = tester.widget<Text>(find.text(label));- return text.style!.color!;-}diff --git a/mobile/packages/ente_components/test/components/popup_menu_component_test.dart b/mobile/packages/ente_components/test/components/popup_menu_component_test.dartindex 5b223d0830..8887ee315f 100644--- a/mobile/packages/ente_components/test/components/popup_menu_component_test.dart+++ b/mobile/packages/ente_components/test/components/popup_menu_component_test.dart@@ -24,108 +24,6 @@ Future<void> pumpPopupMenu(}void main() {- testWidgets(- 'EntePopupMenuButton renders Figma-sized rows and selects values',- (tester) async {- String? selected;-- await pumpPopupMenu(- tester,- Padding(- padding: const EdgeInsets.all(Spacing.xl),- child: EntePopupMenuButton<String>(- child: const SizedBox.square(- key: ValueKey('popup-anchor'),- dimension: 48,- child: Icon(Icons.more_vert),- ),- optionsBuilder: () => const [- EntePopupMenuOption(- value: 'name',- label: 'Name',- secondaryLabel: 'A-Z',- secondaryTrailingWidget: Icon(Icons.north, size: 12),- activeTrailingWidget: Icon(Icons.arrow_upward),- isActive: true,- ),- EntePopupMenuOption(value: 'created', label: 'Created'),- EntePopupMenuOption(- value: 'updated',- label: 'Updated',- showDivider: false,- ),- ],- onSelected: (value) => selected = value,- ),- ),- );-- await tester.tap(find.byKey(const ValueKey('popup-anchor')));- await tester.pumpAndSettle();-- expect(find.text('Name'), findsOneWidget);- expect(find.text('A-Z'), findsOneWidget);- expect(find.text('Created'), findsOneWidget);- expect(find.text('Updated'), findsOneWidget);- expect(find.byIcon(Icons.north), findsOneWidget);- expect(find.byIcon(Icons.arrow_upward), findsOneWidget);-- final firstItem = tester.widget<Container>(- find.byKey(const ValueKey('ente-popup-menu-item-0')),- );- expect(firstItem.constraints, const BoxConstraints.tightFor(height: 52));- expect(firstItem.padding, const EdgeInsets.symmetric(horizontal: 16));- final firstDecoration = firstItem.decoration! as BoxDecoration;- expect(- firstDecoration.border?.bottom.color,- ColorTokens.light.strokeFaint,- );-- final lastItem = tester.widget<Container>(- find.byKey(const ValueKey('ente-popup-menu-item-2')),- );- final lastDecoration = lastItem.decoration! as BoxDecoration;- expect(lastDecoration.border, isNull);-- final nameStyle = tester.widget<Text>(find.text('Name')).style!;- expect(nameStyle.fontSize, TextStyles.mini.fontSize);- expect(nameStyle.height, TextStyles.mini.height);- expect(nameStyle.fontWeight, TextStyles.mini.fontWeight);- expect(nameStyle.color, ColorTokens.light.textBase);- expect(- tester.widget<Text>(find.text('A-Z')).style?.color,- ColorTokens.light.textLight,- );-- await tester.tap(find.text('Created'));- await tester.pumpAndSettle();-- expect(selected, 'created');- },- );-- testWidgets('EntePopupMenuButton does not open for empty options', (- tester,- ) async {- await pumpPopupMenu(- tester,- EntePopupMenuButton<String>(- child: const SizedBox.square(- key: ValueKey('empty-popup-anchor'),- dimension: 48,- child: Icon(Icons.more_vert),- ),- optionsBuilder: () => const [],- onSelected: (_) {},- ),- );-- await tester.tap(find.byKey(const ValueKey('empty-popup-anchor')));- await tester.pumpAndSettle();-- expect(find.byKey(const ValueKey('ente-popup-menu-item-0')), findsNothing);- });-testWidgets('EntePopupMenuButton ignores async options after anchor unmounts',(tester) async {diff --git a/mobile/packages/ente_components/test/components/selection_controls_test.dart b/mobile/packages/ente_components/test/components/selection_controls_test.dartindex cb64673d5a..1e7d2c6970 100644--- a/mobile/packages/ente_components/test/components/selection_controls_test.dart+++ b/mobile/packages/ente_components/test/components/selection_controls_test.dart@@ -4,70 +4,8 @@ import "package:ente_components/ente_components.dart";import "package:flutter/cupertino.dart";import "package:flutter/material.dart";import "package:flutter_test/flutter_test.dart";-import "package:hugeicons/hugeicons.dart";void main() {- testWidgets("CheckboxComponent toggles to the next selected value", (- tester,- ) async {- bool? nextValue;-- await tester.pumpWidget(- _wrap(- CheckboxComponent(- selected: false,- onChanged: (value) => nextValue = value,- ),- ),- );-- await tester.tap(find.byType(InkWell));- await tester.pump();-- expect(nextValue, isTrue);- });-- testWidgets("RadioComponent toggles to the next selected value", (- tester,- ) async {- bool? nextValue;-- await tester.pumpWidget(- _wrap(- RadioComponent(- selected: false,- onChanged: (value) => nextValue = value,- ),- ),- );-- await tester.tap(find.byType(InkWell));- await tester.pump();-- expect(nextValue, isTrue);- });-- testWidgets("ToggleSwitchComponent toggles to the next selected value", (- tester,- ) async {- bool? nextValue;-- await tester.pumpWidget(- _wrap(- ToggleSwitchComponent(- selected: false,- onChanged: (value) => nextValue = value,- ),- ),- );-- await tester.tap(find.byType(Switch));- await tester.pump();-- expect(nextValue, isTrue);- await tester.pump(const Duration(milliseconds: 200));- });-testWidgets("ToggleSwitchComponent shows async loading and success", (tester,) async {@@ -214,32 +152,6 @@ void main() {await tester.pump(const Duration(milliseconds: 200));});- testWidgets("LabeledControlComponent renders label and subtitle", (- tester,- ) async {- await tester.pumpWidget(- _wrap(- const LabeledControlComponent(- control: CheckboxComponent(selected: true, onChanged: null),- label: "Back up automatically",- subtitle: "Includes new photos",- ),- ),- );-- expect(find.text("Back up automatically"), findsOneWidget);- expect(find.text("Includes new photos"), findsOneWidget);- expect(find.byIcon(Icons.check_rounded), findsOneWidget);- expect(- tester.widget<Text>(find.text("Back up automatically")).style?.fontFamily,- TextStyles.body.fontFamily,- );- expect(- tester.widget<Text>(find.text("Includes new photos")).style?.fontFamily,- TextStyles.mini.fontFamily,- );- });-testWidgets("LabeledControlComponent wraps long labels", (tester) async {const label ="This is a deliberately long label that should wrap inside the control row";@@ -258,91 +170,6 @@ void main() {expect(find.text(label), findsOneWidget);});- testWidgets("FilterChipComponent renders selected state with token colors", (- tester,- ) async {- await tester.pumpWidget(- _wrap(- const FilterChipComponent(- label: "Faces",- state: FilterChipComponentState.selected,- ),- ),- );-- final surfaceFinder = find.byKey(const ValueKey("filter-chip-surface"));- final surface = tester.widget<AnimatedContainer>(surfaceFinder);- final decoration = surface.decoration! as BoxDecoration;- final label = tester.widget<Text>(find.text("Faces"));-- expect(tester.getSize(surfaceFinder).height, 40);- expect(decoration.color, ColorTokens.dark.backgroundBase);- expect(label.style?.color, ColorTokens.light.textReverse);- expect(find.byWidgetPredicate(_isCancelIcon), findsOneWidget);- expect(- tester.widget<HugeIcon>(find.byWidgetPredicate(_isCancelIcon)).size,- 14,- );- });-- testWidgets("FilterChipComponent inverts selected colors in dark theme", (- tester,- ) async {- await tester.pumpWidget(- _wrap(- const FilterChipComponent(- label: "Faces",- state: FilterChipComponentState.selected,- ),- theme: ComponentTheme.darkTheme(),- ),- );-- final surface = tester.widget<AnimatedContainer>(- find.byKey(const ValueKey("filter-chip-surface")),- );- final decoration = surface.decoration! as BoxDecoration;- final label = tester.widget<Text>(find.text("Faces"));-- expect(decoration.color, ColorTokens.light.backgroundBase);- expect(label.style?.color, ColorTokens.dark.textReverse);- expect(find.byWidgetPredicate(_isCancelIcon), findsOneWidget);- });-- testWidgets("FilterChipComponent toggles only when enabled", (tester) async {- bool? nextValue;-- await tester.pumpWidget(- _wrap(- FilterChipComponent(- label: "Albums",- state: FilterChipComponentState.unselected,- onChanged: (value) => nextValue = value,- ),- ),- );-- await tester.tap(find.byKey(const ValueKey("filter-chip-surface")));- await tester.pump();-- expect(nextValue, isTrue);-- await tester.pumpWidget(- _wrap(- FilterChipComponent(- label: "Albums",- state: FilterChipComponentState.disabled,- onChanged: (value) => nextValue = value,- ),- ),- );-- await tester.tap(find.byKey(const ValueKey("filter-chip-surface")));- await tester.pump();-- expect(nextValue, isTrue);- });-testWidgets("FilterChipComponent grows with scaled text", (tester) async {await tester.pumpWidget(_wrap(@@ -360,49 +187,6 @@ void main() {);});- testWidgets("SelectionSummaryChipComponent invokes only enabled actions", (- tester,- ) async {- var tapCount = 0;- await tester.pumpWidget(- _wrap(- SelectionSummaryChipComponent(- label: "Select all",- semanticLabel: "Select all",- icon: const HugeIcon(- icon: HugeIcons.strokeRoundedTick02,- size: IconSizes.small,- ),- onTap: () => tapCount += 1,- ),- ),- );-- await tester.tap(- find.byKey(const ValueKey("selection-summary-chip-surface")),- );- expect(tapCount, 1);-- await tester.pumpWidget(- _wrap(- const SelectionSummaryChipComponent(- label: "Select all",- semanticLabel: "Select all",- icon: HugeIcon(- icon: HugeIcons.strokeRoundedTick02,- size: IconSizes.small,- ),- ),- ),- );- await tester.tap(- find.byKey(const ValueKey("selection-summary-chip-surface")),- );- expect(tapCount, 1);- final label = tester.widget<Text>(find.text("Select all"));- expect(label.style?.color, ColorTokens.light.textLighter);- });-testWidgets("FilterChipComponent keeps avatar fixed by default", (tester,) async {@@ -440,35 +224,6 @@ void main() {);});- testWidgets("FilterChipComponent uses custom avatar size", (tester) async {- await tester.pumpWidget(- _wrap(- const FilterChipComponent(- avatar: ColoredBox(key: ValueKey("avatar"), color: Colors.purple),- state: FilterChipComponentState.unselected,- avatarSize: 48,- ),- ),- );-- final surface = tester.widget<AnimatedContainer>(- find.byKey(const ValueKey("filter-chip-surface")),- );- final decoration = surface.decoration! as BoxDecoration;- final avatarClip = tester.widget<ClipRRect>(find.byType(ClipRRect));-- expect(- tester.getSize(find.byKey(const ValueKey("avatar"))),- const Size.square(48),- );- expect(- tester.getSize(find.byKey(const ValueKey("filter-chip-surface"))).height,- 56,- );- expect(decoration.borderRadius, BorderRadius.circular(28));- expect(avatarClip.borderRadius, BorderRadius.circular(24));- });-testWidgets("FilterChipComponent scales custom avatar size when needed", (tester,) async {@@ -489,21 +244,6 @@ void main() {const Size.square(48),);});-- testWidgets("FilterChipComponent clips avatar content", (tester) async {- await tester.pumpWidget(- _wrap(- const FilterChipComponent(- label: "Mira",- avatar: ColoredBox(color: Colors.purple),- state: FilterChipComponentState.unselected,- ),- ),- );-- expect(find.byType(ClipRRect), findsOneWidget);- expect(find.text("Mira"), findsOneWidget);- });}Widget _wrap(@@ -520,7 +260,3 @@ Widget _wrap(),);}--bool _isCancelIcon(Widget widget) {- return widget is HugeIcon && widget.icon == HugeIcons.strokeRoundedCancel01;-}diff --git a/mobile/packages/ente_components/test/components/slider_stepper_test.dart b/mobile/packages/ente_components/test/components/slider_stepper_test.dartindex c749d43a2f..cd9cbd4df0 100644--- a/mobile/packages/ente_components/test/components/slider_stepper_test.dart+++ b/mobile/packages/ente_components/test/components/slider_stepper_test.dart@@ -1,6 +1,6 @@import "package:ente_components/ente_components.dart";import "package:flutter/material.dart";-import "package:flutter/material.dart" as material show IconButton, Slider;+import "package:flutter/material.dart" as material show Slider;import "package:flutter_test/flutter_test.dart";void main() {@@ -14,81 +14,6 @@ void main() {10,);});-- testWidgets("SliderComponent reports value changes from user interaction", (- tester,- ) async {- var value = 0.25;-- await tester.pumpWidget(- _wrap(- StatefulBuilder(- builder: (context, setState) {- return SliderComponent(- value: value,- min: 0,- max: 1,- onChanged: (nextValue) {- setState(() => value = nextValue);- },- );- },- ),- ),- );-- await tester.drag(find.byType(material.Slider), const Offset(300, 0));- await tester.pump();-- expect(value, greaterThan(0.25));- expect(- tester.widget<material.Slider>(find.byType(material.Slider)).value,- value,- );- });-- testWidgets("StepperComponent increments and decrements around its value", (- tester,- ) async {- final changedValues = <int>[];-- await tester.pumpWidget(- _wrap(StepperComponent(value: 5, onChanged: changedValues.add)),- );-- expect(find.text("5"), findsOneWidget);-- await tester.tap(find.byIcon(Icons.add_rounded));- await tester.pump();- await tester.tap(find.byIcon(Icons.remove_rounded));- await tester.pump();-- expect(changedValues, [6, 4]);- });-- testWidgets("StepperComponent disables controls at min and max", (- tester,- ) async {- await tester.pumpWidget(- _wrap(StepperComponent(value: 0, min: 0, max: 1, onChanged: (_) {})),- );-- final minButtons = tester.widgetList<material.IconButton>(- find.byType(material.IconButton),- );- expect(minButtons.first.onPressed, isNull);- expect(minButtons.last.onPressed, isNotNull);-- await tester.pumpWidget(- _wrap(StepperComponent(value: 1, min: 0, max: 1, onChanged: (_) {})),- );-- final maxButtons = tester.widgetList<material.IconButton>(- find.byType(material.IconButton),- );- expect(maxButtons.first.onPressed, isNotNull);- expect(maxButtons.last.onPressed, isNull);- });}Widget _wrap(Widget child) {diff --git a/mobile/packages/ente_components/test/components/tag_chip_component_test.dart b/mobile/packages/ente_components/test/components/tag_chip_component_test.dartdeleted file mode 100644index 35aff8344a..0000000000--- a/mobile/packages/ente_components/test/components/tag_chip_component_test.dart+++ /dev/null@@ -1,132 +0,0 @@-import "package:ente_components/ente_components.dart";-import "package:flutter/material.dart";-import "package:flutter_test/flutter_test.dart";--void main() {- testWidgets("TagChipComponent renders selected colors", (tester) async {- await tester.pumpWidget(- _wrap(- const TagChipComponent(- label: "Faces",- leading: Icon(Icons.sell_outlined),- state: TagChipComponentState.selected,- ),- ),- );-- _expectChipColors(- tester,- background: ColorTokens.light.primary,- content: ColorTokens.light.specialWhite,- );- });-- testWidgets("TagChipComponent renders unselected colors", (tester) async {- await tester.pumpWidget(- _wrap(- const TagChipComponent(- label: "Faces",- leading: Icon(Icons.sell_outlined),- ),- ),- );-- _expectChipColors(- tester,- background: ColorTokens.light.fillLight,- content: ColorTokens.light.textLight,- );- });-- testWidgets("TagChipComponent renders disabled colors", (tester) async {- await tester.pumpWidget(- _wrap(- const TagChipComponent(- label: "Faces",- leading: Icon(Icons.sell_outlined),- state: TagChipComponentState.disabled,- ),- ),- );-- _expectChipColors(- tester,- background: ColorTokens.light.fillLight,- content: ColorTokens.light.textLightest,- );- });-- testWidgets("TagChipComponent invokes tap callback when enabled", (- tester,- ) async {- var taps = 0;-- await tester.pumpWidget(- _wrap(TagChipComponent(label: "Albums", onTap: () => taps++)),- );-- await tester.tap(find.byKey(const ValueKey("tag-chip-surface")));- await tester.pump();-- expect(taps, 1);- });-- testWidgets("TagChipComponent does not invoke tap callback when disabled", (- tester,- ) async {- var taps = 0;-- await tester.pumpWidget(- _wrap(- TagChipComponent(- label: "Albums",- state: TagChipComponentState.disabled,- onTap: () => taps++,- ),- ),- );-- await tester.tap(find.byKey(const ValueKey("tag-chip-surface")));- await tester.pump();-- expect(taps, 0);- });-- test("TagChipComponent allows only one icon slot", () {- expect(- () => TagChipComponent(- label: "People",- leading: const Icon(Icons.person_outline),- trailing: const Icon(Icons.close_rounded),- ),- throwsAssertionError,- );- });-}--void _expectChipColors(- WidgetTester tester, {- required Color background,- required Color content,-}) {- final surfaceFinder = find.byKey(const ValueKey("tag-chip-surface"));- final surface = tester.widget<AnimatedContainer>(surfaceFinder);- final decoration = surface.decoration! as BoxDecoration;- final label = tester.widget<Text>(find.text("Faces"));- final iconTheme = IconTheme.of(- tester.element(find.byIcon(Icons.sell_outlined)),- );-- expect(tester.getSize(surfaceFinder).height, 44);- expect(decoration.color, background);- expect(label.style?.color, content);- expect(iconTheme.color, content);- expect(find.byIcon(Icons.close_rounded), findsNothing);-}--Widget _wrap(Widget child) {- return MaterialApp(- theme: ComponentTheme.lightTheme(),- home: Scaffold(body: Center(child: child)),- );-}diff --git a/mobile/packages/ente_components/test/components/text_input_component_test.dart b/mobile/packages/ente_components/test/components/text_input_component_test.dartindex 002de43173..a17ffc6420 100644--- a/mobile/packages/ente_components/test/components/text_input_component_test.dart+++ b/mobile/packages/ente_components/test/components/text_input_component_test.dart@@ -2,102 +2,9 @@ import "dart:async";import "package:ente_components/ente_components.dart";import "package:flutter/material.dart";-import "package:flutter/services.dart";import "package:flutter_test/flutter_test.dart";void main() {- testWidgets(- "TextInputComponent renders label, required mark, and helper message",- (tester) async {- await tester.pumpWidget(- _wrap(- const TextInputComponent(- label: "Email",- hintText: "[email protected]",- message: "Use your account email",- isRequired: true,- ),- ),- );-- expect(_richText("Email *"), findsNothing);- expect(find.text("Email"), findsOneWidget);- expect(find.text("*"), findsOneWidget);- expect(find.text("Use your account email"), findsOneWidget);- expect(- tester.widget<Text>(find.text("Use your account email")).style?.color,- ColorTokens.light.textLight,- );- expect(- tester.widget<TextField>(find.byType(TextField)).decoration?.hintText,- "[email protected]",- );- },- );-- testWidgets("TextInputComponent renders error message visuals", (- tester,- ) async {- await tester.pumpWidget(- _wrap(- const TextInputComponent(- label: "Password",- message: "Password is required",- messageType: TextInputComponentMessageType.error,- ),- ),- );-- expect(find.text("Password is required"), findsOneWidget);- expect(- tester.widget<Text>(find.text("Password is required")).style?.color,- ColorTokens.light.warning,- );- expect(- _fieldDecoration(tester).border?.top.color,- ColorTokens.light.warning,- );- });-- testWidgets("TextInputComponent renders success message visuals", (- tester,- ) async {- await tester.pumpWidget(- _wrap(- const TextInputComponent(- label: "Code",- message: "Looks good",- messageType: TextInputComponentMessageType.success,- ),- ),- );-- expect(find.text("Looks good"), findsOneWidget);- expect(find.byIcon(Icons.check_circle_outline_rounded), findsOneWidget);- expect(- tester.widget<Text>(find.text("Looks good")).style?.color,- ColorTokens.light.primary,- );- expect(- _fieldDecoration(tester).border?.top.color,- ColorTokens.light.primary,- );- });-- testWidgets("TextInputComponent maps actual focus to the focused border", (- tester,- ) async {- await tester.pumpWidget(_wrap(const TextInputComponent(label: "Email")));-- await tester.tap(find.byType(TextField));- await tester.pump();-- expect(- _fieldDecoration(tester).border?.top.color,- ColorTokens.light.textLighter,- );- });-testWidgets("TextInputComponent unfocuses when tapping outside", (tester,) async {@@ -127,57 +34,6 @@ void main() {expect(focusNode.hasFocus, isFalse);});- testWidgets("TextInputComponent maps error and success states to borders", (- tester,- ) async {- await tester.pumpWidget(- _wrap(- const Column(- children: [- TextInputComponent(- label: "Error",- message: "This is an error",- messageType: TextInputComponentMessageType.error,- ),- TextInputComponent(- label: "Success",- message: "Saved",- messageType: TextInputComponentMessageType.success,- ),- ],- ),- ),- );-- final borders = tester- .widgetList<Container>(_fieldContainers())- .map((container) => container.decoration! as BoxDecoration)- .map((decoration) => decoration.border! as Border)- .toList();-- expect(borders.first.top.color, ColorTokens.light.warning);- expect(borders.first.top.width, 1);- expect(borders.last.top.color, ColorTokens.light.primary);- expect(borders.last.top.width, 1);- });-- testWidgets(- "TextInputComponent forwards disabled state to the platform field",- (tester) async {- await tester.pumpWidget(- _wrap(const TextInputComponent(label: "Email", isDisabled: true)),- );-- final input = tester.widget<TextField>(find.byType(TextField));- expect(input.enabled, isFalse);- expect(_fieldDecoration(tester).color, ColorTokens.light.fillDark);- expect(- _fieldDecoration(tester).border?.top.color,- ColorTokens.light.strokeFaint,- );- },- );-testWidgets("TextInputComponent forwards read-only state while staying enabled",(tester) async {@@ -198,177 +54,6 @@ void main() {},);- testWidgets("TextInputComponent supports the multiline layout", (- tester,- ) async {- await tester.pumpWidget(- _wrap(- const TextInputComponent(- label: "Notes",- hintText: "Hint text",- message: "This is an error",- messageType: TextInputComponentMessageType.error,- maxLines: 4,- suffix: Icon(Icons.copy, key: ValueKey("copy-icon")),- ),- ),- );-- final input = tester.widget<TextField>(find.byType(TextField));- final padding = tester.widget<Padding>(- find- .descendant(- of: _fieldContainers().first,- matching: find.byWidgetPredicate(- (widget) =>- widget is Padding &&- widget.padding ==- const EdgeInsets.symmetric(horizontal: 16, vertical: 16),- ),- )- .first,- );-- expect(input.maxLines, 4);- expect(- padding.padding,- const EdgeInsets.symmetric(horizontal: 16, vertical: 16),- );- expect(_fieldDecoration(tester).borderRadius, BorderRadius.circular(16));- expect(- _fieldDecoration(tester).border?.top.color,- ColorTokens.light.warning,- );- expect(find.byKey(const ValueKey("copy-icon")), findsOneWidget);- expect(- tester.getTopLeft(find.byKey(const ValueKey("copy-icon"))).dy,- tester.getTopLeft(find.byType(TextField)).dy,- );- expect(- tester.widget<Text>(find.text("This is an error")).style?.fontSize,- TextStyles.mini.fontSize,- );- });-- testWidgets("TextInputComponent accepts text entry and reports changes", (- tester,- ) async {- final controller = TextEditingController();- var changedValue = "";- addTearDown(controller.dispose);-- await tester.pumpWidget(- _wrap(- TextInputComponent(- controller: controller,- label: "Name",- onChanged: (value) => changedValue = value,- ),- ),- );-- await tester.enterText(find.byType(TextField), "Ada Lovelace");- await tester.pump();-- expect(controller.text, "Ada Lovelace");- expect(changedValue, "Ada Lovelace");- expect(find.text("Ada Lovelace"), findsOneWidget);- });-- testWidgets("TextInputComponent forwards production text input behavior", (- tester,- ) async {- final controller = TextEditingController();- final focusNode = FocusNode();- final isEmptyNotifier = ValueNotifier<bool>(false);- var submitted = "";- addTearDown(controller.dispose);- addTearDown(focusNode.dispose);- addTearDown(isEmptyNotifier.dispose);-- await tester.pumpWidget(- _wrap(- TextInputComponent(- controller: controller,- focusNode: focusNode,- isEmptyNotifier: isEmptyNotifier,- label: "Invite email",- autofocus: true,- textCapitalization: TextCapitalization.words,- inputFormatters: [- FilteringTextInputFormatter.allow(RegExp("[a-z@.]")),- ],- maxLength: 48,- keyboardType: TextInputType.emailAddress,- autofillHints: const [AutofillHints.email],- autocorrect: false,- onSubmit: (value) => submitted = value,- ),- ),- );-- final input = tester.widget<TextField>(find.byType(TextField));- expect(input.focusNode, focusNode);- expect(input.autofocus, isTrue);- expect(input.textCapitalization, TextCapitalization.words);- expect(input.maxLength, isNull);- expect(input.keyboardType, TextInputType.emailAddress);- expect(input.autofillHints, const [AutofillHints.email]);- expect(input.autocorrect, isFalse);-- await tester.enterText(find.byType(TextField), "[email protected]");- await tester.testTextInput.receiveAction(TextInputAction.done);- await tester.pump();-- expect(submitted, "[email protected]");- expect(isEmptyNotifier.value, isFalse);- });-- testWidgets(- "TextInputComponent supports clear and password visibility affordances",- (tester) async {- final clearController = TextEditingController(text: "search");- final passwordController = TextEditingController(text: "secret");- addTearDown(clearController.dispose);- addTearDown(passwordController.dispose);-- await tester.pumpWidget(- _wrap(- Column(- children: [- TextInputComponent(- controller: clearController,- label: "Search",- isClearable: true,- ),- TextInputComponent(- controller: passwordController,- label: "Password",- isPasswordInput: true,- ),- ],- ),- ),- );-- expect(find.byKey(const ValueKey("text-field-clear")), findsOneWidget);- await tester.tap(find.byKey(const ValueKey("text-field-clear")));- await tester.pump();- expect(clearController.text, "");- expect(find.byKey(const ValueKey("text-field-clear")), findsNothing);-- var inputs = tester.widgetList<TextField>(find.byType(TextField));- expect(inputs.last.obscureText, isTrue);-- await tester.tap(- find.byKey(const ValueKey("text-field-password-toggle")),- );- await tester.pump();- inputs = tester.widgetList<TextField>(find.byType(TextField));- expect(inputs.last.obscureText, isFalse);- },- );-testWidgets("TextInputComponent gives suffix actions a 48px tap target without resizing",(tester) async {@@ -451,27 +136,6 @@ void main() {);});- testWidgets("TextInputComponent renders alert message visuals", (- tester,- ) async {- await tester.pumpWidget(- _wrap(- const TextInputComponent(- label: "Recovery key",- message: "Save this somewhere safe.",- messageType: TextInputComponentMessageType.alert,- ),- ),- );-- expect(find.text("Save this somewhere safe."), findsOneWidget);- expect(find.byIcon(Icons.warning_amber_rounded), findsOneWidget);- expect(- tester.widget<Text>(find.text("Save this somewhere safe.")).style?.color,- ColorTokens.light.warning,- );- });-testWidgets("TextInputComponent submits without surfacing execution UI", (tester,) async {@@ -561,12 +225,6 @@ void main() {});}-Finder _richText(String value) {- return find.byWidgetPredicate(- (widget) => widget is Text && widget.textSpan?.toPlainText() == value,- );-}-Finder _fieldContainers() {return find.byWidgetPredicate((widget) {if (widget is! Container || widget.decoration is! BoxDecoration) {diff --git a/mobile/packages/ente_components/test/theme/theme_tokens_test.dart b/mobile/packages/ente_components/test/theme/theme_tokens_test.dartindex cf477e64e4..da26ba8cc0 100644--- a/mobile/packages/ente_components/test/theme/theme_tokens_test.dart+++ b/mobile/packages/ente_components/test/theme/theme_tokens_test.dart@@ -3,341 +3,7 @@ import "package:flutter/material.dart";import "package:flutter_test/flutter_test.dart";void main() {- group("foundation tokens", () {- test("expose expected spacing, radii, motion, and shadow values", () {- expect(2, 2);- expect(Spacing.sm, 8);- expect(Spacing.xl, 20);- expect(Spacing.xxl, 24);- expect(40, 40);-- expect(Radii.xs, 4);- expect(Radii.md, 12);- expect(Radii.button, 20);- expect(Radii.bottomSheet, 20);- expect(Radii.buttonRadius, const Radius.circular(20));- expect(Radii.buttonBorder, const BorderRadius.all(Radius.circular(20)));-- expect(IconSizes.micro, 8);- expect(IconSizes.tiny, 12);- expect(IconSizes.small, 18);- expect(IconSizes.medium, 24);- expect(IconSizes.large, 36);-- expect(Motion.quick, const Duration(milliseconds: 120));- expect(Motion.standard, const Duration(milliseconds: 180));- expect(Motion.slow, const Duration(milliseconds: 260));-- expect(Shadows.soft, hasLength(1));- expect(Shadows.soft.first.color, const Color(0x14000000));- expect(Shadows.soft.first.blurRadius, 16);- expect(Shadows.floating.first.offset, const Offset(0, 12));- });-- test("expose light and dark semantic color values", () {- expect(ColorTokens.light.primary, const Color(0xFF08C225));- expect(ColorTokens.light.warning, const Color(0xFFF63A3A));- expect(ColorTokens.light.backgroundBase, const Color(0xFFF4F4F4));- expect(ColorTokens.light.textBase, const Color(0xFF000000));- expect(ColorTokens.light.textReverse, const Color(0xFFFFFFFF));- expect(ColorTokens.light.iconColor, const Color.fromRGBO(0, 0, 0, 0.75));-- expect(ColorTokens.dark.primary, const Color(0xFF08C225));- expect(ColorTokens.dark.warningLight, const Color(0xFF292929));- expect(ColorTokens.dark.backgroundBase, const Color(0xFF161616));- expect(ColorTokens.dark.textBase, const Color(0xFFFFFFFF));- expect(ColorTokens.dark.textReverse, const Color(0xFF000000));- expect(ColorTokens.dark.iconColor, const Color(0xFFFFFFFF));- });-- test("selects app primary tokens without changing shared colors", () {- final photosLight = ColorTokens.forApp(ComponentApp.photos);- final authLight = ColorTokens.forApp(ComponentApp.auth);- final lockerLight = ColorTokens.forApp(ComponentApp.locker);- final authDark = ColorTokens.forApp(- ComponentApp.auth,- brightness: Brightness.dark,- );-- expect(photosLight.primary, greenDefaultLight);- expect(photosLight.primaryLight, greenLightLight);- expect(photosLight.primaryLightHover, greenLightHoverLight);- expect(photosLight.primaryLightPressed, greenLightPressedLight);- expect(photosLight.primaryStroke, greenStrokeLight);- expect(photosLight.primaryDark, greenDarkLight);- expect(photosLight.primaryDarker, greenDarkerLight);-- expect(authLight.primary, purpleDefaultLight);- expect(authLight.primaryLight, purpleLightLight);- expect(authLight.primaryLightHover, purpleLightHoverLight);- expect(authLight.primaryLightPressed, purpleLightPressedLight);- expect(authLight.primaryStroke, purpleStrokeLight);- expect(authLight.primaryDark, purpleDarkLight);- expect(authLight.primaryDarker, purpleDarkerLight);-- expect(lockerLight.primary, blueDefaultLight);- expect(lockerLight.primaryLight, blueLightLight);- expect(lockerLight.primaryLightHover, blueLightHoverLight);- expect(lockerLight.primaryLightPressed, blueLightPressedLight);- expect(lockerLight.primaryStroke, blueStrokeLight);- expect(lockerLight.primaryDark, blueDarkLight);- expect(lockerLight.primaryDarker, blueDarkerLight);-- expect(authDark.primary, purpleDefaultDark);- expect(authDark.primaryLight, purpleLightDark);- expect(authDark.primaryLightHover, purpleLightHoverDark);- expect(authDark.primaryLightPressed, purpleLightPressedDark);-- expect(authLight.backgroundBase, ColorTokens.light.backgroundBase);- expect(authLight.warning, ColorTokens.light.warning);- expect(authLight.green, ColorTokens.light.green);- expect(authLight.blue, ColorTokens.light.blue);- expect(authLight.purple, ColorTokens.light.purple);- expect(lockerLight.textBase, ColorTokens.light.textBase);- expect(lockerLight.iconColor, ColorTokens.light.iconColor);- });-- test("match Figma color family values used as app primary colors", () {- const expectedLight = <String, Color>{- "greens/green-light": Color.fromRGBO(221, 238, 223, 1),- "greens/green-light-hover": Color.fromRGBO(205, 229, 208, 1),- "greens/green-light-pressed": Color.fromRGBO(184, 213, 187, 1),- "greens/green-stroke": Color.fromRGBO(186, 236, 194, 1),- "greens/green": Color.fromRGBO(8, 194, 37, 1),- "greens/green-dark": Color.fromRGBO(6, 157, 30, 1),- "greens/green-darker": Color.fromRGBO(5, 124, 24, 1),- "purples/purple-light": Color.fromRGBO(244, 231, 252, 1),- "purples/purple-light-hover": Color.fromRGBO(232, 210, 250, 1),- "purples/purple-light-pressed": Color.fromRGBO(217, 188, 241, 1),- "purples/purple-stroke": Color.fromRGBO(216, 181, 244, 1),- "purples/purple": Color.fromRGBO(150, 16, 214, 1),- "purples/purple-dark": Color.fromRGBO(122, 12, 174, 1),- "purples/purple-darker": Color.fromRGBO(93, 8, 132, 1),- "blues/blue-light": Color.fromRGBO(231, 239, 250, 1),- "blues/blue-light-hover": Color.fromRGBO(216, 228, 244, 1),- "blues/blue-light-pressed": Color.fromRGBO(194, 210, 232, 1),- "blues/blue-stroke": Color.fromRGBO(16, 113, 255, 1),- "blues/blue": Color.fromRGBO(16, 113, 255, 1),- "blues/blue-dark": Color.fromRGBO(14, 95, 217, 1),- "blues/blue-darker": Color.fromRGBO(11, 76, 173, 1),- };- const expectedDark = <String, Color>{- "greens/green-light": Color.fromRGBO(41, 41, 41, 1),- "greens/green-light-hover": Color.fromRGBO(31, 48, 35, 1),- "greens/green-light-pressed": Color.fromRGBO(44, 66, 50, 1),- "greens/green-stroke": Color.fromRGBO(28, 65, 34, 1),- "greens/green": Color.fromRGBO(8, 194, 37, 1),- "greens/green-dark": Color.fromRGBO(6, 157, 30, 1),- "greens/green-darker": Color.fromRGBO(5, 124, 24, 1),- "purples/purple-light": Color.fromRGBO(39, 28, 50, 1),- "purples/purple-light-hover": Color.fromRGBO(47, 31, 63, 1),- "purples/purple-light-pressed": Color.fromRGBO(37, 23, 52, 1),- "purples/purple-stroke": Color.fromRGBO(61, 27, 92, 1),- "purples/purple": Color.fromRGBO(150, 16, 214, 1),- "purples/purple-dark": Color.fromRGBO(122, 12, 174, 1),- "purples/purple-darker": Color.fromRGBO(93, 8, 132, 1),- "blues/blue-light": Color.fromRGBO(41, 41, 41, 1),- "blues/blue-light-hover": Color.fromRGBO(26, 38, 56, 1),- "blues/blue-light-pressed": Color.fromRGBO(17, 30, 49, 1),- "blues/blue-stroke": Color.fromRGBO(16, 113, 255, 1),- "blues/blue": Color.fromRGBO(16, 113, 255, 1),- "blues/blue-dark": Color.fromRGBO(14, 95, 217, 1),- "blues/blue-darker": Color.fromRGBO(11, 76, 173, 1),- };-- expect(_figmaColorFamilyMap(ColorTokens.light), expectedLight);- expect(_figmaColorFamilyMap(ColorTokens.dark), expectedDark);- });-- test("match Figma shared Color Tokens light and dark modes", () {- const expectedLight = <String, Color>{- "accent/orange": Color.fromRGBO(242, 72, 34, 1),- "accent/orange-light": Color.fromRGBO(255, 247, 244, 1),- "accent/pink": Color.fromRGBO(223, 97, 187, 1),- "accent/pink-light": Color.fromRGBO(253, 246, 251, 1),- "accent/teal": Color.fromRGBO(95, 183, 187, 1),- "accent/teal-light": Color.fromRGBO(245, 251, 251, 1),- "background/base": Color.fromRGBO(244, 244, 244, 1),- "caution/default": Color.fromRGBO(240, 138, 30, 1),- "caution/light": Color.fromRGBO(250, 244, 235, 1),- "fill/base": Color.fromRGBO(0, 0, 0, 1),- "fill/dark": Color.fromRGBO(234, 234, 234, 1),- "fill/darker": Color.fromRGBO(222, 222, 222, 1),- "fill/darkest": Color.fromRGBO(210, 210, 210, 1),- "fill/light": Color.fromRGBO(255, 255, 255, 1),- "primary/dark": Color.fromRGBO(6, 157, 30, 1),- "primary/darker": Color.fromRGBO(5, 124, 24, 1),- "primary/default": Color.fromRGBO(8, 194, 37, 1),- "primary/light": Color.fromRGBO(221, 238, 223, 1),- "primary/light-hover": Color.fromRGBO(205, 229, 208, 1),- "primary/light-pressed": Color.fromRGBO(184, 213, 187, 1),- "primary/stroke": Color.fromRGBO(186, 236, 194, 1),- "special/content-reverse": Color.fromRGBO(255, 255, 255, 1),- "special/scrim": Color.fromRGBO(0, 0, 0, 0.4),- "special/white": Color.fromRGBO(255, 255, 255, 1),- "special/white-overlay": Color.fromRGBO(255, 255, 255, 0.14),- "stroke/dark": Color.fromRGBO(224, 224, 224, 1),- "stroke/faint": Color.fromRGBO(235, 235, 235, 1),- "text/base": Color.fromRGBO(0, 0, 0, 1),- "text/dark": Color.fromRGBO(26, 26, 26, 1),- "text/darker": Color.fromRGBO(21, 21, 21, 1),- "text/light": Color.fromRGBO(102, 102, 102, 1),- "text/lighter": Color.fromRGBO(150, 150, 150, 1),- "text/lightest": Color.fromRGBO(214, 214, 214, 1),- "text/reverse": Color.fromRGBO(255, 255, 255, 1),- "warning/dark": Color.fromRGBO(221, 52, 52, 1),- "warning/darker": Color.fromRGBO(197, 46, 46, 1),- "warning/default": Color.fromRGBO(246, 58, 58, 1),- "warning/light": Color.fromRGBO(250, 235, 235, 1),- };- const expectedDark = <String, Color>{- "accent/orange": Color.fromRGBO(242, 72, 34, 1),- "accent/orange-light": Color.fromRGBO(41, 41, 41, 1),- "accent/pink": Color.fromRGBO(223, 97, 187, 1),- "accent/pink-light": Color.fromRGBO(41, 41, 41, 1),- "accent/teal": Color.fromRGBO(95, 183, 187, 1),- "accent/teal-light": Color.fromRGBO(41, 41, 41, 1),- "background/base": Color.fromRGBO(22, 22, 22, 1),- "caution/default": Color.fromRGBO(240, 138, 30, 1),- "caution/light": Color.fromRGBO(41, 41, 41, 1),- "fill/base": Color.fromRGBO(255, 255, 255, 1),- "fill/dark": Color.fromRGBO(10, 10, 10, 1),- "fill/darker": Color.fromRGBO(20, 20, 20, 1),- "fill/darkest": Color.fromRGBO(41, 41, 41, 1),- "fill/light": Color.fromRGBO(33, 33, 33, 1),- "primary/dark": Color.fromRGBO(6, 157, 30, 1),- "primary/darker": Color.fromRGBO(5, 124, 24, 1),- "primary/default": Color.fromRGBO(8, 194, 37, 1),- "primary/light": Color.fromRGBO(41, 41, 41, 1),- "primary/light-hover": Color.fromRGBO(31, 48, 35, 1),- "primary/light-pressed": Color.fromRGBO(44, 66, 50, 1),- "primary/stroke": Color.fromRGBO(28, 65, 34, 1),- "special/content-reverse": Color.fromRGBO(0, 0, 0, 1),- "special/scrim": Color.fromRGBO(0, 0, 0, 0.4),- "special/white": Color.fromRGBO(255, 255, 255, 1),- "special/white-overlay": Color.fromRGBO(255, 255, 255, 0.14),- "stroke/dark": Color.fromRGBO(62, 62, 62, 1),- "stroke/faint": Color.fromRGBO(42, 42, 42, 1),- "text/base": Color.fromRGBO(255, 255, 255, 1),- "text/dark": Color.fromRGBO(229, 229, 229, 1),- "text/darker": Color.fromRGBO(204, 204, 204, 1),- "text/light": Color.fromRGBO(153, 153, 153, 1),- "text/lighter": Color.fromRGBO(150, 150, 150, 1),- "text/lightest": Color.fromRGBO(65, 65, 65, 1),- "text/reverse": Color.fromRGBO(0, 0, 0, 1),- "warning/dark": Color.fromRGBO(221, 52, 52, 1),- "warning/darker": Color.fromRGBO(197, 46, 46, 1),- "warning/default": Color.fromRGBO(246, 58, 58, 1),- "warning/light": Color.fromRGBO(41, 41, 41, 1),- };-- expect(_figmaColorTokenMap(ColorTokens.light), expectedLight);- expect(_figmaColorTokenMap(ColorTokens.dark), expectedDark);- });- });-- group("text styles", () {- test("match the published type scale", () {- expect(TextStyles.fontFamily, "Inter");- expect(TextStyles.outfitFontFamily, "Outfit");- expect(TextStyles.fontPackage, "ente_components");-- expect(TextStyles.display1.fontFamily, "packages/ente_components/Outfit");- expect(TextStyles.display1.fontSize, 32);- expect(TextStyles.display1.height, 40 / 32);- expect(TextStyles.display1.fontWeight, FontWeight.w600);- expect(TextStyles.display1.letterSpacing, 0);-- expect(TextStyles.display2.fontFamily, "packages/ente_components/Outfit");- expect(TextStyles.display2.fontSize, 24);- expect(TextStyles.display2.height, 32 / 24);- expect(TextStyles.display2.fontWeight, FontWeight.w600);- expect(TextStyles.display2.letterSpacing, 0);-- expect(TextStyles.h1.fontFamily, "packages/ente_components/Inter");- expect(TextStyles.h1.fontSize, 20);- expect(TextStyles.h1.height, 28 / 20);- expect(TextStyles.h1.fontWeight, FontWeight.w700);- expect(TextStyles.h1.letterSpacing, 0);-- expect(TextStyles.h2.fontSize, 18);- expect(TextStyles.h2.height, 24 / 18);- expect(TextStyles.h2.fontWeight, FontWeight.w600);-- expect(TextStyles.display3.fontFamily, "packages/ente_components/Outfit");- expect(TextStyles.display3.fontSize, 20);- expect(TextStyles.display3.height, 28 / 20);- expect(TextStyles.display3.fontWeight, FontWeight.w600);-- expect(TextStyles.body.fontFamily, "packages/ente_components/Inter");- expect(TextStyles.body.fontSize, 14);- expect(TextStyles.body.height, 20 / 14);- expect(TextStyles.body.fontWeight, FontWeight.w500);-- expect(TextStyles.mini.fontSize, 12);- expect(TextStyles.tiny.fontSize, 10);- expect(TextStyles.bodyLink.decoration, TextDecoration.underline);- });- });-group("theme", () {- test("maps color and text tokens into light ThemeData", () {- final theme = ComponentTheme.lightTheme();-- expect(theme.brightness, Brightness.light);- expect(theme.scaffoldBackgroundColor, ColorTokens.light.backgroundBase);- expect(theme.colorScheme.primary, ColorTokens.light.primary);- expect(theme.colorScheme.error, ColorTokens.light.warning);- expect(- theme.textTheme.headlineLarge?.fontFamily,- TextStyles.h1.fontFamily,- );- expect(theme.textTheme.headlineLarge?.fontSize, TextStyles.h1.fontSize);- expect(- theme.textTheme.headlineLarge?.fontWeight,- TextStyles.h1.fontWeight,- );- expect(- theme.textTheme.bodyMedium?.fontFamily,- TextStyles.body.fontFamily,- );- expect(theme.textTheme.bodyMedium?.fontSize, TextStyles.body.fontSize);- });-- test("maps color and text tokens into dark ThemeData", () {- final theme = ComponentTheme.darkTheme();-- expect(theme.brightness, Brightness.dark);- expect(theme.scaffoldBackgroundColor, ColorTokens.dark.backgroundBase);- expect(theme.colorScheme.primary, ColorTokens.dark.primary);- expect(theme.colorScheme.error, ColorTokens.dark.warning);- expect(- theme.textTheme.labelSmall?.fontFamily,- TextStyles.tiny.fontFamily,- );- expect(theme.textTheme.labelSmall?.fontSize, TextStyles.tiny.fontSize);- expect(- theme.textTheme.labelSmall?.fontWeight,- TextStyles.tiny.fontWeight,- );- });-- test("maps selected app primary tokens into ThemeData", () {- final authTheme = ComponentTheme.lightTheme(app: ComponentApp.auth);- final lockerTheme = ComponentTheme.darkTheme(app: ComponentApp.locker);-- expect(authTheme.colorScheme.primary, purpleDefaultLight);- expect(- authTheme.scaffoldBackgroundColor,- ColorTokens.light.backgroundBase,- );- expect(lockerTheme.colorScheme.primary, blueDefaultDark);- expect(- lockerTheme.scaffoldBackgroundColor,- ColorTokens.dark.backgroundBase,- );- });-testWidgets("selects color tokens from the ambient brightness", (tester,) async {@@ -432,81 +98,5 @@ void main() {expect(colors.primary, blueDefaultDark);expect(colors.backgroundBase, ColorTokens.dark.backgroundBase);});-- test("defaults to photos primary tokens when no app is passed", () {- expect(- ComponentTheme.lightTheme().colorScheme.primary,- greenDefaultLight,- );- });});}--Map<String, Color> _figmaColorFamilyMap(ColorTokens colors) {- return {- "greens/green-light": colors.greenLight,- "greens/green-light-hover": colors.greenLightHover,- "greens/green-light-pressed": colors.greenLightPressed,- "greens/green-stroke": colors.greenStroke,- "greens/green": colors.green,- "greens/green-dark": colors.greenDark,- "greens/green-darker": colors.greenDarker,- "purples/purple-light": colors.purpleLight,- "purples/purple-light-hover": colors.purpleLightHover,- "purples/purple-light-pressed": colors.purpleLightPressed,- "purples/purple-stroke": colors.purpleStroke,- "purples/purple": colors.purple,- "purples/purple-dark": colors.purpleDark,- "purples/purple-darker": colors.purpleDarker,- "blues/blue-light": colors.blueLight,- "blues/blue-light-hover": colors.blueLightHover,- "blues/blue-light-pressed": colors.blueLightPressed,- "blues/blue-stroke": colors.blueStroke,- "blues/blue": colors.blue,- "blues/blue-dark": colors.blueDark,- "blues/blue-darker": colors.blueDarker,- };-}--Map<String, Color> _figmaColorTokenMap(ColorTokens colors) {- return {- "accent/orange": colors.accentOrange,- "accent/orange-light": colors.accentOrangeLight,- "accent/pink": colors.accentPink,- "accent/pink-light": colors.accentPinkLight,- "accent/teal": colors.accentTeal,- "accent/teal-light": colors.accentTealLight,- "background/base": colors.backgroundBase,- "caution/default": colors.caution,- "caution/light": colors.cautionLight,- "fill/base": colors.fillBase,- "fill/dark": colors.fillDark,- "fill/darker": colors.fillDarker,- "fill/darkest": colors.fillDarkest,- "fill/light": colors.fillLight,- "primary/dark": colors.primaryDark,- "primary/darker": colors.primaryDarker,- "primary/default": colors.primary,- "primary/light": colors.primaryLight,- "primary/light-hover": colors.primaryLightHover,- "primary/light-pressed": colors.primaryLightPressed,- "primary/stroke": colors.primaryStroke,- "special/content-reverse": colors.specialContentReverse,- "special/scrim": colors.specialScrim,- "special/white": colors.specialWhite,- "special/white-overlay": colors.specialWhiteOverlay,- "stroke/dark": colors.strokeDark,- "stroke/faint": colors.strokeFaint,- "text/base": colors.textBase,- "text/dark": colors.textDark,- "text/darker": colors.textDarker,- "text/light": colors.textLight,- "text/lighter": colors.textLighter,- "text/lightest": colors.textLightest,- "text/reverse": colors.textReverse,- "warning/dark": colors.warningDark,- "warning/darker": colors.warningDarker,- "warning/default": colors.warning,- "warning/light": colors.warningLight,- };-}diff --git a/rust/crates/ensu/src/image.rs b/rust/crates/ensu/src/image.rsindex 5571e627dd..fc9f534516 100644--- a/rust/crates/ensu/src/image.rs+++ b/rust/crates/ensu/src/image.rs@@ -18,9 +18,7 @@ mod tests {image_compression::{EncodedImageFormat, encode_rgb},};- use super::{- ATTACHMENT_IMAGE_JPEG_QUALITY, ATTACHMENT_IMAGE_MAX_LONG_EDGE, compress_attachment_image,- };+ use super::{ATTACHMENT_IMAGE_MAX_LONG_EDGE, compress_attachment_image};#[test]fn compress_attachment_image_uses_ensu_defaults() {@@ -35,9 +33,4 @@ mod tests {assert_eq!(decoded.dimensions.height, 256);assert!(output.len() < input.len());}-- #[test]- fn compression_quality_default_is_85() {- assert_eq!(ATTACHMENT_IMAGE_JPEG_QUALITY, 85);- }}diff --git a/rust/crates/ml/src/diagnostics.rs b/rust/crates/ml/src/diagnostics.rsindex 86965b78ef..ac6d49dc0e 100644--- a/rust/crates/ml/src/diagnostics.rs+++ b/rust/crates/ml/src/diagnostics.rs@@ -422,7 +422,6 @@ mod tests {#[test]fn fast_analysis_emits_no_watchdog_events() {- assert_eq!(SLOW_ANALYSIS_THRESHOLD, Duration::from_secs(60));let started_at = Instant::now();let mut state = MonitorState::default();state.register(1, context(42), AnalysisStage::DecodeImage, started_at);diff --git a/server/pkg/controller/email/storage_warning_test.go b/server/pkg/controller/email/storage_warning_test.goindex a59bcc2746..1942aaf4e2 100644--- a/server/pkg/controller/email/storage_warning_test.go+++ b/server/pkg/controller/email/storage_warning_test.go@@ -11,7 +11,6 @@ import ("github.com/ente/museum/internal/testutil""github.com/ente/museum/pkg/repo""github.com/ente/museum/pkg/utils/billing"- "github.com/ente/museum/pkg/utils/rollout""github.com/ente/museum/pkg/utils/time"log "github.com/sirupsen/logrus")@@ -30,32 +29,6 @@ func (r *recordingUserAccessResetter) ResetUserAccess(_ context.Context, _ int64return r.err}-func TestBucketStorageWarningActiveOverage(t *testing.T) {- now := int64(100)- effectiveExpiry := now + 10- expiredWarningAnchor := now + 20- allottedStorage := int64(50)- totalUsage := allottedStorage + storageWarningOverageThreshold + 1-- got := bucketStorageWarning(totalUsage, allottedStorage, effectiveExpiry, expiredWarningAnchor, now)- if got != storageWarningBucketActiveOverage {- t.Fatalf("unexpected bucket: got %q want %q", got, storageWarningBucketActiveOverage)- }-}--func TestBucketStorageWarningExpired(t *testing.T) {- effectiveExpiry := int64(90)- expiredWarningAnchor := int64(100)- now := expiredWarningAnchor- allottedStorage := int64(0)- totalUsage := allottedStorage + storageWarningOverageThreshold + 1-- got := bucketStorageWarning(totalUsage, allottedStorage, effectiveExpiry, expiredWarningAnchor, now)- if got != storageWarningBucketExpired {- t.Fatalf("unexpected bucket: got %q want %q", got, storageWarningBucketExpired)- }-}-func TestBucketStorageWarningWaitsForExpiredWarningAnchor(t *testing.T) {effectiveExpiry := int64(100)expiredWarningAnchor := effectiveExpiry + storageWarningExpiredAnchorDelay@@ -301,44 +274,6 @@ func TestResolveExpiredWarningStage(t *testing.T) {}}-func TestResolveExpiredWarningUsesBufferedCycleForLateBackfill(t *testing.T) {- expiredWarningAnchor := int64(100)- now := expiredWarningAnchor + storageWarningExpiredWarning119Delay + 10- got := resolveExpiredWarning(expiredWarningAnchor, now, map[string]int64{})-- if got.Stage != expiredWarningStage0 {- t.Fatalf("unexpected stage: got %q want %q", got.Stage, expiredWarningStage0)- }- if !got.BufferedCycle {- t.Fatal("expected late backfill to use a buffered cycle")- }- if got.CycleStart != now {- t.Fatalf("unexpected cycle start: got %d want %d", got.CycleStart, now)- }- wantAutoDeleteDate := now + storageWarningExpiredBackfillMinRecoveryDelay- if got.AutoDeleteDate != wantAutoDeleteDate {- t.Fatalf("unexpected auto delete date: got %d want %d", got.AutoDeleteDate, wantAutoDeleteDate)- }-}--func TestResolveExpiredWarningBufferedCycleKeepsLaterHistoricalDeleteDate(t *testing.T) {- expiredWarningAnchor := int64(100)- now := expiredWarningAnchor + storageWarningExpiredBackfillThreshold + 10-- got := resolveExpiredWarning(expiredWarningAnchor, now, map[string]int64{})-- if got.Stage != expiredWarningStage0 {- t.Fatalf("unexpected stage: got %q want %q", got.Stage, expiredWarningStage0)- }- if !got.BufferedCycle {- t.Fatal("expected late first contact to use buffered cycle")- }- wantAutoDeleteDate := expiredWarningAnchor + storageWarningExpiredDeletionDelay- if got.AutoDeleteDate != wantAutoDeleteDate {- t.Fatalf("unexpected auto delete date: got %d want %d", got.AutoDeleteDate, wantAutoDeleteDate)- }-}-func TestResolveExpiredWarningBufferedCycleProgressesFromPersistedHistory(t *testing.T) {cycleStart := int64(100)autoDeleteDate := cycleStart + storageWarningExpiredBackfillMinRecoveryDelay@@ -506,19 +441,6 @@ func TestResolveActiveOverageWarningReturnsCycleStart(t *testing.T) {}}-func TestStorageWarningTemplateSentInCycle(t *testing.T) {- history := map[string]int64{- storageWarningExpired30TemplateID: 50,- }-- if storageWarningTemplateSentInCycle(history, storageWarningExpired30TemplateID, 100) {- t.Fatal("expected prior-cycle send to be ignored")- }- if !storageWarningTemplateSentInCycle(history, storageWarningExpired30TemplateID, 50) {- t.Fatal("expected same-cycle send to be considered")- }-}-func TestStorageWarningCadenceBroken(t *testing.T) {now := storageWarningActiveOverageDeletionDelay + (10 * storageWarningOneDayInMicroseconds)@@ -820,44 +742,6 @@ func TestStorageWarningPreviousStageFreshnessWindowForSnapshot(t *testing.T) {}}-func TestBuildStorageWarningCadenceAlert(t *testing.T) {- snapshot := storageWarningSnapshot{- RecipientID: 123,- Bucket: storageWarningBucketExpired,- ExpiredStage: expiredWarningStage90,- TotalUsage: 75,- AllottedStorage: 10,- EffectiveExpiry: 1,- }-- got := buildStorageWarningCadenceAlert(snapshot, string(expiredWarningStage60), 0)- for _, want := range []string{- "recipient_id=123",- "bucket=expired",- "intended_stage=expired_90d",- "previous_required_stage=expired_60d",- "previous_sent_time=missing",- "total_usage=75",- "allotted_storage=10",- } {- if !strings.Contains(got, want) {- t.Fatalf("expected alert to contain %q, got %q", want, got)- }- }-}--func TestStorageWarningNotificationGroup(t *testing.T) {- if got := storageWarningNotificationGroup(storageWarningBucketActiveOverage); got != storageWarningActiveOverageNotificationGroup {- t.Fatalf("unexpected active overage notification group: got %q want %q", got, storageWarningActiveOverageNotificationGroup)- }- if got := storageWarningNotificationGroup(storageWarningBucketExpired); got != storageWarningExpiredNotificationGroup {- t.Fatalf("unexpected expired notification group: got %q want %q", got, storageWarningExpiredNotificationGroup)- }- if got := storageWarningNotificationGroup(storageWarningBucketNone); got != "" {- t.Fatalf("unexpected notification group for none bucket: got %q want empty", got)- }-}-func TestMergeStorageWarningCandidatesDeduplicatesAndKeepsFamilyPlan(t *testing.T) {candidates := mergeStorageWarningCandidates([]repo.StorageWarningCandidate{@@ -900,60 +784,6 @@ func TestStorageWarningShouldPreserveActiveOverageHistory(t *testing.T) {}}-func TestStorageWarningTemplateDetailsExpired(t *testing.T) {- snapshot := storageWarningSnapshot{- Bucket: storageWarningBucketExpired,- ExpiredStage: expiredWarningStage90,- }- templateID, templateName, subject, ok := storageWarningTemplateDetails(snapshot)- if !ok {- t.Fatal("expected expired bucket template details")- }- if templateID != storageWarningExpired90TemplateID || templateName != storageWarningExpiredTemplate || subject != storageWarningExpired90Subject {- t.Fatalf("unexpected expired template details: %q %q %q", templateID, templateName, subject)- }-}--func TestStorageWarningTemplateDetailsScheduledDeletion(t *testing.T) {- expiredSnapshot := storageWarningSnapshot{- Bucket: storageWarningBucketExpired,- ExpiredStage: expiredWarningStageScheduledDeletion,- }- templateID, templateName, subject, ok := storageWarningTemplateDetails(expiredSnapshot)- if !ok {- t.Fatal("expected expired scheduled deletion template details")- }- if templateID != repo.StorageWarningExpiredScheduledDeletionTemplateID || templateName != storageWarningExpiredScheduledDeletionTemplate || subject != storageWarningExpiredScheduledDeletionSubject {- t.Fatalf("unexpected expired scheduled deletion template details: %q %q %q", templateID, templateName, subject)- }-- activeSnapshot := storageWarningSnapshot{- Bucket: storageWarningBucketActiveOverage,- ActiveOverageStage: activeOverageWarningStageScheduledDeletion,- }- templateID, templateName, subject, ok = storageWarningTemplateDetails(activeSnapshot)- if !ok {- t.Fatal("expected active overage scheduled deletion template details")- }- if templateID != repo.StorageWarningActiveOverageScheduledDeletionTemplateID || templateName != storageWarningActiveOverageScheduledDeletionTemplate || subject != storageWarningActiveOverageScheduledDeletionSubject {- t.Fatalf("unexpected active overage scheduled deletion template details: %q %q %q", templateID, templateName, subject)- }-}--func TestStorageWarningTemplateDetailsActiveOverage(t *testing.T) {- snapshot := storageWarningSnapshot{- Bucket: storageWarningBucketActiveOverage,- ActiveOverageStage: activeOverageWarningStage60,- }- templateID, templateName, subject, ok := storageWarningTemplateDetails(snapshot)- if !ok {- t.Fatal("expected active overage template details")- }- if templateID != storageWarningActiveOverage60TemplateID || templateName != storageWarningActiveOverageTemplate || subject != storageWarningActiveOverage60Subject {- t.Fatalf("unexpected active overage template details: %q %q %q", templateID, templateName, subject)- }-}-func TestProcessStorageWarningSnapshotScheduledDeletionSkipsResetWhenEmailFails(t *testing.T) {originalSendStorageWarningTemplatedEmail := sendStorageWarningTemplatedEmailoriginalPersistStorageWarningHistory := persistStorageWarningHistory@@ -1307,24 +1137,6 @@ func TestProcessStorageWarningSnapshotClearsLoginGraceAfterRecovery(t *testing.T}}-func TestBuildStorageWarningRunSummary(t *testing.T) {- stats := newStorageWarningRunStats()- stats.ProcessedUsers = 42- stats.SentEmails = 3- stats.SuccessByStage[string(expiredWarningStage0)] = 1- stats.SuccessByStage[string(activeOverageWarningStage0)] = 2- stats.FailureByStage[string(activeOverageWarningStage60)] = 1- stats.SkippedRolloutByStage[string(expiredWarningStage30)] = 39- stats.PreStageFailures = 4- stats.SkippedRolloutPct = 39-- got := buildStorageWarningRunSummary(stats, 0)- want := "Storage warning run summary (1970-01-01T00:00:00Z): processed=42 | sent=3 | success={expired_0d=1, active_overage_0d=2} | failures={active_overage_60d=1} | skipped_rollout={expired_30d=39} | pre_stage_failures=4 | skipped_rollout_percentage=39 | rollout_percentage=100"- if got != want {- t.Fatalf("unexpected summary:\n got: %s\nwant: %s", got, want)- }-}-func TestStorageWarningHistoryGroup(t *testing.T) {if got := storageWarningHistoryGroup(storageWarningSnapshot{Bucket: storageWarningBucketActiveOverage,@@ -1339,41 +1151,3 @@ func TestStorageWarningHistoryGroup(t *testing.T) {t.Fatalf("unexpected terminal history group: got %q want empty", got)}}--func TestStorageWarningShouldResetUserAccess(t *testing.T) {- if !storageWarningShouldResetUserAccess(storageWarningSnapshot{- Bucket: storageWarningBucketExpired,- ExpiredStage: expiredWarningStageScheduledDeletion,- }) {- t.Fatal("expected expired scheduled deletion stage to reset access")- }- if !storageWarningShouldResetUserAccess(storageWarningSnapshot{- Bucket: storageWarningBucketActiveOverage,- ActiveOverageStage: activeOverageWarningStageScheduledDeletion,- }) {- t.Fatal("expected active overage scheduled deletion stage to reset access")- }- if storageWarningShouldResetUserAccess(storageWarningSnapshot{- Bucket: storageWarningBucketActiveOverage,- ActiveOverageStage: activeOverageWarningStage89,- }) {- t.Fatal("expected non-terminal stage to not reset access")- }-}--func TestIsInStorageWarningRollout(t *testing.T) {- const userID int64 = 12345-- if !isInStorageWarningRollout(userID, "[email protected]") {- t.Fatal("expected @ente.io account to always be in rollout")- }- if !isInStorageWarningRollout(userID, " [email protected] ") {- t.Fatal("expected normalized @ente.com account to always be in rollout")- }-- want := rollout.IsInPercentageRollout(userID, storageWarningRolloutNonce, storageWarningRolloutPercentage)- got := isInStorageWarningRollout(userID, "[email protected]")- if got != want {- t.Fatalf("unexpected percentage rollout decision: got %v want %v", got, want)- }-}diff --git a/server/pkg/controller/usage_test.go b/server/pkg/controller/usage_test.godeleted file mode 100644index e64d3b34b4..0000000000--- a/server/pkg/controller/usage_test.go+++ /dev/null@@ -1,27 +0,0 @@-package controller--import "testing"--func TestGetLockerLimitsForTier(t *testing.T) {- freeLimits := GetLockerLimitsForTier(false)- if freeLimits.IsPaid {- t.Fatal("expected free locker limits to report unpaid tier")- }- if freeLimits.FileLimit != lockerFreeFileLimit {- t.Fatalf("unexpected free locker file limit: %d", freeLimits.FileLimit)- }- if freeLimits.StorageLimit != lockerFreeStorageLimit {- t.Fatalf("unexpected free locker storage limit: %d", freeLimits.StorageLimit)- }-- paidLimits := GetLockerLimitsForTier(true)- if !paidLimits.IsPaid {- t.Fatal("expected paid locker limits to report paid tier")- }- if paidLimits.FileLimit != lockerPaidFileLimit {- t.Fatalf("unexpected paid locker file limit: %d", paidLimits.FileLimit)- }- if paidLimits.StorageLimit != lockerPaidStorageLimit {- t.Fatalf("unexpected paid locker storage limit: %d", paidLimits.StorageLimit)- }-}diff --git a/web/packages/contacts/index.test.ts b/web/packages/contacts/index.test.tsindex d9541189f6..7e30964be6 100644--- a/web/packages/contacts/index.test.ts+++ b/web/packages/contacts/index.test.ts@@ -1,68 +1,4 @@import { beforeEach, describe, expect, test, vi } from "vitest";-import { resolveContactDisplayFromSnapshot } from "./resolver";-import type { ContactsDisplaySnapshot } from "./types";--const makeSnapshot = (): ContactsDisplaySnapshot => ({- isHydrated: true,- recordsByUserID: new Map([- [- 101,- {- contactId: "c_1",- contactUserId: 101,- resolvedEmail: "[email protected]",- displayName: "Set",- profilePictureAttachmentID: "a_1",- updatedAt: 1,- },- ],- ]),- recordsByEmail: new Map([- [- "[email protected]",- {- contactId: "c_1",- contactUserId: 101,- resolvedEmail: "[email protected]",- displayName: "Set",- profilePictureAttachmentID: "a_1",- updatedAt: 1,- },- ],- ]),- avatarURLsByContactID: new Map(),-});--describe("resolveContactDisplayFromSnapshot", () => {- test("prefers contact name by user id", () => {- const resolved = resolveContactDisplayFromSnapshot(makeSnapshot(), {- userID: 101,- email: "[email protected]",- });-- expect(resolved.primaryLabel).toBe("Set");- expect(resolved.actualEmail).toBe("[email protected]");- expect(resolved.source).toBe("contact");- });-- test("falls back to email when no contact exists", () => {- const resolved = resolveContactDisplayFromSnapshot(makeSnapshot(), {- email: "[email protected]",- });-- expect(resolved.primaryLabel).toBe("[email protected]");- expect(resolved.actualEmail).toBe("[email protected]");- expect(resolved.source).toBe("fallback");- });-- test("returns an empty label when no user or email exists", () => {- const resolved = resolveContactDisplayFromSnapshot(makeSnapshot(), {});-- expect(resolved.primaryLabel).toBe("");- expect(resolved.initial).toBe("?");- expect(resolved.source).toBe("fallback");- });-});beforeEach(() => {vi.resetModules();diff --git a/web/packages/wasm/core/tests/auth.test.ts b/web/packages/wasm/core/tests/auth.test.tsindex 81ca391fd5..d21a273dd9 100644--- a/web/packages/wasm/core/tests/auth.test.ts+++ b/web/packages/wasm/core/tests/auth.test.ts@@ -1,7 +1,6 @@import { expect, test } from "vitest";import {auth_generate_interactive_kek,- auth_generate_sensitive_kek,auth_generate_srp_setup,auth_recovery_key_from_mnemonic_or_hex,auth_recovery_key_to_mnemonic,@@ -19,17 +18,6 @@ test("generates an interactive kek bundle", () => {expect(generated.ops_limit).toBe(2);});-test("generates a sensitive kek bundle", () => {- const generated = auth_generate_sensitive_kek(- "correct horse battery staple",- );-- expect(Buffer.from(generated.key, "base64")).toHaveLength(32);- expect(Buffer.from(generated.salt, "base64")).toHaveLength(16);- expect(generated.mem_limit).toBeGreaterThan(0);- expect(generated.ops_limit).toBeGreaterThan(0);-});-test("generates SRP setup attributes from a kek", () => {const kek = crypto_generate_key();const generated = auth_generate_srp_setup(kek, "test-user-id");