-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add additional tests for EmailPasswordSignInContents, additional test…
…er.pump() in signInWithEmailAndPassword helper
- Loading branch information
Showing
2 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import 'package:ecommerce_app/src/common_widgets/alert_dialogs.dart'; | ||
import 'package:ecommerce_app/src/common_widgets/custom_text_button.dart'; | ||
import 'package:ecommerce_app/src/common_widgets/primary_button.dart'; | ||
import 'package:ecommerce_app/src/features/authentication/data/fake_auth_repository.dart'; | ||
import 'package:ecommerce_app/src/features/authentication/presentation/account/account_screen.dart'; | ||
|
@@ -49,6 +50,13 @@ class AuthRobot { | |
await tester.pumpAndSettle(); | ||
} | ||
|
||
Future<void> tapFormToggleButton() async { | ||
final toggleButton = find.byType(CustomTextButton); | ||
expect(toggleButton, findsOneWidget); | ||
await tester.tap(toggleButton); | ||
await tester.pumpAndSettle(); | ||
} | ||
|
||
Future<void> enterEmail(String email) async { | ||
final emailField = find.byKey(EmailPasswordSignInScreen.emailKey); | ||
expect(emailField, findsOneWidget); | ||
|
@@ -61,8 +69,19 @@ class AuthRobot { | |
await tester.enterText(passwordField, password); | ||
} | ||
|
||
void expectCreateAccountButtonFound() { | ||
final dialogTitle = find.text('Create an account'); | ||
expect(dialogTitle, findsOneWidget); | ||
} | ||
|
||
void expectCreateAccountButtonNotFound() { | ||
final dialogTitle = find.text('Create an account'); | ||
expect(dialogTitle, findsNothing); | ||
} | ||
|
||
Future<void> signInWithEmailAndPassword() async { | ||
await enterEmail('[email protected]'); | ||
await tester.pump(); | ||
await enterPassword('test1234'); | ||
await tapEmailAndPasswordSubmitButton(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters