Skip to content

Conversation

@CareF
Copy link
Contributor

@CareF CareF commented Jul 31, 2020

Description

This is part of #62064 to promote pumpAndSettle from WidgetTester to WidgetController.
And as part of the style guide, I removed timeout optional argument.

Related Issues

#61511

Tests

I added 'Test pump on LiveWidgetController' in packages/flutter_test/test/live_widget_controller_test.dart.

Checklist

Before you create this PR, confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.

@CareF CareF requested a review from liyuqian July 31, 2020 03:29
@CareF CareF self-assigned this Jul 31, 2020
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@flutter-dashboard flutter-dashboard bot added a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels. labels Jul 31, 2020
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@CareF CareF marked this pull request as draft July 31, 2020 03:29
@CareF
Copy link
Contributor Author

CareF commented Jul 31, 2020

By breaking change I mean change the order argument EnginePhase phase of WidgetTester.pumpAndSettle to last. Though None of our usage of this method in the flutter/flutter repo use this argument, and I really can't think of a case when we need to put this argument when test, rather, timeout is more reasonably needed.

But of course I can avoid breaking change by removing timeout in the WidgetController methods, which IMHO is a bad design.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throwing an exception when there's no back button still seems to be desired. As expectSync may not be available from WidgetController, maybe we can use something else (e.g., FlutterError). That way, we can probably still preserve the fails when there are no back buttons test with a small modification.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it really is desired/consistent with other APIs. By removing the pageBack method, IDE reminds me that the matcher.dart is no longer needed: basically this method is the only method expecting the existence of a finder, while all other methods are assuming a finder exists, and rely on when really evaluating a finder to raise an error.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this whole method is a bit dubious to be honest (we really shouldn't be depending on material or cupertino in flutter_test). It's all just convenience methods. So once we have them anyway, why not also make sure there's a back button.

That said, whether we throw a FlutterError or a TestError (or whatever expectSync fires) doesn't seem to matter that much. This is a test framework, so expectSync is not unreasonable IMHO.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as it is you're still going to through when you try to tap a the button and there isn't one

@CareF
Copy link
Contributor Author

CareF commented Aug 3, 2020

So I reverted the change of pageback and will expect to implement it when need. I would feel it's more elegant to have the WidgetController not depending too much of a test context.

@CareF CareF changed the title promote WidgetTester pumpAndSettle and pageback promote WidgetTester pumpAndSettle Aug 3, 2020
@CareF CareF requested a review from liyuqian August 3, 2020 19:58
@CareF
Copy link
Contributor Author

CareF commented Aug 4, 2020

@liyuqian I'm not sure if there is any non-public google3 test we need to try to confirm it is not a break test in sense of https://github.com/flutter/flutter/wiki/Tree-hygiene#1-determine-if-your-change-is-a-breaking-change

@liyuqian
Copy link
Contributor

liyuqian commented Aug 4, 2020

@CareF I started the Google internal tests in cl/324724889. You may not have access to it so I'll help you check it. The results should be in tomorrow morning so we can go through it by sharing my screen in our 1:1 meeting.

Copy link
Contributor

@liyuqian liyuqian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. This approval should also trigger the "Google testing" check. It should check whether this breaks any Google internal tests.

@fluttergithubbot fluttergithubbot merged commit a36b0ba into flutter:master Aug 4, 2020
@CareF CareF deleted the promote_pumpandsettle_and_pageback branch August 5, 2020 02:19
Pragya007 pushed a commit to Pragya007/flutter that referenced this pull request Aug 11, 2020
mingwandroid pushed a commit to mingwandroid/flutter that referenced this pull request Sep 6, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants