-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FR-18979: Added Sign up via email and password test
- Loading branch information
1 parent
61d6a12
commit 0d55914
Showing
4 changed files
with
290 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -2,4 +2,8 @@ const loginEmail = '[email protected]'; | |
const loginPassword = 'Testing123?'; | ||
|
||
const loginWrongEmail = '[email protected]'; | ||
const loginWrongPassword = 'Testing123?2231'; | ||
const loginWrongPassword = 'Testing123?2231'; | ||
|
||
const signUpEmailTemplate = "alexm122322+{uuid}@gmail.com"; | ||
const signUpName = "Test"; | ||
const signUpOrganization = "Flutter Integration Testing"; |
252 changes: 252 additions & 0 deletions
252
example/integration_test/src/sign_up_via_email_and_password_test.dart
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 |
---|---|---|
@@ -0,0 +1,252 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:frontegg_flutter_example/main.dart'; | ||
import 'package:patrol/patrol.dart'; | ||
import 'package:uuid/uuid.dart'; | ||
|
||
import '../fixtures/const.dart'; | ||
|
||
void main() { | ||
late final String userEmail; | ||
|
||
patrolSetUp(() { | ||
userEmail = signUpEmailTemplate.replaceFirst("{uuid}", const Uuid().v4()); | ||
}); | ||
|
||
patrolTest( | ||
"Success Sign up via email and password", | ||
($) async { | ||
await $.pumpWidget(const MyApp()); | ||
await $.pumpAndSettle(); | ||
|
||
await $.tap(find.byKey(const ValueKey("LoginButton"))); | ||
await Future.delayed(const Duration(seconds: 5)); | ||
|
||
await $.native.tap(Selector(text: "Sign up")); | ||
await $.native.waitUntilVisible(Selector(text: "Account sign-up")); | ||
|
||
await $.native.enterTextByIndex( | ||
userEmail, | ||
index: 0, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
signUpName, | ||
index: 1, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
loginPassword, | ||
index: 2, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
signUpOrganization, | ||
index: 3, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
|
||
await $.native.tap(Selector(text: "Sign up")); | ||
|
||
await $.waitUntilVisible(find.text("Logout")); | ||
|
||
await $.tap(find.byKey(const ValueKey("LogoutButton"))); | ||
await $.pumpAndSettle(); | ||
}, | ||
); | ||
|
||
patrolTest( | ||
'Failure Sign up with existing user', | ||
($) async { | ||
await $.pumpWidget(const MyApp()); | ||
await $.pumpAndSettle(); | ||
|
||
await $.tap(find.byKey(const ValueKey("LoginButton"))); | ||
await Future.delayed(const Duration(seconds: 5)); | ||
|
||
await $.native.tap(Selector(text: "Sign up")); | ||
await $.native.waitUntilVisible(Selector(text: "Account sign-up")); | ||
|
||
await $.native.enterTextByIndex( | ||
loginEmail, | ||
index: 0, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
signUpName, | ||
index: 1, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
loginPassword, | ||
index: 2, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
signUpOrganization, | ||
index: 3, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
|
||
await $.native.tap(Selector(text: "Sign up")); | ||
|
||
await $.native.waitUntilVisible(Selector(text: "User already exists")); | ||
}, | ||
); | ||
|
||
patrolTest( | ||
'Failure Sign up with invalid Email field', | ||
($) async { | ||
await $.pumpWidget(const MyApp()); | ||
await $.pumpAndSettle(); | ||
|
||
await $.tap(find.byKey(const ValueKey("LoginButton"))); | ||
await Future.delayed(const Duration(seconds: 5)); | ||
|
||
await $.native.tap(Selector(text: "Sign up")); | ||
await $.native.waitUntilVisible(Selector(text: "Account sign-up")); | ||
|
||
await $.native.enterTextByIndex( | ||
"s", | ||
index: 0, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
signUpName, | ||
index: 1, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
loginPassword, | ||
index: 2, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
signUpOrganization, | ||
index: 3, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
|
||
await $.native.tap(Selector(text: "Sign up")); | ||
|
||
await $.native.waitUntilVisible(Selector(text: "Must be a valid email")); | ||
}, | ||
); | ||
|
||
patrolTest( | ||
'Failure Sign up with empty Name field', | ||
($) async { | ||
await $.pumpWidget(const MyApp()); | ||
await $.pumpAndSettle(); | ||
|
||
await $.tap(find.byKey(const ValueKey("LoginButton"))); | ||
await Future.delayed(const Duration(seconds: 5)); | ||
|
||
await $.native.tap(Selector(text: "Sign up")); | ||
await $.native.waitUntilVisible(Selector(text: "Account sign-up")); | ||
|
||
await $.native.enterTextByIndex( | ||
loginEmail, | ||
index: 0, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
"", | ||
index: 1, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
loginPassword, | ||
index: 2, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
signUpOrganization, | ||
index: 3, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
|
||
await $.native.tap(Selector(text: "Sign up")); | ||
|
||
await $.native.waitUntilVisible(Selector(text: "Name is required")); | ||
}, | ||
); | ||
|
||
patrolTest( | ||
'Failure Sign up with empty Password field', | ||
($) async { | ||
await $.pumpWidget(const MyApp()); | ||
await $.pumpAndSettle(); | ||
|
||
await $.tap(find.byKey(const ValueKey("LoginButton"))); | ||
await Future.delayed(const Duration(seconds: 5)); | ||
|
||
await $.native.tap(Selector(text: "Sign up")); | ||
await $.native.waitUntilVisible(Selector(text: "Account sign-up")); | ||
|
||
await $.native.enterTextByIndex( | ||
loginEmail, | ||
index: 0, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
signUpName, | ||
index: 1, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
"", | ||
index: 2, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
signUpOrganization, | ||
index: 3, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
|
||
await $.native.tap(Selector(text: "Sign up")); | ||
|
||
await $.native.waitUntilVisible(Selector(text: "Password is required")); | ||
}, | ||
); | ||
|
||
patrolTest( | ||
'Failure Sign up with empty CompanyName field', | ||
($) async { | ||
await $.pumpWidget(const MyApp()); | ||
await $.pumpAndSettle(); | ||
|
||
await $.tap(find.byKey(const ValueKey("LoginButton"))); | ||
await Future.delayed(const Duration(seconds: 5)); | ||
|
||
await $.native.tap(Selector(text: "Sign up")); | ||
await $.native.waitUntilVisible(Selector(text: "Account sign-up")); | ||
|
||
await $.native.enterTextByIndex( | ||
loginEmail, | ||
index: 0, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
signUpName, | ||
index: 1, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
loginPassword, | ||
index: 2, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
await $.native.enterTextByIndex( | ||
"", | ||
index: 3, | ||
keyboardBehavior: KeyboardBehavior.alternative, | ||
); | ||
|
||
await $.native.tap(Selector(text: "Sign up")); | ||
|
||
await $.native.waitUntilVisible(Selector(text: "Company name is required")); | ||
}, | ||
); | ||
} |
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
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