I wrote a basic Integration Test and had problems getting it to work.
Basically I have a main screen that has a ÌconButton
. If clicked it opens a secondary screen.
My test looked like this:
group('end-to-end test', () {
testWidgets('test settings', (WidgetTester tester) async {
appmain.main();
await tester.pumpAndSettle();
final Finder settingButton = find.byTooltip('Settings');
// Button is fine
expect(settingButton, findsOneWidget);
// Button is tapped -- a new screen should open
await tester.tap(settingButton);
// "Host" should be on the second screen, HOWEVER this test FAILS
expect(find.text("Host"), findsWidgets);
});
});
So the question was: If the Button is successfully tapped, why does the test still fail?