@@ -28,6 +28,7 @@ describe('Custom Prefill Test', function () {
2828 dobDropdown = "input[name='dob']" ,
2929 jobDropdown = "select[name='job']" ;
3030 let genderRadioButton = "input[name='radiobutton-c8c660bac8_gender']" ;
31+ let fileAttachment = "input[name='fileinput1749031651340']" ;
3132 let formContainer = null ;
3233
3334 beforeEach ( ( ) => {
@@ -61,11 +62,13 @@ describe('Custom Prefill Test', function () {
6162 }
6263 cy . get ( genderRadioButton ) . should ( "have.value" , "0" ) ;
6364 cy . get ( jobDropdown ) . should ( "have.value" , "1" ) ;
65+ cy . get ( '.cmp-adaptiveform-fileinput__fileitem' ) . should ( 'exist' ) ;
6466 }
6567
6668 }
6769
6870 it ( '' , function ( ) {
71+ let sampleFileNames = [ 'sample.txt' ] ;
6972 if ( cy . af . isOldCoreComponent ( ) ) {
7073 genderRadioButton = "input[name='gender']" ; // was added due to enhancement in repeatibility of radio buttons in core components
7174 }
@@ -74,10 +77,11 @@ describe('Custom Prefill Test', function () {
7477 cy . get ( dobDropdown ) . type ( "1999-10-10" ) ;
7578 cy . get ( genderRadioButton ) . first ( ) . check ( ) ;
7679 cy . get ( jobDropdown ) . select ( 'Working' ) ;
80+ cy . attachFile ( fileAttachment , [ sampleFileNames [ 0 ] ] ) ;
7781
7882 // submitting the form and fetching the prefillID
7983 let prefillId ;
80- cy . get ( "button" ) . click ( ) ;
84+ cy . get ( "button" ) . eq ( 2 ) . click ( ) ;
8185
8286 cy . wait ( '@afSubmission' ) . then ( ( { response} ) => {
8387 expect ( response . statusCode ) . to . equal ( 200 ) ;
@@ -91,6 +95,7 @@ describe('Custom Prefill Test', function () {
9195 } ) ;
9296
9397 it ( 'prefill using service in dataRef' , function ( ) {
98+ let sampleFileNames = [ 'sample2.txt' ] ;
9499 if ( cy . af . isOldCoreComponent ( ) ) {
95100 genderRadioButton = "input[name='gender']" ; // was added due to enhancement in repeatibility of radio buttons in core components
96101 }
@@ -99,10 +104,11 @@ describe('Custom Prefill Test', function () {
99104 cy . get ( dobDropdown ) . type ( "1999-10-10" ) ;
100105 cy . get ( genderRadioButton ) . first ( ) . check ( ) ;
101106 cy . get ( jobDropdown ) . select ( 'Working' ) ;
107+ cy . attachFile ( fileAttachment , [ sampleFileNames [ 0 ] ] ) ;
102108
103109 // submitting the form and fetching the prefillID
104110 let prefillId ;
105- cy . get ( "button" ) . click ( ) ;
111+ cy . get ( "button" ) . eq ( 2 ) . click ( ) ;
106112
107113 cy . wait ( '@afSubmission' ) . then ( ( { response} ) => {
108114 prefillId = response . body . metadata . prefillId ;
0 commit comments