Can I test clicking a button and going to the next screen?
I think this is impossible in integration testing.
final signInText = find.text('signin');
expect(signInText, findsWidgets); // OK
final textField = find.byType(TextFormField);
await tester.enterText(textField.at(0), 'abc@gmail.com');
await tester.enterText(textField.at(1), '1234');
await tester.tap(find.byType(RaisedButton).first);
await tester.pump();
var indicator = find.byType(CircularProgressIndicator);
expect(indicator, findsOneWidget); // OK
// I have to wait 2-3 seconds for the login to complete.
sleep(Duration(seconds: 10));// FAIL
await Future.delayed(Duration(seconds: 10));// NEVER ENDING
await tester.pumpAndSettle();// TIMEOUT
expect('Next Screen Text', findsOneWidget);// NOT FOUND
If I call sleep or Future.dealeyed function, I can't wait 2-3 seconds and it fails.
I can't find any examples of testing login code.
Can I test moving to the next screen after waiting 2-3 seconds until login is done after clicking the button?
02-15-2022 02:55 AM
I normally find people overestimate integration testing in general, and would be better off writing lots of unit tests that support you reliably deploying straight to prod.
I reliably find that an app redesigned to be thoroughly unit tested stops relying on its existing integration tests.
What kind of assurances are you looking for from integration testing? Does your integration environment really reflect the real world? How much lead time do your integration tests add to the smallest possible azar echatspin release?
02-16-2022 03:24 AM
@BettyRNorahDeni wrote: spider solitaireCan I test clicking a button and going to the next screen?
I think this is impossible in integration testing.
final signInText = find.text('signin');
expect(signInText, findsWidgets); // OK
final textField = find.byType(TextFormField);
await tester.enterText(textField.at(0), 'abc@gmail.com');
await tester.enterText(textField.at(1), '1234');
await tester.tap(find.byType(RaisedButton).first);
await tester.pump();
var indicator = find.byType(CircularProgressIndicator);
expect(indicator, findsOneWidget); // OK// I have to wait 2-3 seconds for the login to complete.
sleep(Duration(seconds: 10));// FAIL
await Future.delayed(Duration(seconds: 10));// NEVER ENDING
await tester.pumpAndSettle();// TIMEOUT
expect('Next Screen Text', findsOneWidget);// NOT FOUND
If I call sleep or Future.dealeyed function, I can't wait 2-3 seconds and it fails.I can't find any examples of testing login code.
Can I test moving to the next screen after waiting 2-3 seconds until login is done after clicking the button?
I think people overvalue integration testing and should focus on building plenty of unit tests that allow deploying directly to production. An app that is extensively unit tested no longer relies on its current integration tests.
What guarantees do you need from integration testing? Is your integration environment realistic? Azar echatspin integration tests contribute how much to the least feasible lead time?
02-23-2022 07:50 AM