test(meditate): Today's cards scrolled to as its list builds them, the morning card or not
Two app tests failed before noon: from 4 to 12 o'clock Today's card for last night's dream pushes the cards below it down, and its list hadn't built Recently sat yet, which ensureVisible needs. They now scroll the list until the card is built (scrollToday), whatever the hour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
438ce20dbf
commit
55c73a7e16
1 changed files with 20 additions and 2 deletions
|
|
@ -15,6 +15,7 @@ import 'package:halkyon_meditate_flutter/src/feature/sitting/data/sitting_reposi
|
|||
import 'package:halkyon_meditate_flutter/src/feature/sitting/model/sitting.dart';
|
||||
import 'package:halkyon_meditate_flutter/src/feature/sitting/widget/sitting_screen.dart';
|
||||
import 'package:halkyon_meditate_flutter/src/tabs/journal_tab.dart';
|
||||
import 'package:halkyon_meditate_flutter/src/tabs/today_tab.dart';
|
||||
import 'package:halkyon_ui/halkyon_ui.dart';
|
||||
import 'package:lucide_icons_flutter/lucide_icons.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
|
|
@ -216,6 +217,23 @@ void main() {
|
|||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
/// Scrolls Today down until [finder] is built and in view: its list builds
|
||||
/// what's below lazily, and from 4 to 12 o'clock the morning card (D14)
|
||||
/// pushes the rest further down.
|
||||
Future<void> scrollToday(WidgetTester tester, Finder finder) async {
|
||||
await tester.scrollUntilVisible(
|
||||
finder,
|
||||
200,
|
||||
scrollable: find
|
||||
.descendant(
|
||||
of: find.byType(TodayTab),
|
||||
matching: find.byType(Scrollable),
|
||||
)
|
||||
.first,
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
/// Taps [finder] in a scrolling tab, scrolled into view first.
|
||||
Future<void> tapVisible(WidgetTester tester, Finder finder) async {
|
||||
await tester.ensureVisible(finder);
|
||||
|
|
@ -392,7 +410,7 @@ void main() {
|
|||
expect(find.widgetWithText(ActionChip, '$minutes min'), findsOneWidget);
|
||||
}
|
||||
expect(find.text('Practice of the day'), findsOneWidget);
|
||||
await tester.ensureVisible(find.text('Nothing sat yet.'));
|
||||
await scrollToday(tester, find.text('Nothing sat yet.'));
|
||||
expect(find.text('No days in a row yet'), findsOneWidget);
|
||||
expect(
|
||||
find.text(
|
||||
|
|
@ -442,7 +460,7 @@ void main() {
|
|||
await tester.tap(find.text('Done'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(NavigationBar), findsOneWidget);
|
||||
await tester.ensureVisible(find.text('Silent timer'));
|
||||
await scrollToday(tester, find.text('Silent timer'));
|
||||
expect(find.text('Silent timer'), findsOneWidget);
|
||||
expect(find.text('1 day in a row'), findsOneWidget);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue