@@ -37,25 +37,50 @@ it('can submit a minimal form', () => {
37
37
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 (
38
38
initialData . hearAboutCYF
39
39
)
40
+ setExperience ( 'public speaking' , 'None' )
41
+ setExperience ( 'node' , 'Some' )
42
+ setExperience ( 'react' , 'Professional experience' )
43
+ setExperience ( 'blogging' , 'Some' )
40
44
41
45
// submission
42
46
cy . findByRole ( 'checkbox' , { name : / t e r m s o f u s e / i } ) . check ( )
43
47
cy . findByRole ( 'checkbox' , { name : / c o n t a c t m e / i } ) . check ( )
44
48
cy . findByRole ( 'button' , { name : / s u b m i t / i } ) . click ( )
45
49
46
50
cy . wait ( '@createVolunteer' ) . then ( ( { request : { body : payload } } ) => {
47
- expect ( payload ) . to . deep . eq ( {
51
+ expect ( payload ) . to . deep . include ( {
48
52
...initialData ,
49
53
agreeToReceiveCommunication : true ,
50
54
agreeToTOU : true ,
51
- guidePeople : [ ] ,
52
55
cityId : '123abc' ,
53
56
employer : '' ,
54
- otherSkill : [ ] ,
55
- techSkill : [ ] ,
56
57
tel : `+${ initialData . tel } ` ,
57
58
userId : ''
58
59
} )
60
+ expect ( payload . guidePeople ) . to . deep . include ( {
61
+ id : '09u03uifnc' ,
62
+ label : 'Help people learn public speaking' ,
63
+ level : 'None' ,
64
+ name : 'Help people learn public speaking'
65
+ } )
66
+ expect ( payload . otherSkill ) . to . deep . include ( {
67
+ id : '8hyuhe22uhh' ,
68
+ label : 'Blogging / Writing' ,
69
+ level : 'Some' ,
70
+ name : 'Blogging / Writing'
71
+ } )
72
+ expect ( payload . techSkill ) . to . deep . include ( {
73
+ id : '8976tygsbhj3e' ,
74
+ label : 'NodeJS' ,
75
+ level : 'Some' ,
76
+ name : 'NodeJS'
77
+ } )
78
+ expect ( payload . techSkill ) . to . deep . include ( {
79
+ id : '23edcs3h3j3' ,
80
+ label : 'ReactJS' ,
81
+ level : 'Professional experience' ,
82
+ name : 'ReactJS'
83
+ } )
59
84
} )
60
85
cy . findByText (
61
86
`Welcome ${ initialData . firstName } ${ initialData . lastName } `
@@ -96,3 +121,12 @@ it('requires employee selection', () => {
96
121
expect ( payload ) . to . have . property ( 'employer' , 'Capgemini' )
97
122
} )
98
123
} )
124
+
125
+ const setExperience = ( topic , level ) => {
126
+ cy . findByRole ( 'checkbox' , { name : new RegExp ( topic , 'i' ) } )
127
+ . check ( )
128
+ . parents ( '.form-table' )
129
+ . within ( ( ) => {
130
+ cy . findByRole ( 'radio' , { name : new RegExp ( level , 'i' ) } ) . check ( )
131
+ } )
132
+ }
0 commit comments