Skip to content

Commit

Permalink
added additional test cases to edit profile page test file (#2331)
Browse files Browse the repository at this point in the history
* added additional test cases to edit profile page test file

* updates the code

* fixed failing tests

* fixed

* Done some corrections in previous code

* Update edit_profile_page_test.dart

* Update edit_profile_page_test.dart

* Made some changes to run the tests

Made some changes to run the tests
  • Loading branch information
Insiyaya authored Feb 23, 2024
1 parent aafddab commit 71ce80a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class _EditProfilePageState extends State<EditProfilePage> {
Flexible(
// Text field for first name with value text of user's first name.
child: TextFormField(
key: const Key('FirstNameTextField'),
controller: model.firstNameTextController
..text = model.user.firstName!,
focusNode: model.firstNameFocus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,5 +452,24 @@ Future<void> main() async {
expect(model.imageFile, null);
verify(notifyListenerCallback());
});

// Testing onPressed for firstName
testWidgets("Testing if firstName text field gets focus", (tester) async {
userConfig.updateUser(
User(firstName: 'Test', lastName: 'Test', email: '[email protected]'),
);
await tester.pumpWidget(createChangePassScreenDark());
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('FirstNameTextField')));
await tester.pumpAndSettle();

// Verify the focus
expect(
FocusScope.of(tester.element(find.byType(EditProfilePage)))
.focusedChild!
.hasPrimaryFocus,
true,
);
});
});
}

0 comments on commit 71ce80a

Please sign in to comment.