@@ -4,6 +4,40 @@ beforeEach(() => {
4
4
cy . request ( 'POST' , `${ mockServerURL } /_reset` )
5
5
} )
6
6
7
+ it ( 'shows success message' , ( ) => {
8
+ cy . visit ( '/code/foobar/success' )
9
+ cy . findByText ( / w e w i l l r e v i e w y o u r a p p l i c a t i o n / i) . should ( 'exist' )
10
+ } )
11
+
12
+ it ( 'includes the user ID when resubmitting' , ( ) => {
13
+ const userId = 'something'
14
+ const code = 'does-this-matter'
15
+ cy . visit ( `/code/${ userId } /${ code } ` )
16
+
17
+ cy . findByRole ( 'textbox' , { name : / f i r s t n a m e / i } ) . type ( 'Erhard' )
18
+ cy . findByRole ( 'textbox' , { name : / l a s t n a m e / i } ) . type ( 'Hennemann' )
19
+ cy . findByRole ( 'combobox' , { name : / c i t y / i } ) . select ( 'London' )
20
+ cy . findByRole ( 'textbox' , { name : / e m a i l / i } ) . type (
21
+
22
+ )
23
+ cy . findByRole ( 'textbox' , { name : / p h o n e n u m b e r / i } ) . type ( '0158-8969905' )
24
+ cy . findByRole ( 'textbox' , { name : / i n t e r e s t e d i n v o l u n t e e r i n g / i } ) . type ( 'just' )
25
+ cy . findByRole ( 'textbox' , { name : / i n t e r e s t e d i n c o d e y o u r f u t u r e / i } ) . type (
26
+ 'testing'
27
+ )
28
+ cy . findByRole ( 'checkbox' , { name : / t e r m s o f u s e / i } ) . check ( )
29
+ cy . findByRole ( 'checkbox' , { name : / c o n t a c t m e / i } ) . check ( )
30
+ cy . findByRole ( 'button' , { name : / s u b m i t / i } ) . click ( )
31
+
32
+ cy . request ( `${ mockServerURL } /_calls` ) . then ( ( { body } ) => {
33
+ expect ( body ) . to . have . length ( 1 )
34
+ const [ { body : payload , method, path } ] = body
35
+ expect ( method ) . to . equal ( 'POST' )
36
+ expect ( path ) . to . equal ( '/volunteer' )
37
+ expect ( payload ) . to . have . property ( 'userId' , userId )
38
+ } )
39
+ } )
40
+
7
41
it ( 'lets you request a reminder email' , ( ) => {
8
42
const userId = 'whoever'
9
43
const code = 'whatever'
@@ -26,3 +60,8 @@ it('lets you request a reminder email', () => {
26
60
expect ( payload ) . to . deep . equal ( { email, userId } )
27
61
} )
28
62
} )
63
+
64
+ it ( 'lets you revalidate on failure' , ( ) => {
65
+ cy . visit ( '/code/user/failed' )
66
+ cy . findByText ( / f a i l e d t o v e r i f y y o u r e m a i l a d d r e s s / i) . should ( 'exist' )
67
+ } )
0 commit comments