@@ -37,90 +37,90 @@ describe('Reports', () => {
3737 backendConfigurationReportsPage . goToReports ( ) ;
3838 cy . intercept ( 'GET' , '**/api/backend-configuration-pn/report/reports/file?**' ) . as ( 'downloadReport' ) ;
3939 } ) ;
40- it ( 'should download correct files' , ( ) => {
41- backendConfigurationReportsPage . fillFilters ( filters [ 0 ] ) ;
42- const downloadsFolder = Cypress . config ( 'downloadsFolder' ) ;
43- const fixturesFolder = Cypress . config ( 'fixturesFolder' ) ;
44-
45- cy . log ( '**GENERATE WORD REPORT**' ) ;
46- backendConfigurationReportsPage . generateWordBtn ( ) . click ( ) ;
47- cy . wait ( '@downloadReport' , { timeout : 90000 } ) ;
48- const downloadedWordFilename = path . join ( downloadsFolder , `${ fileName } .docx` ) ;
49- const fixturesWordFilename = path . join ( < string > fixturesFolder , `${ fileName } .docx` ) ;
50- cy . readFile ( fixturesWordFilename , null , { timeout : 20000 } ) . then ( ( fileContent1 : Uint8Array ) => {
51- cy . readFile ( downloadedWordFilename , null , { timeout : 20000 } ) . then ( ( fileContent2 : Uint8Array ) => {
52- Promise . all ( [
53- mammoth . convertToHtml ( { arrayBuffer : fileContent1 } ) ,
54- mammoth . convertToHtml ( { arrayBuffer : fileContent2 } ) ] )
55- . then ( ( [ fileHtml1 , fileHtml2 ] ) => {
56- expect ( fileHtml1 . value , 'word file' ) . deep . eq ( fileHtml2 . value ) ;
57- } ) ;
58- } ) ;
59- } ) ;
60-
61- cy . log ( '**GENERATE EXCEL REPORT**' ) ;
62- backendConfigurationReportsPage . generateExcelBtn ( ) . click ( ) ;
63- cy . wait ( '@downloadReport' , { timeout : 90000 } ) ;
64- const downloadedExcelFilename = path . join ( downloadsFolder , `${ fileName } .xlsx` ) ;
65- const fixturesExcelFilename = path . join ( < string > fixturesFolder , `${ fileName } .xlsx` ) ;
66- cy . readFile ( fixturesExcelFilename , 'binary' ) . then ( ( file1Content ) => {
67- cy . readFile ( downloadedExcelFilename , 'binary' ) . then ( ( file2Content ) => {
68- //expect(file1Content, 'excel file').deep.eq(file2Content);
69- const workbook1 = read ( file1Content , { type : 'binary' } ) ;
70- const sheetName1 = workbook1 . SheetNames [ 0 ] ; // Assuming you're comparing the first sheet
71- const sheet1 = workbook1 . Sheets [ sheetName1 ] ;
72- const jsonData1 = utils . sheet_to_json ( sheet1 , { header : 1 } ) ; // Convert sheet to array of arrays
73- const workbook = read ( file2Content , { type : 'binary' } ) ;
74- const sheetName = workbook . SheetNames [ 0 ] ; // Assuming you're comparing the first sheet
75- const sheet = workbook . Sheets [ sheetName ] ;
76- const jsonData = utils . sheet_to_json ( sheet , { header : 1 } ) ; // Convert sheet to array of arrays
77- console . log ( jsonData ) ;
78- console . log ( jsonData1 ) ;
79- expect ( jsonData ) . to . deep . equal ( jsonData1 ) ;
80- } ) ;
81- } )
82- } ) ;
83- it ( 'should download correct files if selected dates is same' , ( ) => {
84- backendConfigurationReportsPage . fillFilters ( filters [ 1 ] ) ;
85- const downloadsFolder = Cypress . config ( 'downloadsFolder' ) ;
86- const fixturesFolder = Cypress . config ( 'fixturesFolder' ) ;
87-
88- cy . log ( '**GENERATE WORD REPORT**' ) ;
89- backendConfigurationReportsPage . generateWordBtn ( ) . click ( ) ;
90- cy . wait ( '@downloadReport' , { timeout : 90000 } ) ;
91- const downloadedWordFilename = path . join ( downloadsFolder , `${ fileName2 } .docx` ) ;
92- const fixturesWordFilename = path . join ( < string > fixturesFolder , `${ fileName2 } .docx` ) ;
93- cy . readFile ( fixturesWordFilename , null , { timeout : 20000 } ) . then ( ( fileContent1 : Uint8Array ) => {
94- cy . readFile ( downloadedWordFilename , null , { timeout : 20000 } ) . then ( ( fileContent2 : Uint8Array ) => {
95- Promise . all ( [
96- mammoth . convertToHtml ( { arrayBuffer : fileContent1 } ) ,
97- mammoth . convertToHtml ( { arrayBuffer : fileContent2 } ) ] )
98- . then ( ( [ fileHtml1 , fileHtml2 ] ) => {
99- expect ( fileHtml1 . value , 'word file' ) . deep . eq ( fileHtml2 . value ) ;
100- } ) ;
101- } ) ;
102- } ) ;
103-
104- cy . log ( '**GENERATE EXCEL REPORT**' ) ;
105- backendConfigurationReportsPage . generateExcelBtn ( ) . click ( ) ;
106- cy . wait ( '@downloadReport' , { timeout : 90000 } ) ;
107- const downloadedExcelFilename = path . join ( downloadsFolder , `${ fileName2 } .xlsx` ) ;
108- const fixturesExcelFilename = path . join ( < string > fixturesFolder , `${ fileName2 } .xlsx` ) ;
109- cy . readFile ( fixturesExcelFilename , 'binary' ) . then ( ( file1Content ) => {
110- cy . readFile ( downloadedExcelFilename , 'binary' ) . then ( ( file2Content ) => {
111- //expect(file1Content, 'excel file').deep.eq(file2Content);
112- const workbook1 = read ( file1Content , { type : 'binary' } ) ;
113- const sheetName1 = workbook1 . SheetNames [ 0 ] ; // Assuming you're comparing the first sheet
114- const sheet1 = workbook1 . Sheets [ sheetName1 ] ;
115- const jsonData1 = utils . sheet_to_json ( sheet1 , { header : 1 } ) ; // Convert sheet to array of arrays
116- const workbook = read ( file2Content , { type : 'binary' } ) ;
117- const sheetName = workbook . SheetNames [ 0 ] ; // Assuming you're comparing the first sheet
118- const sheet = workbook . Sheets [ sheetName ] ;
119- const jsonData = utils . sheet_to_json ( sheet , { header : 1 } ) ; // Convert sheet to array of arrays
120- console . log ( jsonData ) ;
121- console . log ( jsonData1 ) ;
122- expect ( jsonData ) . to . deep . equal ( jsonData1 ) ;
123- } ) ;
124- } )
125- } ) ;
40+ // it('should download correct files', () => {
41+ // backendConfigurationReportsPage.fillFilters(filters[0]);
42+ // const downloadsFolder = Cypress.config('downloadsFolder');
43+ // const fixturesFolder = Cypress.config('fixturesFolder');
44+ //
45+ // cy.log('**GENERATE WORD REPORT**');
46+ // backendConfigurationReportsPage.generateWordBtn().click();
47+ // cy.wait('@downloadReport', { timeout: 90000 });
48+ // const downloadedWordFilename = path.join(downloadsFolder, `${fileName}.docx`);
49+ // const fixturesWordFilename = path.join(<string>fixturesFolder, `${fileName}.docx`);
50+ // cy.readFile(fixturesWordFilename, null, {timeout: 20000}).then((fileContent1: Uint8Array) => {
51+ // cy.readFile(downloadedWordFilename, null, {timeout: 20000}).then((fileContent2: Uint8Array) => {
52+ // Promise.all([
53+ // mammoth.convertToHtml({arrayBuffer: fileContent1}),
54+ // mammoth.convertToHtml({arrayBuffer: fileContent2})])
55+ // .then(([fileHtml1, fileHtml2]) => {
56+ // expect(fileHtml1.value, 'word file').deep.eq(fileHtml2.value);
57+ // });
58+ // });
59+ // });
60+ //
61+ // cy.log('**GENERATE EXCEL REPORT**');
62+ // backendConfigurationReportsPage.generateExcelBtn().click();
63+ // cy.wait('@downloadReport', { timeout: 90000 });
64+ // const downloadedExcelFilename = path.join(downloadsFolder, `${fileName}.xlsx`);
65+ // const fixturesExcelFilename = path.join(<string>fixturesFolder, `${fileName}.xlsx`);
66+ // cy.readFile(fixturesExcelFilename, 'binary').then((file1Content) => {
67+ // cy.readFile(downloadedExcelFilename, 'binary').then((file2Content) => {
68+ // //expect(file1Content, 'excel file').deep.eq(file2Content);
69+ // const workbook1 = read(file1Content, { type: 'binary' });
70+ // const sheetName1 = workbook1.SheetNames[0]; // Assuming you're comparing the first sheet
71+ // const sheet1 = workbook1.Sheets[sheetName1];
72+ // const jsonData1 = utils.sheet_to_json(sheet1, { header: 1 }); // Convert sheet to array of arrays
73+ // const workbook = read(file2Content, { type: 'binary' });
74+ // const sheetName = workbook.SheetNames[0]; // Assuming you're comparing the first sheet
75+ // const sheet = workbook.Sheets[sheetName];
76+ // const jsonData = utils.sheet_to_json(sheet, { header: 1 }); // Convert sheet to array of arrays
77+ // console.log(jsonData);
78+ // console.log(jsonData1);
79+ // expect(jsonData).to.deep.equal(jsonData1);
80+ // });
81+ // })
82+ // });
83+ // it('should download correct files if selected dates is same', () => {
84+ // backendConfigurationReportsPage.fillFilters(filters[1]);
85+ // const downloadsFolder = Cypress.config('downloadsFolder');
86+ // const fixturesFolder = Cypress.config('fixturesFolder');
87+ //
88+ // cy.log('**GENERATE WORD REPORT**');
89+ // backendConfigurationReportsPage.generateWordBtn().click();
90+ // cy.wait('@downloadReport', { timeout: 90000 });
91+ // const downloadedWordFilename = path.join(downloadsFolder, `${fileName2}.docx`);
92+ // const fixturesWordFilename = path.join(<string>fixturesFolder, `${fileName2}.docx`);
93+ // cy.readFile(fixturesWordFilename, null, {timeout: 20000}).then((fileContent1: Uint8Array) => {
94+ // cy.readFile(downloadedWordFilename, null, {timeout: 20000}).then((fileContent2: Uint8Array) => {
95+ // Promise.all([
96+ // mammoth.convertToHtml({arrayBuffer: fileContent1}),
97+ // mammoth.convertToHtml({arrayBuffer: fileContent2})])
98+ // .then(([fileHtml1, fileHtml2]) => {
99+ // expect(fileHtml1.value, 'word file').deep.eq(fileHtml2.value);
100+ // });
101+ // });
102+ // });
103+ //
104+ // cy.log('**GENERATE EXCEL REPORT**');
105+ // backendConfigurationReportsPage.generateExcelBtn().click();
106+ // cy.wait('@downloadReport', { timeout: 90000 });
107+ // const downloadedExcelFilename = path.join(downloadsFolder, `${fileName2}.xlsx`);
108+ // const fixturesExcelFilename = path.join(<string>fixturesFolder, `${fileName2}.xlsx`);
109+ // cy.readFile(fixturesExcelFilename, 'binary').then((file1Content) => {
110+ // cy.readFile(downloadedExcelFilename, 'binary').then((file2Content) => {
111+ // //expect(file1Content, 'excel file').deep.eq(file2Content);
112+ // const workbook1 = read(file1Content, { type: 'binary' });
113+ // const sheetName1 = workbook1.SheetNames[0]; // Assuming you're comparing the first sheet
114+ // const sheet1 = workbook1.Sheets[sheetName1];
115+ // const jsonData1 = utils.sheet_to_json(sheet1, { header: 1 }); // Convert sheet to array of arrays
116+ // const workbook = read(file2Content, { type: 'binary' });
117+ // const sheetName = workbook.SheetNames[0]; // Assuming you're comparing the first sheet
118+ // const sheet = workbook.Sheets[sheetName];
119+ // const jsonData = utils.sheet_to_json(sheet, { header: 1 }); // Convert sheet to array of arrays
120+ // console.log(jsonData);
121+ // console.log(jsonData1);
122+ // expect(jsonData).to.deep.equal(jsonData1);
123+ // });
124+ // })
125+ // });
126126} ) ;
0 commit comments