Greetings,
I've been trying to figure out how to use your package with firebase_ui_auth (which supplies sample screens and workflow for Firebase authentication). To do this, I implemented a minimal Flutter app:
https://github.com/philipmjohnson/flutter_mock_firebase_auth
With a minimal integration test:
https://github.com/philipmjohnson/flutter_mock_firebase_auth/blob/main/integration_test/app_test.dart
What I've discovered is that this integration test will not work because the firebase_ui_auth signin workflow requires the ability to invoke the MockUserCredential.additionalUserInfo() method, which currently throws an UnimplementedMethodException. I monkeywrenched your implementation of MockUserCredential to look like this:
class MockUserCredential implements UserCredential {
final MockUser _mockUser;
MockUserCredential(bool isAnonymous, {MockUser? mockUser})
// Ensure no mocked credentials or mocked for Anonymous
: assert(mockUser == null || mockUser.isAnonymous == isAnonymous),
_mockUser = mockUser ?? MockUser(isAnonymous: isAnonymous);
@override
User get user => mockUser;
// Strongly typed for use within the project.
MockUser get mockUser => _mockUser;
bool get isNewUser => false;
@override
// TODO: implement additionalUserInfo
AdditionalUserInfo? get additionalUserInfo => AdditionalUserInfo(isNewUser: false);
@override
// TODO: implement credential
AuthCredential? get credential => throw UnimplementedError();
}
And this enabled my integration test to run successfully.
Things work OK if I create a logged in mock user prior to starting up the app. In that case, the app does not go to the signin screen and goes directly to the profile page as expected. The problem only occurs when I go through the signin page and enter credentials and submit them.
Unfortunately, I don't know enough about authentication to create a PR, but I hope my sample app along with this "fix" gives you enough to go on.
Thank you so much for your support of the Flutter testing ecosystem.
Greetings,
I've been trying to figure out how to use your package with firebase_ui_auth (which supplies sample screens and workflow for Firebase authentication). To do this, I implemented a minimal Flutter app:
https://github.com/philipmjohnson/flutter_mock_firebase_auth
With a minimal integration test:
https://github.com/philipmjohnson/flutter_mock_firebase_auth/blob/main/integration_test/app_test.dart
What I've discovered is that this integration test will not work because the firebase_ui_auth signin workflow requires the ability to invoke the MockUserCredential.additionalUserInfo() method, which currently throws an UnimplementedMethodException. I monkeywrenched your implementation of MockUserCredential to look like this:
And this enabled my integration test to run successfully.
Things work OK if I create a logged in mock user prior to starting up the app. In that case, the app does not go to the signin screen and goes directly to the profile page as expected. The problem only occurs when I go through the signin page and enter credentials and submit them.
Unfortunately, I don't know enough about authentication to create a PR, but I hope my sample app along with this "fix" gives you enough to go on.
Thank you so much for your support of the Flutter testing ecosystem.