-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Running an integration test using E2E and Flutter Driver for testing flutter web engine #49833
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
Conversation
…side. adding 2 screenshots tests to e2e tests. normal screenshot test example with chrome to hello_world_test.dart
collinjackson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks promising!
Would it make sense to do the E2E binding as a PR on the package?https://github.com/flutter/plugins/tree/master/packages/e2e
Or do you think this class should be landed in the framework repo?
The text input binding changes require some cleanup but I think those are still in progress.
|
|
||
| final Mutex screenshotLock = new Mutex(); | ||
|
|
||
| Future<void> takeScreenshot(String testName) async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a public API, it should be documented.
I'm wondering if we should automatically use the currently active group and test name if the developer doesn't provide a string. This might make tests more terse.
|
|
||
| static Map<String, String> _results = <String, String>{}; | ||
|
|
||
| // Emulates the Flutter driver extension, returning 'pass' or 'fail'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update this comment (perhaps the API can be unit tested?)
| print('exception $exception'); | ||
| } | ||
|
|
||
| /// For flutter web tests we want to use the real messages instead of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// For flutter web tests we want to use the real messages instead of | |
| /// For Flutter web tests we want to use the real messages instead of |
|
|
||
| /// For flutter web tests we want to use the real messages instead of | ||
| /// test messages. | ||
| /// See [TestDefaultBinaryMessenger]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should have a blank line, then "See also:", then another blank line, then a bulleted list.
Example:
| /// See also: |
| } | ||
|
|
||
| if (kIsWeb) { | ||
| print('****************** kisweb'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
| /// Registers Web Service Extension for Flutter Web application. | ||
| /// | ||
| /// window.$flutterDriver will be called by Flutter Web Driver to process | ||
| /// Flutter Command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// Flutter Command. | |
| /// Flutter command. |
| binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive; | ||
| }); | ||
|
|
||
| // Failing tests always halt. They timeout after 12 minutes and fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests shouldn't have to time out to fail. In the future, await tester.pumpAndSettle() will be unnecessary.
| await binding.takeScreenshot('focusedInput'); | ||
| }); | ||
|
|
||
| // For some reason we need to explicity call complete with flutter for web |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems worth addressing before landing
| Completer<String> screenshotPipe = Completer<String>(); | ||
| Completer<bool> waitingForDriverScreenshot = Completer<bool>(); | ||
|
|
||
| final Mutex screenshotLock = new Mutex(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be private
|
|
||
| final Completer<bool> allTestsPassed = Completer<bool>(); | ||
| Completer<String> screenshotPipe = Completer<String>(); | ||
| Completer<bool> waitingForDriverScreenshot = Completer<bool>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be private
Yes I will send changes to the e2e package. |
|
(triage) @nturgut Are you still working on this one? It has been marked as WIP, but there haven't been any updates recently. |
When I tried closing draft PRs in other cases the comments became invisible. I still want to use the comments on this PR so I am keeping this one open. Thanks, Nurhan |
| BinaryMessenger createBinaryMessenger() { | ||
| if (kIsWeb) { | ||
| print('****************** kisweb return real binary messenger'); | ||
| return super.createOriginalBinaryMessenger(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TestDefaultBinaryMessenger exposes the wrapped BinaryMessenger as a public delegate property. Can we take super.createBinaryMessenger(), assert that it's a TestDefaultBinaryMessenger, and read delegate so that we don't need to change the TestWidgetsFlutterBinding API?
It's also unclear to me why we need the real binary messenger here. It seems like all TestDefaultBinaryMessenger is doing is wrapping the real messenger and providing a platformMessagesFinished API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear, what I'm proposing is:
TestDefaultBinaryMessenger messenger = super.createBinaryMessenger();
return messenger.delegate;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That said, it may be fine to use the TestDefaultBinaryMessenger since all it is doing is proxying calls to the delegate and exposing a platformMessagesFinished API. If it doesn't work, I'm curious why.
|
Closing the PR not to interrupt flutter triage. The code is still in discussion. |
Description
Replace this paragraph with a description of what this PR is doing. If you're modifying existing behavior, describe the existing behavior, how this PR is changing it, and what motivated the change. If you're changing visual properties, consider including before/after screenshots (and runnable code snippets to reproduce them).
Related Issues
Replace this paragraph with a list of issues related to this PR from our issue database. Indicate, which of these issues are resolved or fixed by this PR. There should be at least one issue listed here.
Tests
I added the following tests:
Replace this with a list of the tests that you added as part of this PR. A change in behaviour with no test covering it
will likely get reverted accidentally sooner or later. PRs must include tests for all changed/updated/fixed behaviors. See Test Coverage.
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.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.