@@ -232,7 +232,7 @@ describe("Form with File Input - Basic Tests", () => {
232232 } )
233233 } )
234234
235- it ( "check preview and delete functionality of duplicate files" , ( ) => {
235+ it ( "check preview functionality of duplicate files" , ( ) => {
236236 let sampleFileNames = [ 'sample2.txt' , 'sample.txt' , 'sample2.txt' ] ;
237237 const fileInput = "input[name='fileinput1']" ;
238238
@@ -242,44 +242,12 @@ describe("Form with File Input - Basic Tests", () => {
242242 cy . attachFile ( fileInput , [ sampleFileNames [ 2 ] ] ) ;
243243
244244 checkFilePreviewInFileAttachment ( fileInput ) ;
245-
246- // Verify initial state
247- cy . get ( '.cmp-adaptiveform-fileinput__fileitem' ) . should ( 'have.length' , 3 ) ;
248-
249- // Delete files by index with verification
250- deleteFilesByIndexWithVerification ( fileInput , sampleFileNames ) ;
251-
252- // Final verification
253- cy . get ( '.cmp-adaptiveform-fileinput__filelist' ) . eq ( 0 ) . children ( ) . should ( 'have.length' , 0 ) ;
245+
246+ deleteSelectedFiles ( fileInput , sampleFileNames ) ;
247+
248+ cy . get ( '.cmp-adaptiveform-fileinput__fileitem' ) . should ( 'have.length' , 0 ) ;
254249 } ) ;
255250
256- const deleteFilesByIndexWithVerification = ( fileInput , fileNames ) => {
257- cy . get ( fileInput ) . closest ( '.cmp-adaptiveform-fileinput' ) . then ( ( ) => {
258- // Delete from end to beginning
259- for ( let i = fileNames . length - 1 ; i >= 0 ; i -- ) {
260- const expectedFileName = fileNames [ i ] ;
261-
262- cy . log ( `Deleting file at index ${ i } : ${ expectedFileName } ` ) ;
263-
264- // Get file item at index and verify content
265- cy . get ( '.cmp-adaptiveform-fileinput__fileitem' )
266- . eq ( i )
267- . within ( ( ) => {
268- // Verify filename before deletion
269- cy . get ( '.cmp-adaptiveform-fileinput__filename' )
270- . should ( 'contain.text' , expectedFileName ) ;
271-
272- // Delete the file
273- cy . get ( '.cmp-adaptiveform-fileinput__filedelete' ) . should ( 'have.attr' , 'role' , 'button' ) . click ( ) ;
274- } ) ;
275-
276- // Verify deletion by checking remaining count
277- cy . get ( '.cmp-adaptiveform-fileinput__fileitem' )
278- . should ( 'have.length' , i ) ;
279- }
280- } ) ;
281- } ;
282-
283251 it ( `fielinput is disabled when readonly property is true` , ( ) => {
284252 const fileInput5 = "input[name='fileinput5']" ;
285253 cy . get ( fileInput5 ) . should ( "have.attr" , "disabled" , "disabled" ) ;
0 commit comments