Skip to content

Commit c87de41

Browse files
chrisbobbegnprice
authored andcommitted
msglist test: Wait through a nav-transition animation in a place we forgot
This should unblock the upstream PR flutter/flutter#165832 . Discussion: flutter/flutter#165832 (comment) (And, for consistency, also use upstream's new TransitionDurationObserver in a place we were getting a duration more manually. This weakens the test a bit, by removing checks that the duration comes from a popped route, with specific details of the route that was popped. Perhaps we can add a feature to TransitionDurationObserver to get those checks back, but not a priority for now.)
1 parent 6c0c1d8 commit c87de41

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

test/widgets/message_list_test.dart

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,16 +2135,14 @@ void main() {
21352135
});
21362136

21372137
testWidgets('hidden -> failed, tapping does nothing if compose box is not offered', (tester) async {
2138-
Route<dynamic>? lastPoppedRoute;
2139-
final navObserver = TestNavigatorObserver()
2140-
..onPopped = (route, prevRoute) => lastPoppedRoute = route;
2138+
final transitionDurationObserver = TransitionDurationObserver();
21412139

21422140
final messages = [eg.streamMessage(
21432141
stream: stream, topic: topic, content: content)];
21442142
await setupMessageListPage(tester,
21452143
narrow: const CombinedFeedNarrow(),
21462144
streams: [stream], subscriptions: [eg.subscription(stream)],
2147-
navObservers: [navObserver],
2145+
navObservers: [transitionDurationObserver],
21482146
messages: messages);
21492147

21502148
// Navigate to a message list page in a topic narrow,
@@ -2153,7 +2151,7 @@ void main() {
21532151
eg.newestGetMessagesResult(foundOldest: true, messages: messages).toJson());
21542152
await tester.tap(find.widgetWithText(RecipientHeader, topic));
21552153
await tester.pump(); // handle tap
2156-
await tester.pump(); // wait for navigation
2154+
await transitionDurationObserver.pumpPastTransition(tester);
21572155
check(contentInputFinder).findsOne();
21582156

21592157
await sendMessageAndFail(tester);
@@ -2162,12 +2160,8 @@ void main() {
21622160
// where the failed to send message should be visible.
21632161

21642162
await tester.pageBack();
2165-
check(lastPoppedRoute)
2166-
.isA<MaterialAccountWidgetRoute>().page
2167-
.isA<MessageListPage>()
2168-
.initNarrow.equals(TopicNarrow(stream.streamId, eg.t(topic)));
21692163
await tester.pump(); // handle tap
2170-
await tester.pump((lastPoppedRoute as TransitionRoute).reverseTransitionDuration);
2164+
await transitionDurationObserver.pumpPastTransition(tester);
21712165
check(contentInputFinder).findsNothing();
21722166
check(messageNotSentFinder).findsOne();
21732167

0 commit comments

Comments
 (0)