这是indexloc提供的服务,不要输入任何密码
Skip to content

[e2e] make test bindings friendlier to integration tests #58210

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

Merged
merged 2 commits into from
May 29, 2020

Conversation

dnfield
Copy link
Contributor

@dnfield dnfield commented May 29, 2020

Description

Integration tests may not want to override testTextInput or HttpClient. This lets binding subclasses for tests achieve that.

Related Issues

Part of #51885
Part of #57623

Tests

I added the following tests:

Test that the default bindings do override HttpClient and register TestTextInput.
Test that custom bindings using the new properties do not override/register.

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.

@dnfield dnfield requested review from goderbauer and nturgut May 29, 2020 00:01
@fluttergithubbot fluttergithubbot added a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels. labels May 29, 2020
if (overrideHttpClient) {
binding.setupHttpOverrides();
}
_testTextInput = TestTextInput(onCleared: _resetFocusedEditable);
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be inside the if case?

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'd rather not change this to be nullable - creating it does not automatically alter any global state (until register is called).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And I've updated TestTextInput in another patch to assert that it's registered for any method that wouldn't make sense in an unregistered context.

Copy link
Contributor

Choose a reason for hiding this comment

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

sgtm

Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

LGTM

@dnfield dnfield merged commit 68b131f into flutter:master May 29, 2020
@dnfield dnfield deleted the test_bindings branch May 29, 2020 18:50
@nturgut
Copy link
Contributor

nturgut commented May 29, 2020

Thanks for the change, I was still looking at the PR. LGTM!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 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