From 83dae97fda6b6f9cd2956422ce6466200a9d4edd Mon Sep 17 00:00:00 2001 From: Lorenzo Pichilli Date: Mon, 18 Apr 2022 02:59:46 +0200 Subject: [PATCH] updated integration tests --- example/integration_test/.env.dart | 2 +- .../webview_flutter_test.dart | 13 +++++---- example/ios/Flutter/Flutter.podspec | 18 ------------ .../ios/Flutter/flutter_export_environment.sh | 7 ++--- example/ios/Runner.xcodeproj/project.pbxproj | 18 ++++-------- example/ios/Runner/Info.plist | 28 +++++++++---------- scripts/test.sh | 5 ++-- 7 files changed, 34 insertions(+), 57 deletions(-) delete mode 100644 example/ios/Flutter/Flutter.podspec diff --git a/example/integration_test/.env.dart b/example/integration_test/.env.dart index 43e66331..672d39f3 100755 --- a/example/integration_test/.env.dart +++ b/example/integration_test/.env.dart @@ -1 +1 @@ -final environment = {"NODE_SERVER_IP":"192.168.1.129"}; \ No newline at end of file +final environment = {"NODE_SERVER_IP":"192.168.1.123"}; \ No newline at end of file diff --git a/example/integration_test/webview_flutter_test.dart b/example/integration_test/webview_flutter_test.dart index baad5513..15b57487 100644 --- a/example/integration_test/webview_flutter_test.dart +++ b/example/integration_test/webview_flutter_test.dart @@ -397,7 +397,7 @@ void main() { late File fileJs; setUpAll(() async { - appSupportDir = (await getApplicationSupportDirectory())!; + appSupportDir = (await getApplicationSupportDirectory()); final Directory htmlFolder = Directory('${appSupportDir.path}/html/'); if (!await htmlFolder.exists()) { @@ -476,7 +476,7 @@ void main() { }, skip: !Platform.isIOS); testWidgets( - 'loadUrl with file:// scheme and iosAllowingReadAccessTo argument', + 'loadUrl with file:// scheme and allowingReadAccessTo argument', (WidgetTester tester) async { final Completer consoleMessageShouldNotComplete = Completer(); @@ -511,7 +511,7 @@ void main() { controller.loadUrl( urlRequest: URLRequest(url: Uri.parse('file://${fileHtml.path}')), - iosAllowingReadAccessTo: + allowingReadAccessTo: Uri.parse('file://${appSupportDir.path}/')); }, onConsoleMessage: (controller, consoleMessage) { @@ -1558,6 +1558,7 @@ void main() { onWebViewCreated: (controller) { controllerCompleter.complete(controller); }, + initialUrlRequest: URLRequest(url: Uri.parse("about:blank")), initialOptions: InAppWebViewGroupOptions( crossPlatform: InAppWebViewOptions( javaScriptEnabled: true, @@ -3804,7 +3805,7 @@ setTimeout(function() { """, encoding: 'utf-8', mimeType: 'text/html', - androidHistoryUrl: Uri.parse("https://flutter.dev"), + historyUrl: Uri.parse("https://flutter.dev"), baseUrl: Uri.parse("https://flutter.dev")); await pageLoads.stream.first; @@ -4550,7 +4551,7 @@ setTimeout(function() { await pageLoaded.future; await expectLater( - controller.zoomBy(zoomFactor: 3.0, iosAnimated: true), completes); + controller.zoomBy(zoomFactor: 3.0, animated: true), completes); }); testWidgets('getZoomScale', (WidgetTester tester) async { @@ -4853,7 +4854,7 @@ setTimeout(function() { fileName = fileName + WebArchiveFormat.WEBARCHIVE.toValue(); } - var fullPath = supportDir!.path + Platform.pathSeparator + fileName; + var fullPath = supportDir.path + Platform.pathSeparator + fileName; var path = await controller.saveWebArchive(filePath: fullPath); expect(path, isNotNull); expect(path, endsWith(fileName)); diff --git a/example/ios/Flutter/Flutter.podspec b/example/ios/Flutter/Flutter.podspec deleted file mode 100644 index 663d5b29..00000000 --- a/example/ios/Flutter/Flutter.podspec +++ /dev/null @@ -1,18 +0,0 @@ -# -# NOTE: This podspec is NOT to be published. It is only used as a local source! -# This is a generated file; do not edit or check into version control. -# - -Pod::Spec.new do |s| - s.name = 'Flutter' - s.version = '1.0.0' - s.summary = 'High-performance, high-fidelity mobile apps.' - s.homepage = 'https://flutter.io' - s.license = { :type => 'MIT' } - s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } - s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } - s.ios.deployment_target = '9.0' - # Framework linking is handled by Flutter tooling, not CocoaPods. - # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs. - s.vendored_frameworks = 'path/to/nothing' -end diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh index 9e98dd5e..dad54015 100755 --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -3,12 +3,11 @@ export "FLUTTER_ROOT=/Users/lorenzopichilli/fvm/versions/2.10.4" export "FLUTTER_APPLICATION_PATH=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example" export "COCOAPODS_PARALLEL_CODE_SIGN=true" -export "FLUTTER_TARGET=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example/lib/main.dart" +export "FLUTTER_TARGET=lib/main.dart" export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1" -export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==" export "DART_OBFUSCATION=false" -export "TRACK_WIDGET_CREATION=true" +export "TRACK_WIDGET_CREATION=false" export "TREE_SHAKE_ICONS=false" -export "PACKAGE_CONFIG=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example/.dart_tool/package_config.json" +export "PACKAGE_CONFIG=.packages" diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 1574ec55..da4b6637 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -9,7 +9,7 @@ /* Begin PBXBuildFile section */ 020EF14E4245221B2C22ACE5 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B0FC2CF7A6002799890B3102 /* Pods_Runner.framework */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 25A517508F43E58C47090625 /* BuildFile in Frameworks */ = {isa = PBXBuildFile; }; + 25A517508F43E58C47090625 /* (null) in Frameworks */ = {isa = PBXBuildFile; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 61FF730023634CA10069C557 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 61FF72FF23634CA10069C557 /* libsqlite3.tbd */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; @@ -58,7 +58,7 @@ buildActionMask = 2147483647; files = ( 61FF730023634CA10069C557 /* libsqlite3.tbd in Frameworks */, - 25A517508F43E58C47090625 /* BuildFile in Frameworks */, + 25A517508F43E58C47090625 /* (null) in Frameworks */, 020EF14E4245221B2C22ACE5 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -451,15 +451,12 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = "flutter-inappwebviewExample"; + PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -482,15 +479,12 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.pichillilorenzo.flutter_inappwebviewExample; + PRODUCT_BUNDLE_IDENTIFIER = "com.pichillilorenzo.flutter-inappwebview-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist index f3695710..d78c9615 100755 --- a/example/ios/Runner/Info.plist +++ b/example/ios/Runner/Info.plist @@ -2,10 +2,6 @@ - NSDocumentsFolderUsageDescription - InAppWebView requires access to documents folder - NSMicrophoneUsageDescription - InAppWebView requires access to mic. CFBundleDevelopmentRegion en CFBundleExecutable @@ -28,19 +24,31 @@ NSAppTransportSecurity - NSAllowsArbitraryLoadsInWebContent - NSAllowsArbitraryLoads + NSAllowsArbitraryLoadsInWebContent + NSAllowsLocalNetworking + NSBonjourServices + + _dartobservatory._tcp + + NSCameraUsageDescription + InAppWebView requires access to cam. + NSDocumentsFolderUsageDescription + InAppWebView requires access to documents folder + NSLocalNetworkUsageDescription + Allow Flutter tools on your computer to connect and debug your application. NSLocationAlwaysAndWhenInUseUsageDescription Need location NSLocationAlwaysUsageDescription Need location NSLocationWhenInUseUsageDescription Need location + NSMicrophoneUsageDescription + InAppWebView requires access to mic. UIBackgroundModes fetch @@ -63,15 +71,7 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - NSBonjourServices - - _dartobservatory._tcp - UIViewControllerBasedStatusBarAppearance - NSCameraUsageDescription - InAppWebView requires access to cam. - NSLocalNetworkUsageDescription - Allow Flutter tools on your computer to connect and debug your application. diff --git a/scripts/test.sh b/scripts/test.sh index 947257c2..d5be1d31 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -7,8 +7,8 @@ function error() { echo "$@" 1>&2 } -# on macOS local IP can be found using $(ipconfig getifaddr en0) -# on linux local IP can be found using $(ifconfig en0 | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}') or $(ip route get 1 | awk '{print $NF;exit}') +# on macOS local IP can be found using something like $(ipconfig getifaddr en0) +# on linux local IP can be found using something like $(ifconfig en0 | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}') or $(ip route get 1 | awk '{print $NF;exit}') export NODE_SERVER_IP=$1 FAILED=0 @@ -17,6 +17,7 @@ dart $PROJECT_DIR/tool/env.dart cd $PROJECT_DIR/nodejs_server_test_auth_basic_and_ssl node index.js & +flutter --version flutter clean cd $PROJECT_DIR/example flutter clean