Testing evalJavascript failure
Z6P0 opened this issue · comments
I try to run a simple test with the FlutterWebviewPlugin but I can't get it to work.
void main() {
testWidgets('Test', (WidgetTester tester) async {
var plugin = FlutterWebviewPlugin();
await tester.pumpWidget(MaterialApp(
home: Scaffold(
body: Center(
child: FutureBuilder<String?>(
// future: Future.value('2'),
future: plugin.launch('', hidden: false).then((_) => plugin.evalJavascript('1+1')),
builder: (context, snapshot) {
if (snapshot.hasError) throw snapshot.error!;
if (!snapshot.hasData) return Text('...');
return Text(snapshot.data!);
},
),
),
),
));
// expect(find.text('...'), findsOneWidget);
expect(find.text('2'), findsOneWidget); // TestFailure
});
}