Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions cypress/e2e/cps-table.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const path = require('path');

Check failure on line 1 in cypress/e2e/cps-table.cy.ts

View workflow job for this annotation

GitHub Actions / test

Require statement not part of import statement

describe('cps-table page', () => {
describe('export to xlsx', () => {
beforeEach(() => {
cy.visit('/table');
});

it('should properly download valid xlsx', () => {
cy.contains('Table 6').click({ force: true });
cy.get('.cps-table-tbar-export-btn cps-icon').click();
cy.contains('XLSX').click();

const downloadsFolder = Cypress.config('downloadsFolder');
const downloadedFilePath = path.join(downloadsFolder, 'table_6.xlsx');
cy.readFile(downloadedFilePath).should('exist');

cy.fixture('table_6_fixture.xlsx').then((fixtureContent) => {
cy.readFile(downloadedFilePath).then((downloadedFileContent) => {
expect(downloadedFileContent).equals(fixtureContent);
});
});
});
});
});
Binary file added cypress/fixtures/table_6_fixture.xlsx
Binary file not shown.
117 changes: 13 additions & 104 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
"@angular/platform-browser-dynamic": "^19.1.4",
"@angular/platform-server": "^19.1.4",
"@angular/router": "^19.1.4",
"@e965/xlsx": "^0.20.3",
"@types/lodash-es": "^4.17.12",
"eslint-plugin-cypress": "^3.6.0",
"lodash-es": "^4.17.21",
"primeng": "^19.0.5",
"rxjs": "~7.8.1",
"tslib": "^2.8.1",
"xlsx": "^0.18.5",
"zone.js": "^0.15.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ export class CpsTableComponent implements OnInit, AfterViewChecked, OnChanges {
}

exportXLSX() {
import('xlsx').then((xlsx) => {
import('@e965/xlsx').then((xlsx) => {
const sheetData = [
this.selectedColumns.map(
(c: { [key: string]: any }) => c[this.colHeaderName]
Expand Down
Loading