Skip to content

Commit 76f6e2e

Browse files
authored
Merge pull request #1208 from microting/copilot/update-excel-file-format
Add week number column to Excel fixture and upload generated files as artifacts
2 parents a7d48a3 + 8c88edb commit 76f6e2e

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed

.github/workflows/dotnet-core-pr.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,15 @@ jobs:
194194
if: ${{ failure() }}
195195
run: |
196196
cat docker_run_log
197+
- name: Archive generated Excel files
198+
if: ${{ always() }}
199+
uses: actions/upload-artifact@v4
200+
with:
201+
name: generated-excel-${{matrix.test}}
202+
path: |
203+
/home/runner/work/eform-angular-timeplanning-plugin/eform-angular-timeplanning-plugin/eform-angular-frontend/eform-client/cypress/downloads/generated-excel-report.xlsx
204+
retention-days: 7
205+
if-no-files-found: ignore
197206
- name: Archive videos
198207
if: ${{ failure() }}
199208
uses: actions/upload-artifact@v4

eform-client/cypress/e2e/plugins/time-planning-pn/a/time-planning-working-hours.export.cy.ts

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,26 @@ describe('Time planning plugin working hours export', () => {
4242
const downloadedExcelFilename = path.join(downloadsFolder, `${fileNameExcelReport}.xlsx`);
4343
const fixturesExcelFilename = path.join(<string>fixturesFolder, `${fileNameExcelReport}.xlsx`);
4444

45-
cy.readFile(fixturesExcelFilename, 'binary').then((file1Content) => {
46-
cy.readFile(downloadedExcelFilename, 'binary').then((file2Content) => {
47-
48-
const workbook1 = read(file1Content, { type: 'binary' });
49-
const sheetName1 = workbook1.SheetNames[0]; // Assuming you're comparing the first sheet
50-
const sheet1 = workbook1.Sheets[sheetName1];
51-
const jsonData1 = utils.sheet_to_json(sheet1, { header: 1 }); // Convert sheet to array of arrays
52-
const workbook = read(file2Content, { type: 'binary' });
53-
const sheetName = workbook.SheetNames[0]; // Assuming you're comparing the first sheet
54-
const sheet = workbook.Sheets[sheetName];
55-
const jsonData = utils.sheet_to_json(sheet, { header: 1 }); // Convert sheet to array of arrays
56-
console.log(jsonData);
57-
console.log(jsonData1);
58-
expect(jsonData).to.deep.equal(jsonData1);
59-
//expect(read(file1Content, {type: 'binary'}), 'excel file').to.deep.equal(read(file2Content, {type: 'binary'}));
45+
// Save the generated Excel file to a location for GitHub Actions artifact upload
46+
cy.readFile(downloadedExcelFilename, 'binary').then((generatedContent) => {
47+
// Copy the generated file to cypress/downloads for artifact collection
48+
cy.writeFile(path.join(downloadsFolder, 'generated-excel-report.xlsx'), generatedContent, 'binary');
49+
50+
cy.log('Generated Excel file saved for artifact upload');
51+
52+
// Compare with fixture file
53+
cy.readFile(fixturesExcelFilename, 'binary').then((fixtureContent) => {
54+
const workbookGenerated = read(generatedContent, { type: 'binary' });
55+
const sheetGenerated = workbookGenerated.Sheets[workbookGenerated.SheetNames[0]];
56+
const jsonDataGenerated = utils.sheet_to_json(sheetGenerated, { header: 1 });
57+
58+
const workbookFixture = read(fixtureContent, { type: 'binary' });
59+
const sheetFixture = workbookFixture.Sheets[workbookFixture.SheetNames[0]];
60+
const jsonDataFixture = utils.sheet_to_json(sheetFixture, { header: 1 });
61+
62+
console.log('Generated:', jsonDataGenerated);
63+
console.log('Fixture:', jsonDataFixture);
64+
expect(jsonDataGenerated).to.deep.equal(jsonDataFixture);
6065
});
6166
});
6267
});
132 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)