Skip to content

Commit 0c28281

Browse files
[webview_flutter] Adjust integration test domains (flutter#4383)
Tests that load https://www.google.com and then assert that that's the current URL are failing, because Google is redirecting our tests to a "suspicious activity" page. Switch to example.com, as a domain that is less likely to do traffic-based redirection.
1 parent d3c892f commit 0c28281

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart

+8-8
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ void main() {
5858
),
5959
);
6060
final WebViewController controller = await controllerCompleter.future;
61-
await controller.loadUrl('https://www.google.com/');
61+
await controller.loadUrl('https://www.example.com/');
6262
final String? currentUrl = await controller.currentUrl();
63-
expect(currentUrl, 'https://www.google.com/');
63+
expect(currentUrl, 'https://www.example.com/');
6464
}, skip: _skipDueToIssue86757);
6565

6666
// TODO(bparrishMines): skipped due to https://github.com/flutter/flutter/issues/86757.
@@ -1100,11 +1100,11 @@ void main() {
11001100
await pageLoads.stream.first; // Wait for initial page load.
11011101
final WebViewController controller = await controllerCompleter.future;
11021102
await controller
1103-
.evaluateJavascript('location.href = "https://www.google.com/"');
1103+
.evaluateJavascript('location.href = "https://www.example.com/"');
11041104

11051105
await pageLoads.stream.first; // Wait for the next page load.
11061106
final String? currentUrl = await controller.currentUrl();
1107-
expect(currentUrl, 'https://www.google.com/');
1107+
expect(currentUrl, 'https://www.example.com/');
11081108
});
11091109

11101110
testWidgets('onWebResourceError', (WidgetTester tester) async {
@@ -1272,11 +1272,11 @@ void main() {
12721272
await pageLoads.stream.first; // Wait for initial page load.
12731273
final WebViewController controller = await controllerCompleter.future;
12741274
await controller
1275-
.evaluateJavascript('location.href = "https://www.google.com"');
1275+
.evaluateJavascript('location.href = "https://www.example.com"');
12761276

12771277
await pageLoads.stream.first; // Wait for second page to load.
12781278
final String? currentUrl = await controller.currentUrl();
1279-
expect(currentUrl, 'https://www.google.com/');
1279+
expect(currentUrl, 'https://www.example.com/');
12801280
});
12811281
});
12821282

@@ -1365,10 +1365,10 @@ void main() {
13651365
pageLoaded = Completer<void>();
13661366

13671367
await controller
1368-
.evaluateJavascript('window.open("https://www.google.com/")');
1368+
.evaluateJavascript('window.open("https://www.example.com/")');
13691369
await pageLoaded.future;
13701370
pageLoaded = Completer<void>();
1371-
expect(controller.currentUrl(), completion('https://www.google.com/'));
1371+
expect(controller.currentUrl(), completion('https://www.example.com/'));
13721372

13731373
expect(controller.canGoBack(), completion(true));
13741374
await controller.goBack();

packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart

+8-8
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ void main() {
6464
),
6565
);
6666
final WebViewController controller = await controllerCompleter.future;
67-
await controller.loadUrl('https://www.google.com/');
67+
await controller.loadUrl('https://www.example.com/');
6868
final String? currentUrl = await controller.currentUrl();
69-
expect(currentUrl, 'https://www.google.com/');
69+
expect(currentUrl, 'https://www.example.com/');
7070
}, skip: _skipDueToIssue86757);
7171

7272
// TODO(bparrishMines): skipped due to https://github.com/flutter/flutter/issues/86757.
@@ -1054,11 +1054,11 @@ void main() {
10541054
await pageLoads.stream.first; // Wait for initial page load.
10551055
final WebViewController controller = await controllerCompleter.future;
10561056
await controller
1057-
.evaluateJavascript('location.href = "https://www.google.com/"');
1057+
.evaluateJavascript('location.href = "https://www.example.com/"');
10581058

10591059
await pageLoads.stream.first; // Wait for the next page load.
10601060
final String? currentUrl = await controller.currentUrl();
1061-
expect(currentUrl, 'https://www.google.com/');
1061+
expect(currentUrl, 'https://www.example.com/');
10621062
});
10631063

10641064
testWidgets('onWebResourceError', (WidgetTester tester) async {
@@ -1221,11 +1221,11 @@ void main() {
12211221
await pageLoads.stream.first; // Wait for initial page load.
12221222
final WebViewController controller = await controllerCompleter.future;
12231223
await controller
1224-
.evaluateJavascript('location.href = "https://www.google.com"');
1224+
.evaluateJavascript('location.href = "https://www.example.com"');
12251225

12261226
await pageLoads.stream.first; // Wait for second page to load.
12271227
final String? currentUrl = await controller.currentUrl();
1228-
expect(currentUrl, 'https://www.google.com/');
1228+
expect(currentUrl, 'https://www.example.com/');
12291229
});
12301230
});
12311231

@@ -1314,10 +1314,10 @@ void main() {
13141314
pageLoaded = Completer<void>();
13151315

13161316
await controller
1317-
.evaluateJavascript('window.open("https://www.google.com/")');
1317+
.evaluateJavascript('window.open("https://www.example.com/")');
13181318
await pageLoaded.future;
13191319
pageLoaded = Completer<void>();
1320-
expect(controller.currentUrl(), completion('https://www.google.com/'));
1320+
expect(controller.currentUrl(), completion('https://www.example.com/'));
13211321

13221322
expect(controller.canGoBack(), completion(true));
13231323
await controller.goBack();

packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart

+8-8
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ void main() {
6161
),
6262
);
6363
final WebViewController controller = await controllerCompleter.future;
64-
await controller.loadUrl('https://www.google.com/');
64+
await controller.loadUrl('https://www.example.com/');
6565
final String? currentUrl = await controller.currentUrl();
66-
expect(currentUrl, 'https://www.google.com/');
66+
expect(currentUrl, 'https://www.example.com/');
6767
}, skip: _skipDueToIssue86757);
6868

6969
testWidgets('loadUrl with headers', (WidgetTester tester) async {
@@ -913,11 +913,11 @@ void main() {
913913
await pageLoads.stream.first; // Wait for initial page load.
914914
final WebViewController controller = await controllerCompleter.future;
915915
await controller
916-
.evaluateJavascript('location.href = "https://www.google.com/"');
916+
.evaluateJavascript('location.href = "https://www.example.com/"');
917917

918918
await pageLoads.stream.first; // Wait for the next page load.
919919
final String? currentUrl = await controller.currentUrl();
920-
expect(currentUrl, 'https://www.google.com/');
920+
expect(currentUrl, 'https://www.example.com/');
921921
});
922922

923923
testWidgets('onWebResourceError', (WidgetTester tester) async {
@@ -1085,11 +1085,11 @@ void main() {
10851085
await pageLoads.stream.first; // Wait for initial page load.
10861086
final WebViewController controller = await controllerCompleter.future;
10871087
await controller
1088-
.evaluateJavascript('location.href = "https://www.google.com"');
1088+
.evaluateJavascript('location.href = "https://www.example.com"');
10891089

10901090
await pageLoads.stream.first; // Wait for second page to load.
10911091
final String? currentUrl = await controller.currentUrl();
1092-
expect(currentUrl, 'https://www.google.com/');
1092+
expect(currentUrl, 'https://www.example.com/');
10931093
});
10941094
});
10951095

@@ -1176,10 +1176,10 @@ void main() {
11761176
pageLoaded = Completer<void>();
11771177

11781178
await controller
1179-
.evaluateJavascript('window.open("https://www.google.com/")');
1179+
.evaluateJavascript('window.open("https://www.example.com/")');
11801180
await pageLoaded.future;
11811181
pageLoaded = Completer<void>();
1182-
expect(controller.currentUrl(), completion('https://www.google.com/'));
1182+
expect(controller.currentUrl(), completion('https://www.example.com/'));
11831183

11841184
expect(controller.canGoBack(), completion(true));
11851185
await controller.goBack();

0 commit comments

Comments
 (0)