flutterflutter-integration-test

Flutter integration test: expect method dosen't work properly


I want to test Login page in Flutter integration test, expect still at Login page when enter invalid data, and move to Dashboard page when enter valid data.

But the expect method doesn't run as expected, as the test pass even any unexpected condition, like here:

enter image description here

But when I run the same test in debug test, expect works, but also the test marked as passes like here:

enter image description here

enter image description here


Solution

  • I found the root cause for this issue, it was in this method FlutterError.onError where it just print the exceptions

    FlutterError.onError = (details) {
    log(details.exceptionAsString(), stackTrace: details.stack);};
    

    I fixed it, and expect is working as expected now