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

[webview_flutter] Adjust integration test domains #4383

Merged
merged 1 commit into from
Sep 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ void main() {
),
);
final WebViewController controller = await controllerCompleter.future;
await controller.loadUrl('https://www.google.com/');
await controller.loadUrl('https://www.example.com/');
Copy link
Member

Choose a reason for hiding this comment

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

Should this URL be a const String at the top of the test files, so it can be changed more easily in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since there's no actual relation between its use in the different tests (i.e., we could make it different in every test with no issue) I would lean away from extracting a shared constant. Maybe within each test, but that doesn't change things much.

final String? currentUrl = await controller.currentUrl();
expect(currentUrl, 'https://www.google.com/');
expect(currentUrl, 'https://www.example.com/');
}, skip: _skipDueToIssue86757);

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

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

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

await pageLoads.stream.first; // Wait for second page to load.
final String? currentUrl = await controller.currentUrl();
expect(currentUrl, 'https://www.google.com/');
expect(currentUrl, 'https://www.example.com/');
});
});

Expand Down Expand Up @@ -1365,10 +1365,10 @@ void main() {
pageLoaded = Completer<void>();

await controller
.evaluateJavascript('window.open("https://www.google.com/")');
.evaluateJavascript('window.open("https://www.example.com/")');
await pageLoaded.future;
pageLoaded = Completer<void>();
expect(controller.currentUrl(), completion('https://www.google.com/'));
expect(controller.currentUrl(), completion('https://www.example.com/'));

expect(controller.canGoBack(), completion(true));
await controller.goBack();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ void main() {
),
);
final WebViewController controller = await controllerCompleter.future;
await controller.loadUrl('https://www.google.com/');
await controller.loadUrl('https://www.example.com/');
final String? currentUrl = await controller.currentUrl();
expect(currentUrl, 'https://www.google.com/');
expect(currentUrl, 'https://www.example.com/');
}, skip: _skipDueToIssue86757);

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

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

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

await pageLoads.stream.first; // Wait for second page to load.
final String? currentUrl = await controller.currentUrl();
expect(currentUrl, 'https://www.google.com/');
expect(currentUrl, 'https://www.example.com/');
});
});

Expand Down Expand Up @@ -1314,10 +1314,10 @@ void main() {
pageLoaded = Completer<void>();

await controller
.evaluateJavascript('window.open("https://www.google.com/")');
.evaluateJavascript('window.open("https://www.example.com/")');
await pageLoaded.future;
pageLoaded = Completer<void>();
expect(controller.currentUrl(), completion('https://www.google.com/'));
expect(controller.currentUrl(), completion('https://www.example.com/'));

expect(controller.canGoBack(), completion(true));
await controller.goBack();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ void main() {
),
);
final WebViewController controller = await controllerCompleter.future;
await controller.loadUrl('https://www.google.com/');
await controller.loadUrl('https://www.example.com/');
final String? currentUrl = await controller.currentUrl();
expect(currentUrl, 'https://www.google.com/');
expect(currentUrl, 'https://www.example.com/');
}, skip: _skipDueToIssue86757);

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

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

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

await pageLoads.stream.first; // Wait for second page to load.
final String? currentUrl = await controller.currentUrl();
expect(currentUrl, 'https://www.google.com/');
expect(currentUrl, 'https://www.example.com/');
});
});

Expand Down Expand Up @@ -1176,10 +1176,10 @@ void main() {
pageLoaded = Completer<void>();

await controller
.evaluateJavascript('window.open("https://www.google.com/")');
.evaluateJavascript('window.open("https://www.example.com/")');
await pageLoaded.future;
pageLoaded = Completer<void>();
expect(controller.currentUrl(), completion('https://www.google.com/'));
expect(controller.currentUrl(), completion('https://www.example.com/'));

expect(controller.canGoBack(), completion(true));
await controller.goBack();
Expand Down