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

Conversation

@cyanglaz
Copy link
Contributor

@cyanglaz cyanglaz commented Jan 7, 2020

Description

We need XCTests in the webview_flutter plugin to test certain things that dart side integration tests cannot. This PR sets up some basic tests.

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.

@cyanglaz cyanglaz requested a review from amirh as a code owner January 7, 2020 00:21
@cyanglaz cyanglaz changed the title [webview_flutter] sSetup XCTests [webview_flutter] Setup XCTests Jan 7, 2020
@cyanglaz cyanglaz force-pushed the webview_flutter_xctest branch from a368bbd to 7f6d994 Compare January 7, 2020 00:24
@cyanglaz cyanglaz requested a review from jmagman January 7, 2020 00:26
Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

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

LGTM with nits

@implementation FLTWebViewTests

- (void)setUp {
self.mockBinaryMessenger = OCMProtocolMock(@protocol(FlutterBinaryMessenger));
Copy link
Member

Choose a reason for hiding this comment

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

[super setUp];

Comment on lines 5 to 7
#import <Flutter/Flutter.h>
#import <OCMock/OCMock.h>
#import <XCTest/XCTest.h>
Copy link
Member

Choose a reason for hiding this comment

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

@import Flutter;
@import OCMock;
@import XCTest;

CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = S8QB4VV633;
Copy link
Member

Choose a reason for hiding this comment

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

Don't commit the DEVELOPMENT_TEAM to the repo.

TargetAttributes = {
68BDCAE823C3F7CB00D9C032 = {
CreatedOnToolsVersion = 11.3;
DevelopmentTeam = S8QB4VV633;
Copy link
Member

Choose a reason for hiding this comment

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

Don't commit the DEVELOPMENT_TEAM to the repo.

@cyanglaz cyanglaz merged commit 484e362 into flutter:master Jan 7, 2020
@cyanglaz cyanglaz deleted the webview_flutter_xctest branch January 7, 2020 19:21
hjc22 pushed a commit to hjc22/plugins that referenced this pull request Jan 8, 2020
…acheing-01-08

* flutterPlugin/master: (30 commits)
  Update Gradle version (flutter#2448)
  [image_picker] support android V2 embedding (flutter#2430)
  [webview_flutter] Setup XCTests (flutter#2445)
  [video_player] Fixes video initialization future stall. (flutter#2134)
  [ci] Upgrade to Xcode 11.3 (flutter#2435)
  [In_app_purchases] migrate to Play Billing Library 2.0. (flutter#2287)
  Migrate away from deprecated `BinaryMessages` (flutter#2444)
  [google_sign_in]Update google_sign_in_example name in pubspec.yaml (flutter#2335)
  [ios_platform_images] Removed android support from the pubspec. (flutter#2432)
  [google_sign_in] Expose network error (flutter#2398)
  [battery] cleanup for Android embedding post 1.12 (flutter#2400)
  [flutter_webview] Raise min Flutter SDK to stable (flutter#2425)
  re-enable stable CI (flutter#2402)
  [in_app_purchase]Change a comment. (flutter#2329)
  [google_sign_in] Pass the client id to the platform interface. (flutter#2427)
  [ios_platform_images] Made ios_platform_images set the correct image scale. (flutter#2414)
  [url_launcher_platform_interface] use non static token for platform interface (flutter#2418)
  [plugin_platform_interface] Don't use const Object as a token (flutter#2417)
  Update endorsed macos plugins readme and update others (flutter#2407)
  [webview_flutter] add gesture navigation for iOS (flutter#2339)
  ...

# Conflicts:
#	packages/video_player/video_player/CHANGELOG.md
#	packages/video_player/video_player/pubspec.yaml
@KevinTheGray
Copy link
Contributor

@cyanglaz I'm trying to add some tests for the video_player plugin, and I'm wondering, how do you run these tests locally? I'm trying pod lib lint webview_flutter.podspec --verbose It's failing with an error
rdqgnr-webview_flutter/Pods/Target Support Files/webview_flutter/webview_flutter-Unit-Tests-frameworks.sh: line 141: ARCHS[@]: unbound variable

Any ideas what to do there?

@jmagman
Copy link
Member

jmagman commented Mar 24, 2020

@cyanglaz I'm trying to add some tests for the video_player plugin, and I'm wondering, how do you run these tests locally? I'm trying pod lib lint webview_flutter.podspec --verbose It's failing with an error
rdqgnr-webview_flutter/Pods/Target Support Files/webview_flutter/webview_flutter-Unit-Tests-frameworks.sh: line 141: ARCHS[@]: unbound variable

Any ideas what to do there?

Run with --no-clean so the Xcode project gets preserved, then run the tests in Xcode instead to see what's going on. Some valid ARCH not getting set?

@KevinTheGray
Copy link
Contributor

@cyanglaz I tried with --no-clean and then running in XCode gives me Module 'OCMock' not found for FLTWebViewTests.m

@KevinTheGray
Copy link
Contributor

what did you use to run these tests locally? Is there a certain directory I should be running this from? Sorry, not very familiar with running XCode tests in this manner.

It seems like the the example project would need knowledge of the OCMock dependency, right?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants