-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
#566/feat/e2e tests for 557
- Loading branch information
Showing
4 changed files
with
71 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Role } from '@prisma/client'; | ||
|
||
const adminUser = { | ||
name: 'Anna Admin', | ||
email: '[email protected]', | ||
role: Role.ADMIN, | ||
profileCompleted: true, | ||
}; | ||
|
||
const fromDate = '2100-09-10'; | ||
const toDate = '2100-09-20'; | ||
|
||
describe('Exporting Course Statistics', () => { | ||
beforeEach(() => { | ||
cy.task('clearDatabase'); | ||
cy.task('seedDatabase'); | ||
cy.login(adminUser.email, adminUser.role); | ||
|
||
cy.get('[aria-label^="SpeedDial"]').click(); | ||
cy.getCy('dashboard').click(); | ||
}); | ||
|
||
it('should export csv file when correct dateframe is given', () => { | ||
cy.getCy('exportFormFromDate').type(fromDate); | ||
cy.getCy('exportFormToDate').type(toDate); | ||
cy.getCy('exportStatsButton').click(); | ||
cy.contains('Download started'); | ||
cy.readFile(`cypress/downloads/training-data_${fromDate}_${toDate}.csv`); | ||
}); | ||
|
||
it('should not export csv file when incorrect dateframe is given', () => { | ||
cy.getCy('exportFormFromDate').type(toDate); | ||
cy.getCy('exportFormToDate').type(fromDate); | ||
cy.getCy('exportStatsButton').click(); | ||
cy.contains('Invalid date range'); | ||
cy.readFile( | ||
`cypress/downloads/training-data_${toDate}_${fromDate}.csv` | ||
).should('not.exist'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters