Skip to content
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

[webview_flutter] Make WebKitWebViewWidget unit tests stateless #6228

Merged
merged 3 commits into from
Mar 4, 2024

Conversation

stuartmorgan
Copy link
Contributor

This eliminates the state in the Dart unit tests for this class, bringing it into alignment with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#make-each-test-entirely-self-contained.

  • testController is now returned by buildWidget, which clarifies and enforces that the variable can only be used after buildWidget is called
  • All the mocks are now in a data object that is created via a configureMocks call in each test.

The latter will allow easily adjusting specific mocks in individual tests (vs having to create a new group that has an almost-identical duplicate of setUp, but with slight changes) which will be useful when adding macOS support, where the mock WKWebView will need to be a different class when testing macOS/iOS codepath divergence.

Copy link
Contributor

@bparrishMines bparrishMines left a comment

Choose a reason for hiding this comment

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

LGTM

@stuartmorgan stuartmorgan added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 4, 2024
@auto-submit auto-submit bot merged commit 05f97df into flutter:main Mar 4, 2024
78 checks passed
@stuartmorgan stuartmorgan deleted the webview-widget-test-refactor branch March 5, 2024 03:26
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 5, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 5, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 5, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Mar 5, 2024
flutter/packages@0625827...2aa6e3f

2024-03-05 gabriel@terwesten.net [in_app_purchase_storekit] Fix type of error code returned from native code in `SKReceiptManager.retrieveReceiptData` (flutter/packages#6265)
2024-03-05 slowhand0309@gmail.com [video_player] Fix typo in readme (flutter/packages#6264)
2024-03-05 10687576+bparrishMines@users.noreply.github.com [pigeon] Separates message call code generation into separate methods in the SwiftGenerator (flutter/packages#5959)
2024-03-05 5384625+pzierahn@users.noreply.github.com [flutter_markdown] Fix WidgetSpan Support in MarkdownElementBuilder (flutter/packages#6225)
2024-03-04 stuartmorgan@google.com [webview_flutter] Make WebKitWebViewWidget unit tests stateless (flutter/packages#6228)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
LouiseHsu pushed a commit to LouiseHsu/packages that referenced this pull request Mar 7, 2024
…ter#6228)

This eliminates the state in the Dart unit tests for this class, bringing it into alignment with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#make-each-test-entirely-self-contained.
- `testController` is now returned by `buildWidget`, which clarifies and enforces that the variable can only be used after `buildWidget` is called
- All the mocks are now in a data object that is created via a `configureMocks` call in each test.

The latter will allow easily adjusting specific mocks in individual tests (vs having to create a new group that has an almost-identical duplicate of `setUp`, but with slight changes) which will be useful when adding macOS support, where the mock `WKWebView` will need to be a different class when testing macOS/iOS codepath divergence.
arc-yong pushed a commit to Arctuition/packages-arc that referenced this pull request Jun 14, 2024
…ter#6228)

This eliminates the state in the Dart unit tests for this class, bringing it into alignment with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#make-each-test-entirely-self-contained.
- `testController` is now returned by `buildWidget`, which clarifies and enforces that the variable can only be used after `buildWidget` is called
- All the mocks are now in a data object that is created via a `configureMocks` call in each test.

The latter will allow easily adjusting specific mocks in individual tests (vs having to create a new group that has an almost-identical duplicate of `setUp`, but with slight changes) which will be useful when adding macOS support, where the mock `WKWebView` will need to be a different class when testing macOS/iOS codepath divergence.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: webview_flutter platform-ios
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants