tane/apps/app_seeds/test/ui/quick_add_flow_test.dart
vjrj 02a9d5bf39 feat(shell): home menu + navigation drawer (mockups 02/03)
The app now opens on a main menu instead of straight into the list:
- HomeScreen (mockup 02): sprout logo over a faint seed-glyph watermark, with
  big "Your inventory" (→ /inventory) and "Open market" (Block 2, "coming soon")
  destinations.
- AppDrawer (mockup 03): Inventory is live; the social items (market, profile,
  chat, wishlist, following, settings) are shown disabled with a "coming soon"
  tag so the roadmap is visible. Drawer is available on home and inventory.
- Routing: / → home, /inventory → list, /variety/:id → detail.

Tests: home shows the menu + navigates; drawer opens + navigates. quick-add flow
updated to go home → inventory. 50 green; Linux runs.
2026-07-08 12:22:42 +02:00

60 lines
1.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:tane/app.dart';
import 'package:tane/i18n/strings.g.dart';
import '../support/test_support.dart';
void main() {
testWidgets(
'quick-add: empty label errors; filling it saves and lists the seed',
(tester) async {
LocaleSettings.setLocaleSync(AppLocale.en);
final db = newTestDatabase();
addTearDown(db.close);
final repo = newTestRepository(db);
await tester.pumpWidget(
TranslationProvider(
child: TaneApp(
repository: repo,
species: newTestSpeciesRepository(db),
),
),
);
await tester.pumpAndSettle();
// Home → inventory.
await tester.tap(find.byKey(const Key('home.inventory')));
await tester.pumpAndSettle();
// Starts empty.
expect(
find.text('No seeds yet. Tap + to add your first.'),
findsOneWidget,
);
// Open the quick-add sheet.
await tester.tap(find.byKey(const Key('inventory.addFab')));
await tester.pumpAndSettle();
// Saving with an empty label surfaces the validation message.
await tester.tap(find.byKey(const Key('quickAdd.save')));
await tester.pumpAndSettle();
expect(find.text('Give it a name'), findsOneWidget);
// Enter a name and save.
await tester.enterText(
find.byKey(const Key('quickAdd.labelField')),
'Grandma tomato',
);
await tester.tap(find.byKey(const Key('quickAdd.save')));
await tester.pumpAndSettle();
// Sheet closed and the seed shows in the list.
expect(find.byKey(const Key('quickAdd.labelField')), findsNothing);
expect(find.text('Grandma tomato'), findsOneWidget);
await disposeTree(tester);
},
);
}