Skip to content

Commit

Permalink
#2517 - cypress test to show approval message in admin approval histo…
Browse files Browse the repository at this point in the history
…ry table
  • Loading branch information
rmmayo committed Jan 10, 2025
1 parent c292206 commit 8fb6972
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ describe('Self Report Approval History Tests', () => {
cy.createSkill(1, 1, 1, { selfReportingType: 'Approval' });
cy.createSkill(1, 1, 2, { selfReportingType: 'Approval' });
cy.createSkill(1, 1, 3, { selfReportingType: 'Approval' });
cy.createSkill(1, 1, 4, { selfReportingType: 'Approval' });
// cy.reportSkill(1, 2, 'user6', '2020-09-11 11:00')
// cy.reportSkill(1, 2, 'user5', '2020-09-12 11:00')
// cy.reportSkill(1, 2, 'user4', '2020-09-13 11:00')
Expand All @@ -68,9 +69,35 @@ describe('Self Report Approval History Tests', () => {
cy.approveAllRequests();
cy.reportSkill(1, 2, 'user2', '2020-09-16 11:00');
cy.rejectRequest(0);
cy.reportSkill(1, 4, 'user2', '2024-09-16 11:00');
cy.approveRequest(1, 0, 'I approve this message!');

cy.visit('/administrator/projects/proj1/self-report');
cy.validateTable(approvalHistoryTableSelector, [
[
{
colIndex: 0,
value: 'Very Great Skill 4'
}, {
colIndex: 0,
value: 'user2'
},
{
colIndex: 1,
value: 'Approved'
}, {
colIndex: 1,
value: 'Explanation: I approve this message!'
},
{
colIndex: 2,
value: '2024-09-16 11:00'
},
{
colIndex: 3,
value: 'Today'
}
],
[
{
colIndex: 0,
Expand Down
3 changes: 2 additions & 1 deletion e2e-tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -837,11 +837,12 @@ Cypress.Commands.add("reportSkill", (project = 1, skill = 1, userId = 'user@skil
cy.doReportSkill({ project, skill, userId, date, failOnError, approvalRequestedMsg } );
});

Cypress.Commands.add("approveRequest", (projNum = 1, requestNum = 0) => {
Cypress.Commands.add("approveRequest", (projNum = 1, requestNum = 0, approvalMsg = '') => {
cy.request(`/admin/projects/proj${projNum}/approvals?limit=10&ascending=true&page=1&orderBy=userId`)
.then((response) => {
cy.request('POST', `/admin/projects/proj${projNum}/approvals/approve`, {
skillApprovalIds: [response.body.data[requestNum].id],
approvalMessage: approvalMsg,
});
});
});
Expand Down

0 comments on commit 8fb6972

Please sign in to comment.