-
Notifications
You must be signed in to change notification settings - Fork 341
Get route-transition duration robustly,instead of hard-coding #1920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
2ea25f6
to
0de6501
Compare
Thanks. Some of these changes look good, but there are other places where a lot more code is getting changed and it's not obvious what the reasons for those changes are. That makes it considerably more work for someone to review, because they have to read through all those changes and reverse-engineer what your intent is. Please take a look at our guide to writing a clean commit history:
|
303dcc8
to
bfa6bb4
Compare
@gnprice I guess it's fine now. |
This is improved, but there are still some places like this:
For example: - testWidgets('can show snackbar on success', (tester) async {
- // Regression test for: https://github.com/zulip/zulip-flutter/issues/732
- testBinding.deviceInfoResult = const IosDeviceInfo(systemVersion: '16.0');
-
- final message = eg.streamMessage();
- await setupToMessageActionSheet(tester, message: message, narrow: TopicNarrow.ofMessage(messa
ge));
+ testWidgets('can show snackbar on success', (WidgetTester tester) async {
+ // Regression test for: https://github.com/zulip/zulip-flutter/issues/732
+ final TransitionDurationObserver transitionDurationObserver = TransitionDurationObserver();
+ await tester.pumpWidget(
+ MaterialApp(
+ navigatorObservers: <NavigatorObserver>[transitionDurationObserver],
+ home: Scaffold(
+ body: Builder(
+ builder: (context) {
+ testBinding.deviceInfoResult = const IosDeviceInfo(systemVersion: '16.0');
+ final message = eg.streamMessage();
+ setupToMessageActionSheet(tester,message: message,narrow: TopicNarrow.ofMessage(messa
ge));
+ return const SizedBox.shrink();}
+ ))));
+ final message = eg.streamMessage();
+ // Make the request take a bit of time to complete
+ prepareRawContentResponseSuccess(message: message,rawContent: 'Hello world',delay: const Durati
on(milliseconds: 500),
+ );
+ await tapCopyMessageTextButton(tester);
+ // … and pump a frame to finish the NavigationState.pop animation…
+ await transitionDurationObserver.pumpPastTransition(tester);
+ // … before the request finishes. This is the repro condition for #732.
+ await transitionDurationObserver.pumpPastTransition(tester);
- // Make the request take a bit of time to complete…
- prepareRawContentResponseSuccess(message: message, rawContent: 'Hello world',
- delay: const Duration(milliseconds: 500));
- await tapCopyMessageTextButton(tester);
- // … and pump a frame to finish the NavigationState.pop animation…
- await tester.pump(const Duration(milliseconds: 250));
- // … before the request finishes. This is the repro condition for #732.
- await tester.pump(const Duration(milliseconds: 250));
+ final snackbar = tester.widget<SnackBar>(find.byType(SnackBar));
+ check(snackbar.behavior).equals(SnackBarBehavior.floating);
- final snackbar = tester.widget<SnackBar>(find.byType(SnackBar));
- check(snackbar.behavior).equals(SnackBarBehavior.floating);
- final zulipLocalizations = GlobalLocalizations.zulipLocalizations;
- tester.widget(find.descendant(matchRoot: true,
+ final zulipLocalizations = GlobalLocalizations.zulipLocalizations;
+ tester.widget(find.descendant(matchRoot: true,
of: find.byWidget(snackbar.content),
- matching: find.text(zulipLocalizations.successMessageTextCopied)));
- });
+ matching: find.text(zulipLocalizations.successMessageTextCopied),
+ ));
+ });
+ Take a look again at the changes in your PR. Use
|
closes #1668