[go: nahoru, domu]

Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[instrumentation_adapter] Add support for running tests with Flutter driver #2050

Merged
merged 3 commits into from
Sep 9, 2019

Conversation

collinjackson
Copy link
Contributor
@collinjackson collinjackson commented Sep 9, 2019

The instrumentation_adapter plugin doesn't support iOS yet, but we'd like to start sharing integration test code between iOS and Android.

Our existing plugin integration tests are using test() from package:test rather than testWidgets(). This won't work with the instrumentation_adapter plugin -- they need to be converted over to use testWidgets to ensure that the tests results are reported properly. But testWidgets() only works when the TestWidgetsFlutterBinding is initialized, and the Flutter driver extension uses a binding that doesn't extend TestWidgetsFlutterBinding.

By emulating the Flutter driver extension in the instrumentation_adapter, we can ensure that existing tests can be converted to Flutter plugins CI using the flutter_plugin_tools drive-examples command by replacing the call to enableFlutterDriverExtension with InstrumentationAdapterFlutterBinding.ensureInitialized()

Required for landing #2025

@collinjackson collinjackson changed the title Add support for running tests with Flutter driver [instrumentation_adapter] Add support for running tests with Flutter driver Sep 9, 2019
return <String, dynamic>{
'isError': false,
'response': response,
};
Copy link
Contributor

Choose a reason for hiding this comment

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

When would this function return "isError": true?

Copy link
Contributor Author
@collinjackson collinjackson Sep 9, 2019

Choose a reason for hiding this comment

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

We have to attach 'isError': false to the return value or the response will be rejected by FlutterDriver. I thought about returning 'isError': true in the event of test failure, but decided not to for now to match the current behavior running tests under Flutter driver.

Copy link
Contributor
@digiter digiter left a comment

Choose a reason for hiding this comment

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

LGTM

@collinjackson collinjackson merged commit 4bda246 into flutter:master Sep 9, 2019
@collinjackson collinjackson deleted the flutter_driver_support branch September 9, 2019 15:59
noelmansour pushed a commit to snowble/plugins that referenced this pull request Nov 13, 2019
mormih pushed a commit to mormih/plugins that referenced this pull request Nov 17, 2019
sungmin-park pushed a commit to sungmin-park/flutter-plugins that referenced this pull request Dec 17, 2019
julianscheel pushed a commit to jusst-engineering/plugins that referenced this pull request Mar 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
3 participants