Skip to content

Conversation

@nturgut
Copy link
Contributor

@nturgut nturgut commented Jan 30, 2020

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.

  • 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.
  • Yes, this is a breaking change. If not, delete the remainder of this section.

@nturgut nturgut added a: tests "flutter test", flutter_test, or one of our tests cla: no labels Jan 30, 2020
@fluttergithubbot fluttergithubbot added d: examples Sample code and demos framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. labels Jan 30, 2020
…side. adding 2 screenshots tests to e2e tests. normal screenshot test example with chrome to hello_world_test.dart
@collinjackson collinjackson self-requested a review February 4, 2020 18:28
Copy link
Contributor

@collinjackson collinjackson left a 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 {
Copy link
Contributor

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'.
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// 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].
Copy link
Contributor

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:

}

if (kIsWeb) {
print('****************** kisweb');
Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// Flutter Command.
/// Flutter command.

binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
});

// Failing tests always halt. They timeout after 12 minutes and fail.
Copy link
Contributor

Choose a reason for hiding this comment

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

await binding.takeScreenshot('focusedInput');
});

// For some reason we need to explicity call complete with flutter for web
Copy link
Contributor

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();
Copy link
Contributor

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>();
Copy link
Contributor

Choose a reason for hiding this comment

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

should be private

@nturgut
Copy link
Contributor Author

nturgut commented Feb 4, 2020

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.
The PR is to show a running demo :)

Yes I will send changes to the e2e package.

@goderbauer
Copy link
Member

(triage) @nturgut Are you still working on this one? It has been marked as WIP, but there haven't been any updates recently.

@nturgut
Copy link
Contributor Author

nturgut commented Feb 20, 2020

(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

@Piinks Piinks added the platform-web Web applications specifically label Feb 21, 2020
BinaryMessenger createBinaryMessenger() {
if (kIsWeb) {
print('****************** kisweb return real binary messenger');
return super.createOriginalBinaryMessenger();
Copy link
Contributor

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.

Copy link
Contributor

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;

Copy link
Contributor

@collinjackson collinjackson Feb 22, 2020

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.

@nturgut
Copy link
Contributor Author

nturgut commented Feb 27, 2020

Closing the PR not to interrupt flutter triage. The code is still in discussion.

@nturgut nturgut closed this Feb 27, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 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 c: contributor-productivity Team-specific productivity, code health, technical debt. d: examples Sample code and demos framework flutter/packages/flutter repository. See also f: labels. platform-web Web applications specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants