@@ -57,3 +57,35 @@ it('can submit a minimal form', () => {
57
57
} )
58
58
} )
59
59
} )
60
+
61
+ it ( 'requires employee selection' , ( ) => {
62
+ cy . findByRole ( 'textbox' , { name : / f i r s t n a m e / i } ) . type ( 'Laura' )
63
+ cy . findByRole ( 'textbox' , { name : / l a s t n a m e / i } ) . type ( 'Olsen' )
64
+ cy . findByRole ( 'combobox' , { name : / c i t y / i } ) . select ( 'London' )
65
+ cy . findByRole ( 'textbox' , { name :
/ e m a i l / i } ) . type ( '[email protected] ' )
66
+ cy . findByRole ( 'textbox' , { name : / p h o n e n u m b e r / i } ) . type ( '96838503' )
67
+ 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' )
68
+ 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 (
69
+ 'testing'
70
+ )
71
+ cy . findByRole ( 'checkbox' , { name : / t e r m s o f u s e / i } ) . check ( )
72
+ cy . findByRole ( 'checkbox' , { name : / c o n t a c t m e / i } ) . check ( )
73
+
74
+ cy . findByRole ( 'combobox' , { name : / h e a r a b o u t c o d e y o u r f u t u r e / i } ) . select (
75
+ 'Employer'
76
+ )
77
+ cy . findByRole ( 'button' , { name : / s u b m i t / i } ) . click ( )
78
+ cy . findByText ( / f o r m i s i n c o m p l e t e / i) . should ( 'exist' )
79
+
80
+ cy . findByRole ( 'combobox' , { name : / w h o i s y o u r e m p l o y e r / i } ) . select (
81
+ 'Capgemini'
82
+ )
83
+ cy . findByRole ( 'button' , { name : / s u b m i t / i } ) . click ( )
84
+
85
+ cy . request ( `${ mockServerURL } /_calls` ) . then ( ( { body } ) => {
86
+ expect ( body ) . to . have . length ( 1 )
87
+ const [ { body : payload } ] = body
88
+ expect ( payload ) . to . have . property ( 'hearAboutCYF' , 'Employer' )
89
+ expect ( payload ) . to . have . property ( 'employer' , 'Capgemini' )
90
+ } )
91
+ } )
0 commit comments