File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ const path = require ( 'path' ) ;
2+
3+ describe ( 'cps-table page' , ( ) => {
4+ describe ( 'export to xlsx' , ( ) => {
5+ beforeEach ( ( ) => {
6+ cy . visit ( '/table' ) ;
7+ } ) ;
8+
9+ it ( 'should properly download valid xlsx' , ( ) => {
10+ cy . contains ( 'Table 6' ) . click ( { force : true } ) ;
11+ cy . get ( '.cps-table-tbar-export-btn cps-icon' ) . click ( ) ;
12+ cy . contains ( 'XLSX' ) . click ( ) ;
13+
14+ const downloadsFolder = Cypress . config ( 'downloadsFolder' ) ;
15+ const downloadedFilePath = path . join ( downloadsFolder , 'table_6.xlsx' ) ;
16+ cy . readFile ( downloadedFilePath ) . should ( 'exist' ) ;
17+
18+ cy . fixture ( 'table_6_fixture.xlsx' ) . then ( ( fixtureContent ) => {
19+ cy . readFile ( downloadedFilePath ) . then ( ( downloadedFileContent ) => {
20+ expect ( downloadedFileContent ) . equals ( fixtureContent ) ;
21+ } ) ;
22+ } ) ;
23+ } ) ;
24+ } ) ;
25+ } ) ;
You can’t perform that action at this time.
0 commit comments