1
+ describe ( 'Sign-up with Invalid Credentials' , ( ) => {
2
+ beforeAll ( async ( ) => {
3
+ await device . launchApp ( {
4
+ newInstance : true ,
5
+ launchArgs : { isDetoxTest : true } ,
6
+ } ) ;
7
+ } ) ;
8
+
9
+ it ( 'should not allow sign up without accepting TOS' , async ( ) => {
10
+ // Navigate to the sign-up screen and fill in the details except for TOS
11
+ await new Promise ( resolve => setTimeout ( resolve , 10000 ) ) ;
12
+
13
+ await waitFor ( element ( by . id ( 'signup-link' ) ) )
14
+ . toBeVisible ( )
15
+ . withTimeout ( 5000 ) ;
16
+ await element ( by . id ( 'signup-link' ) ) . tap ( ) ;
17
+
18
+ await element ( by . id ( 'signup-fname-input' ) ) . typeText ( 'John' ) ;
19
+ await waitFor ( element ( by . id ( 'signup-lname-input' ) ) )
20
+ . toBeVisible ( )
21
+ . whileElement ( by . id ( 'scrollViewId' ) )
22
+ . scroll ( 400 , 'down' ) ;
23
+ await element ( by . id ( 'signup-lname-input' ) ) . typeText ( 'Doe' ) ;
24
+ await element ( by . id ( 'signup-email-input' ) ) . typeText ( `johndoe${ Date . now ( ) } @example.com` ) ;
25
+ await element ( by . id ( 'signup-password-input' ) ) . typeText ( 'password123' ) ;
26
+ await element ( by . id ( 'signup-repassword-input' ) ) . typeText ( 'password123' ) ;
27
+
28
+ if ( device . getPlatform ( ) === 'android' ) {
29
+ await device . pressBack ( ) ;
30
+ }
31
+
32
+ // Attempt to submit the form without accepting TOS
33
+ await element ( by . id ( 'signup-submit-button' ) ) . tap ( ) ;
34
+
35
+ // Verify that an error message is displayed or the user remains on the sign-up page
36
+ await waitFor ( element ( by . id ( 'signup-submit-button' ) ) )
37
+ . toBeVisible ( )
38
+ . withTimeout ( 10000 ) ; // Adjust according to your app's error handling
39
+ await element ( by . id ( 'signup-submit-button' ) ) . tap ( ) ;
40
+ // Optionally, check for a specific error message if your app provides one
41
+ } ) ;
42
+ } ) ;
43
+
0 commit comments