28 lines
948 B
Dart
28 lines
948 B
Dart
|
import 'dart:async';
|
||
|
|
||
|
import 'package:flutter/widgets.dart';
|
||
|
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||
|
import 'package:flutter_test/flutter_test.dart';
|
||
|
|
||
|
void initialUrlRequest() {
|
||
|
testWidgets('initialUrlRequest', (WidgetTester tester) async {
|
||
|
final Completer controllerCompleter = Completer<InAppWebViewController>();
|
||
|
await tester.pumpWidget(
|
||
|
Directionality(
|
||
|
textDirection: TextDirection.ltr,
|
||
|
child: InAppWebView(
|
||
|
key: GlobalKey(),
|
||
|
initialUrlRequest:
|
||
|
URLRequest(url: Uri.parse('https://github.com/flutter')),
|
||
|
onWebViewCreated: (controller) {
|
||
|
controllerCompleter.complete(controller);
|
||
|
},
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
final InAppWebViewController controller =
|
||
|
await controllerCompleter.future;
|
||
|
final String? currentUrl = (await controller.getUrl())?.toString();
|
||
|
expect(currentUrl, 'https://github.com/flutter');
|
||
|
});
|
||
|
}
|