diff --git a/example/.gitignore b/example/.gitignore index c20d10dc..4b042de1 100755 --- a/example/.gitignore +++ b/example/.gitignore @@ -71,4 +71,4 @@ build/ !**/ios/**/default.perspectivev3 !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages -integration_test/.env.dart +integration_test/env.dart diff --git a/example/integration_test/chrome_safari_browser/main.dart b/example/integration_test/chrome_safari_browser/main.dart index 6e31a08c..490f8257 100644 --- a/example/integration_test/chrome_safari_browser/main.dart +++ b/example/integration_test/chrome_safari_browser/main.dart @@ -1,3 +1,4 @@ +import 'package:flutter/foundation.dart'; import 'package:flutter_test/flutter_test.dart'; import 'custom_action_button.dart'; @@ -7,11 +8,13 @@ import 'open_and_close.dart'; import 'trusted_web_activity.dart'; void main() { + final shouldSkip = kIsWeb; + group('ChromeSafariBrowser', () { openAndClose(); customMenuItem(); customActionButton(); customTabs(); trustedWebActivity(); - }); + }, skip: shouldSkip); } diff --git a/example/integration_test/cookie_manager/main.dart b/example/integration_test/cookie_manager/main.dart index 791fc1d6..5dfa3b64 100644 --- a/example/integration_test/cookie_manager/main.dart +++ b/example/integration_test/cookie_manager/main.dart @@ -1,9 +1,12 @@ +import 'package:flutter/foundation.dart'; import 'package:flutter_test/flutter_test.dart'; import 'set_get_delete.dart'; void main() { + final shouldSkip = kIsWeb; + group('Cookie Manager', () { setGetDelete(); - }); + }, skip: shouldSkip); } diff --git a/example/integration_test/in_app_browser/main.dart b/example/integration_test/in_app_browser/main.dart index 7ed359fa..13fc2bd1 100644 --- a/example/integration_test/in_app_browser/main.dart +++ b/example/integration_test/in_app_browser/main.dart @@ -1,3 +1,4 @@ +import 'package:flutter/foundation.dart'; import 'package:flutter_test/flutter_test.dart'; import 'open_data_and_close.dart'; @@ -6,10 +7,12 @@ import 'open_url_and_close.dart'; import 'set_get_settings.dart'; void main() { + final shouldSkip = kIsWeb; + group('InAppBrowser', () { openUrlAndClose(); openFileAndClose(); openDataAndClose(); setGetSettings(); - }); + }, skip: shouldSkip); } diff --git a/example/integration_test/in_app_localhost_server/main.dart b/example/integration_test/in_app_localhost_server/main.dart index 1609b72e..9d546b63 100644 --- a/example/integration_test/in_app_localhost_server/main.dart +++ b/example/integration_test/in_app_localhost_server/main.dart @@ -1,9 +1,12 @@ +import 'package:flutter/foundation.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:flutter_test/flutter_test.dart'; import 'load_asset_file.dart'; void main() { + final shouldSkip = kIsWeb; + group('InAppLocalhostServer', () { final InAppLocalhostServer localhostServer = InAppLocalhostServer(); @@ -16,5 +19,5 @@ void main() { tearDownAll(() async { await localhostServer.close(); }); - }); + }, skip: shouldSkip); } diff --git a/example/integration_test/in_app_webview/get_content_height.dart b/example/integration_test/in_app_webview/get_content_height.dart index d1cfb0b0..60ea1f02 100644 --- a/example/integration_test/in_app_webview/get_content_height.dart +++ b/example/integration_test/in_app_webview/get_content_height.dart @@ -41,6 +41,8 @@ void getContentHeight() { final InAppWebViewController controller = await controllerCompleter.future; await pageLoaded.future; + await tester.pump(); + final contentHeight = await controller.getContentHeight(); expect(contentHeight, isNonZero); expect(contentHeight, isPositive); diff --git a/example/integration_test/in_app_webview/http_auth_credential_database.dart b/example/integration_test/in_app_webview/http_auth_credential_database.dart index d2d65bab..13854e14 100644 --- a/example/integration_test/in_app_webview/http_auth_credential_database.dart +++ b/example/integration_test/in_app_webview/http_auth_credential_database.dart @@ -5,7 +5,7 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../.env.dart'; +import '../env.dart'; void httpAuthCredentialDatabase() { final shouldSkip = kIsWeb diff --git a/example/integration_test/in_app_webview/intercept_ajax_request.dart b/example/integration_test/in_app_webview/intercept_ajax_request.dart index f891dbe9..3cac35e0 100644 --- a/example/integration_test/in_app_webview/intercept_ajax_request.dart +++ b/example/integration_test/in_app_webview/intercept_ajax_request.dart @@ -6,7 +6,7 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../.env.dart'; +import '../env.dart'; void interceptAjaxRequest() { final shouldSkip = kIsWeb diff --git a/example/integration_test/in_app_webview/intercept_fetch_request.dart b/example/integration_test/in_app_webview/intercept_fetch_request.dart index a580ecf1..baf8d483 100644 --- a/example/integration_test/in_app_webview/intercept_fetch_request.dart +++ b/example/integration_test/in_app_webview/intercept_fetch_request.dart @@ -6,7 +6,7 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../.env.dart'; +import '../env.dart'; void interceptFetchRequest() { final shouldSkip = kIsWeb diff --git a/example/integration_test/in_app_webview/on_download_start_request.dart b/example/integration_test/in_app_webview/on_download_start_request.dart index cd7eb3e9..20046cbc 100644 --- a/example/integration_test/in_app_webview/on_download_start_request.dart +++ b/example/integration_test/in_app_webview/on_download_start_request.dart @@ -5,7 +5,7 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../.env.dart'; +import '../env.dart'; void onDownloadStartRequest() { final shouldSkip = kIsWeb diff --git a/example/integration_test/in_app_webview/on_scroll_changed.dart b/example/integration_test/in_app_webview/on_scroll_changed.dart index eec009e1..6c0167a0 100644 --- a/example/integration_test/in_app_webview/on_scroll_changed.dart +++ b/example/integration_test/in_app_webview/on_scroll_changed.dart @@ -46,8 +46,9 @@ void onScrollChanged() { final InAppWebViewController controller = await controllerCompleter.future; await pageLoaded.future; + await tester.pump(); + controller.scrollTo(x: 0, y: 500); - await tester.pumpAndSettle(Duration(seconds: 1)); await expectLater(onScrollChangedCompleter.future, completes); }, skip: shouldSkip); diff --git a/example/integration_test/in_app_webview/on_title_changed.dart b/example/integration_test/in_app_webview/on_title_changed.dart index 85222342..a71764d4 100644 --- a/example/integration_test/in_app_webview/on_title_changed.dart +++ b/example/integration_test/in_app_webview/on_title_changed.dart @@ -46,6 +46,7 @@ void onTitleChanged() { final InAppWebViewController controller = await controllerCompleter.future; await pageLoaded.future; + await tester.pump(); await controller.evaluateJavascript( source: "document.title = 'title test';"); await expectLater(onTitleChangedCompleter.future, completes); diff --git a/example/integration_test/in_app_webview/post_requests.dart b/example/integration_test/in_app_webview/post_requests.dart index c604b897..a866ac2f 100644 --- a/example/integration_test/in_app_webview/post_requests.dart +++ b/example/integration_test/in_app_webview/post_requests.dart @@ -7,7 +7,7 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../.env.dart'; +import '../env.dart'; void postRequests() { final shouldSkip = kIsWeb diff --git a/example/integration_test/in_app_webview/ssl_request.dart b/example/integration_test/in_app_webview/ssl_request.dart index 5c495683..79645b9b 100644 --- a/example/integration_test/in_app_webview/ssl_request.dart +++ b/example/integration_test/in_app_webview/ssl_request.dart @@ -5,7 +5,7 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:flutter_test/flutter_test.dart'; -import '../.env.dart'; +import '../env.dart'; void sslRequest() { final shouldSkip = kIsWeb diff --git a/example/integration_test/in_app_webview/web_history.dart b/example/integration_test/in_app_webview/web_history.dart index 43226a76..f03b4b7f 100644 --- a/example/integration_test/in_app_webview/web_history.dart +++ b/example/integration_test/in_app_webview/web_history.dart @@ -147,11 +147,12 @@ void webHistory() { final InAppWebViewController controller = await controllerCompleter.future; + await tester.pump(); + var url = await pageLoads.stream.first; expect(url, TEST_WEB_PLATFORM_URL_1.toString()); - await controller.loadUrl( - urlRequest: URLRequest(url: TEST_WEB_PLATFORM_URL_2)); + await controller.evaluateJavascript(source: "document.getElementById('link-page-2').click();"); url = await pageLoads.stream.first; expect(url, TEST_WEB_PLATFORM_URL_2.toString()); diff --git a/example/integration_test/in_app_webview/webview_windows.dart b/example/integration_test/in_app_webview/webview_windows.dart index 99e34ba8..6146a84a 100644 --- a/example/integration_test/in_app_webview/webview_windows.dart +++ b/example/integration_test/in_app_webview/webview_windows.dart @@ -303,8 +303,9 @@ void webViewWindows() { ); }, skip: shouldSkipTest5); - final shouldSkipTest6 = !kIsWeb; - + // final shouldSkipTest6 = !kIsWeb; + final shouldSkipTest6 = true; + // on Web, opening a new window during tests makes crash testWidgets('onCreateWindow called on Web', (WidgetTester tester) async { final Completer controllerCompleter = Completer(); final Completer onCreateWindowCalled = Completer(); @@ -333,7 +334,7 @@ void webViewWindows() { final InAppWebViewController controller = await controllerCompleter.future; await controller.evaluateJavascript( - source: "window.open('$TEST_CROSS_PLATFORM_URL_1')"); + source: "window.open('$TEST_CROSS_PLATFORM_URL_1');"); var url = await onCreateWindowCalled.future; expect(url, TEST_CROSS_PLATFORM_URL_1.toString()); diff --git a/example/integration_test/service_worker/main.dart b/example/integration_test/service_worker/main.dart index c4f255f0..60345ecf 100644 --- a/example/integration_test/service_worker/main.dart +++ b/example/integration_test/service_worker/main.dart @@ -1,11 +1,14 @@ +import 'package:flutter/foundation.dart'; import 'package:flutter_test/flutter_test.dart'; import 'set_service_worker_client.dart'; import 'should_intercept_request.dart'; void main() { + final shouldSkip = kIsWeb; + group('Service Worker', () { shouldInterceptRequest(); setServiceWorkerClient(); - }); + }, skip: shouldSkip); } \ No newline at end of file diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh index dad54015..03bce7c9 100755 --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -3,11 +3,12 @@ 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=lib/main.dart" +export "FLUTTER_TARGET=integration_test/webview_flutter_test.dart" export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1" +export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==" export "DART_OBFUSCATION=false" -export "TRACK_WIDGET_CREATION=false" +export "TRACK_WIDGET_CREATION=true" export "TREE_SHAKE_ICONS=false" -export "PACKAGE_CONFIG=.packages" +export "PACKAGE_CONFIG=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example/.dart_tool/package_config.json" diff --git a/example/lib/in_app_webiew_example.screen.dart b/example/lib/in_app_webiew_example.screen.dart index 7b09663f..07b57053 100755 --- a/example/lib/in_app_webiew_example.screen.dart +++ b/example/lib/in_app_webiew_example.screen.dart @@ -21,7 +21,7 @@ class _InAppWebViewExampleScreenState extends State { mediaPlaybackRequiresUserGesture: false, allowsInlineMediaPlayback: true, iframeAllow: "camera; microphone", - iframeAllowFullscreen: true, + iframeAllowFullscreen: true ); PullToRefreshController? pullToRefreshController; @@ -113,16 +113,16 @@ class _InAppWebViewExampleScreenState extends State { children: [ InAppWebView( key: webViewKey, - initialUrlRequest: - URLRequest(url: Uri.parse("https://flutter.dev")), // initialUrlRequest: - // URLRequest(url: Uri.parse(Uri.base.toString().replaceFirst("/#/", "/") + 'page.html')), + // URLRequest(url: Uri.parse("https://flutter.dev")), + initialUrlRequest: + URLRequest(url: Uri.parse(Uri.base.toString().replaceFirst("/#/", "/") + 'page.html')), // initialFile: "assets/index.html", initialUserScripts: UnmodifiableListView([]), initialSettings: settings, // contextMenu: contextMenu, pullToRefreshController: pullToRefreshController, - onWebViewCreated: (controller) { + onWebViewCreated: (controller) async { webViewController = controller; }, onLoadStart: (controller, url) async { @@ -167,7 +167,6 @@ class _InAppWebViewExampleScreenState extends State { this.url = url.toString(); urlController.text = this.url; }); - print("getContentHeight: " + (await controller.getContentHeight()).toString()); }, onLoadError: (controller, url, code, message) { pullToRefreshController?.endRefreshing(); @@ -218,12 +217,6 @@ class _InAppWebViewExampleScreenState extends State { webViewController?.reload(); }, ), - ElevatedButton( - child: Icon(Icons.refresh), - onPressed: () { - webViewController?.evaluateJavascript(source: "window.open('https://github.com/flutter');"); - }, - ), ], ), ]))); diff --git a/example/web/page.html b/example/web/page.html index 0a0ee06d..9e845618 100644 --- a/example/web/page.html +++ b/example/web/page.html @@ -12,6 +12,7 @@ + @@ -19,11 +20,11 @@ page - +

Simple Page 1

- Go to page 2 + Go to page 2
- Go to heavy-page + Go to heavy-page