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

Conversation

@nturgut
Copy link
Contributor

@nturgut nturgut commented Oct 19, 2020

Description

Web integration tests were failing for MousePointer events. This PR is fixing this by setting TestBindingEventSource to TestBindingEventSource.test for web integration_tests.

Related Issues

Fixes flutter/flutter#68502

Tests

Tests are added to test the pointer gestures.

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.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • [] All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

@nturgut nturgut requested a review from dnfield as a code owner October 19, 2020 18:18
@google-cla google-cla bot added the cla: yes label Oct 19, 2020
@nturgut
Copy link
Contributor Author

nturgut commented Oct 19, 2020

@ferhatb This is the PR which will fix scroll for PR flutter/engine#21928

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

Can we add a test that would fail without this change?

Also, I'm a bit surprised that we'd need this on we but not on desktop or mobile. Why is that?

@nturgut
Copy link
Contributor Author

nturgut commented Oct 19, 2020

I'm not sure about mobile or desktop actually that's why I only set web. Any opinion if the device

Can we add a test that would fail without this change?

Also, I'm a bit surprised that we'd need this on we but not on desktop or mobile. Why is that?

This happens when we generate MouseEvents via dart:html. I will add a web tests, I don't know how mobile/desktop generate PointerEvents for testing purposes therefore I'm not sure if they will have the same issue.

@nturgut nturgut requested a review from dnfield October 19, 2020 23:56
@nturgut
Copy link
Contributor Author

nturgut commented Oct 19, 2020

I'm not sure about mobile or desktop actually that's why I only set web. Any opinion if the device

Can we add a test that would fail without this change?
Also, I'm a bit surprised that we'd need this on we but not on desktop or mobile. Why is that?

This happens when we generate MouseEvents via dart:html. I will add a web tests, I don't know how mobile/desktop generate PointerEvents for testing purposes therefore I'm not sure if they will have the same issue.

Added a test for incrementing the counter by dispatching events. PHAL!

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

LGTM.

We can worry about whether desktop platforms need this later, since it's not clear yet to me that they would.


// Verify that counter is clicked.
expect(finder, findsOneWidget);
expect(counter.data, '1');
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, can we assert earlier that this is '0'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! I'll make the change thanks :)

@dnfield
Copy link
Contributor

dnfield commented Oct 20, 2020

I'm a little confuse dabout the error in CI - why isn't it finding the super method when building?

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

see comments

Comment on lines 82 to 83
super.handlePointerEvent(pointerEvent,
source: TestBindingEventSource.test);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: trailing comma.

Why aren't we doing this in other test bindings? What's special about this one?

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 also added the other tests binding and update the comments. Fixing the assert statements didn't help since WidgetTester.dispatchEvent (code) is not acting on the gesture bindings, using TestBindingEventSource.device does not generate the expected results for a gesture.

TestBindingEventSource.test uses RenderBinding.dispatchEvent: https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/rendering/binding.dart#L271

@nturgut nturgut force-pushed the change_event_source branch from bba3cde to 665bc59 Compare October 28, 2020 20:39
@nturgut
Copy link
Contributor Author

nturgut commented Oct 28, 2020

@dnfield fixing the assert statements for PointerAdd/PointerRemove didn't help since the dispatchers used for the TestBindingEventSource.device also does not perform the operations we want during an end to end test.

Btw, looks like flutter driver is not working with integration_test package anymore, what is the quick solution we have? @ferhatb has a code that we need to get in (which uses scroll gestures)

@nturgut nturgut requested a review from dnfield October 28, 2020 22:20
@nturgut
Copy link
Contributor Author

nturgut commented Oct 28, 2020

Stable channel tests do not pass since the method we are using handlePointerEvents are not in the STABLE channel. How to skip these tests (or what is the process this cases)?

@stuartmorgan-g
Copy link
Contributor

Since integration_test has moved, this is presumably obsolete; closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[integration_test][web] TestBindingEventSource is not set correctly during integration tests

3 participants