Added function checkProcessInstanceCompleted() to verify the instance is completed successfully

This commit is contained in:
Madhurya Liyanage 2023-05-13 15:58:27 +05:30
parent 393f8a213c
commit 5298a7116b
5 changed files with 246 additions and 60 deletions

View File

@ -76,24 +76,41 @@ const submitWithUser = (
.contains(/^Submit$/)
.click();
if (expectAdditionalApprovalInfoPage) {
cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 });
// if (expectAdditionalApprovalInfoPage) {
// cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 });
cy.get('button')
.contains(/^Continue$/)
.click();
}
// cy.get('button')
// .contains(/^Continue$/)
// .click();
// }
cy.visit('/');
cy.location({ timeout: 60000 }).should((loc) => {
expect(loc.pathname).to.eq('/');
});
cy.wait(2000);
cy.get('button').contains('Return to Home', { timeout: 60000 });
cy.logout();
cy.wait(2000);
};
//Check if the process instance is completed successfully
const checkProcessInstanceCompleted = (
username,
password,
processInstanceId
) => {
cy.wait(2000);
cy.log('========Login with : ', username);
cy.log('========processInstanceId: ', processInstanceId);
cy.login(username, password);
cy.wait(1000);
cy.visit('/admin/process-instances/find-by-id');
cy.get('#process-instance-id-input').type(processInstanceId);
cy.get('button')
.contains(/^Submit$/)
.click();
cy.wait(2000);
cy.get('#tag-1 > span').contains('complete');
}
// Consulting Fees Path - Without Files
describe.only('Consulting Fees Path - Without Files', () => {
Cypress._.times(1, () => {
@ -237,6 +254,8 @@ describe.only('Consulting Fees Path - Without Files', () => {
'Task: Reminder: Check Existing Budget',
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -378,6 +397,8 @@ describe.only('Consulting Fees Path - Without Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -539,6 +560,8 @@ describe.only('Consulting Fees Path - Without Files', () => {
'Task: Reminder: Check Existing Budget',
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
});
@ -734,6 +757,8 @@ describe('Consulting Fees Path - With Files', () => {
'Task: Reminder: Check Existing Budget',
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -925,6 +950,8 @@ describe('Consulting Fees Path - With Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -1131,6 +1158,8 @@ describe('Consulting Fees Path - With Files', () => {
'Task: Reminder: Check Existing Budget',
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
});

View File

@ -82,24 +82,41 @@ const submitWithUser = (
.contains(/^Submit$/)
.click();
if (expectAdditionalApprovalInfoPage) {
cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 });
// if (expectAdditionalApprovalInfoPage) {
// cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 });
cy.get('button')
.contains(/^Continue$/)
.click();
}
// cy.get('button')
// .contains(/^Continue$/)
// .click();
// }
cy.visit('/');
cy.location({ timeout: 60000 }).should((loc) => {
expect(loc.pathname).to.eq('/');
});
cy.wait(2000);
cy.get('button').contains('Return to Home', { timeout: 60000 });
cy.logout();
cy.wait(2000);
};
//Check if the process instance is completed successfully
const checkProcessInstanceCompleted = (
username,
password,
processInstanceId
) => {
cy.wait(2000);
cy.log('========Login with : ', username);
cy.log('========processInstanceId: ', processInstanceId);
cy.login(username, password);
cy.wait(1000);
cy.visit('/admin/process-instances/find-by-id');
cy.get('#process-instance-id-input').type(processInstanceId);
cy.get('button')
.contains(/^Submit$/)
.click();
cy.wait(2000);
cy.get('#tag-1 > span').contains('complete');
}
// Equipment Path - Without Files
describe.only('Equipment Path - Without Files', () => {
Cypress._.times(1, () => {
@ -270,6 +287,7 @@ describe.only('Equipment Path - Without Files', () => {
'Task: Reminder: Check Existing Budget',
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -397,6 +415,7 @@ describe.only('Equipment Path - Without Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -550,6 +569,7 @@ describe.only('Equipment Path - Without Files', () => {
'Task: Reminder: Check Existing Budget',
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -663,6 +683,7 @@ describe.only('Equipment Path - Without Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -776,6 +797,7 @@ describe.only('Equipment Path - Without Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -907,6 +929,7 @@ describe.only('Equipment Path - Without Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
// Within Policy. People Ops Partner Group and Budget owner approves the request
@ -1032,6 +1055,7 @@ describe.only('Equipment Path - Without Files', () => {
'Task: Reminder: Check Existing Budget',
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -1158,6 +1182,7 @@ describe.only('Equipment Path - Without Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -1302,6 +1327,7 @@ describe.only('Equipment Path - Without Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
});
@ -1526,6 +1552,7 @@ describe('Equipment Path - With Files', () => {
'Task: Reminder: Check Existing Budget',
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -1702,6 +1729,7 @@ describe('Equipment Path - With Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -1904,6 +1932,7 @@ describe('Equipment Path - With Files', () => {
'Task: Reminder: Check Existing Budget',
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -2067,6 +2096,7 @@ describe('Equipment Path - With Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -2230,6 +2260,7 @@ describe('Equipment Path - With Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -2410,6 +2441,7 @@ describe('Equipment Path - With Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
// Within Policy. People Ops Partner Group and Budget owner approves the request
@ -2584,6 +2616,7 @@ describe('Equipment Path - With Files', () => {
'Task: Reminder: Check Existing Budget',
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -2759,6 +2792,7 @@ describe('Equipment Path - With Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -2962,6 +2996,7 @@ describe('Equipment Path - With Files', () => {
'Task: Reminder: Check Existing Budget',
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
});

View File

@ -76,24 +76,42 @@ const submitWithUser = (
.contains(/^Submit$/)
.click();
if (expectAdditionalApprovalInfoPage) {
cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 });
// if (expectAdditionalApprovalInfoPage) {
// cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 });
cy.get('button')
.contains(/^Continue$/)
.click();
}
// cy.get('button')
// .contains(/^Continue$/)
// .click();
// }
cy.visit('/');
cy.location({ timeout: 60000 }).should((loc) => {
expect(loc.pathname).to.eq('/');
});
cy.wait(2000);
cy.get('button').contains('Return to Home', { timeout: 60000 });
cy.logout();
cy.wait(2000);
};
//Check if the process instance is completed successfully
const checkProcessInstanceCompleted = (
username,
password,
processInstanceId
) => {
cy.wait(2000);
cy.log('========Login with : ', username);
cy.log('========processInstanceId: ', processInstanceId);
cy.login(username, password);
cy.wait(1000);
cy.visit('/admin/process-instances/find-by-id');
cy.get('#process-instance-id-input').type(processInstanceId);
cy.get('button')
.contains(/^Submit$/)
.click();
cy.wait(2000);
cy.get('#tag-1 > span').contains('complete');
}
// Learning and Development Path - Without Files
describe.only('Learning and Development Path - Without Files', () => {
Cypress._.times(1, () => {
@ -205,6 +223,7 @@ describe.only('Learning and Development Path - Without Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -318,6 +337,7 @@ describe.only('Learning and Development Path - Without Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -449,6 +469,7 @@ describe.only('Learning and Development Path - Without Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -604,6 +625,7 @@ describe.only('Learning and Development Path - Without Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -717,6 +739,7 @@ describe.only('Learning and Development Path - Without Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -848,6 +871,7 @@ describe.only('Learning and Development Path - Without Files', () => {
'Task: Reminder: Check Existing Budget',
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
});
@ -1017,6 +1041,7 @@ describe('Learning and Development Path - With Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -1181,6 +1206,7 @@ describe('Learning and Development Path - With Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -1362,6 +1388,7 @@ describe('Learning and Development Path - With Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -1568,6 +1595,7 @@ describe('Learning and Development Path - With Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -1732,6 +1760,7 @@ describe('Learning and Development Path - With Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -1927,6 +1956,7 @@ describe('Learning and Development Path - With Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
});

View File

@ -76,24 +76,41 @@ const submitWithUser = (
.contains(/^Submit$/)
.click();
if (expectAdditionalApprovalInfoPage) {
cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 });
// if (expectAdditionalApprovalInfoPage) {
// cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 });
cy.get('button')
.contains(/^Continue$/)
.click();
}
// cy.get('button')
// .contains(/^Continue$/)
// .click();
// }
cy.visit('/');
cy.location({ timeout: 60000 }).should((loc) => {
expect(loc.pathname).to.eq('/');
});
cy.wait(2000);
cy.get('button').contains('Return to Home', { timeout: 60000 });
cy.logout();
cy.wait(2000);
};
//Check if the process instance is completed successfully
const checkProcessInstanceCompleted = (
username,
password,
processInstanceId
) => {
cy.wait(2000);
cy.log('========Login with : ', username);
cy.log('========processInstanceId: ', processInstanceId);
cy.login(username, password);
cy.wait(1000);
cy.visit('/admin/process-instances/find-by-id');
cy.get('#process-instance-id-input').type(processInstanceId);
cy.get('button')
.contains(/^Submit$/)
.click();
cy.wait(2000);
cy.get('#tag-1 > span').contains('complete');
}
describe.only('Other Fees Path - Without Files', () => {
Cypress._.times(1, () => {
// Budget owner approves the request
@ -219,6 +236,8 @@ describe.only('Other Fees Path - Without Files', () => {
'Task: Reminder: Check Existing Budget',
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -332,6 +351,8 @@ describe.only('Other Fees Path - Without Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -463,6 +484,8 @@ describe.only('Other Fees Path - Without Files', () => {
'Task: Reminder: Check Existing Budget',
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
});
@ -644,6 +667,8 @@ describe('Other Fees Path - With Files', () => {
'Task: Reminder: Check Existing Budget',
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -808,6 +833,8 @@ describe('Other Fees Path - With Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -990,6 +1017,8 @@ describe('Other Fees Path - With Files', () => {
'Task: Reminder: Check Existing Budget',
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
});

View File

@ -76,19 +76,42 @@ const submitWithUser = (
.contains(/^Submit$/)
.click();
// if (expectAdditionalApprovalInfoPage) {
// cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 });
//
// cy.get('button')
// .contains(/^Continue$/)
// .click();
// }
if (expectAdditionalApprovalInfoPage === 'Task: Update Application Landscape') {
cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 });
cy.get('button')
.contains(/^Continue$/)
.click();
}
// cy.getBySel('return-to-home-button', { timeout: 60000 });
cy.get('button').contains('Return to Home', { timeout: 60000 });
cy.logout();
};
//Check if the process instance is completed successfully
const checkProcessInstanceCompleted = (
username,
password,
processInstanceId
) => {
cy.wait(2000);
cy.log('========Login with : ', username);
cy.log('========processInstanceId: ', processInstanceId);
cy.login(username, password);
cy.wait(1000);
cy.visit('/admin/process-instances/find-by-id');
cy.get('#process-instance-id-input').type(processInstanceId);
cy.get('button')
.contains(/^Submit$/)
.click();
cy.wait(2000);
cy.get('#tag-1 > span').contains('complete');
}
// Software and Licenses Path - Without Files
describe.only('Software and Licenses Path - Without Files', () => {
Cypress._.times(1, () => {
@ -226,6 +249,8 @@ describe.only('Software and Licenses Path - Without Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -390,11 +415,13 @@ describe.only('Software and Licenses Path - Without Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
// Budget owner rejects the request
it('Budget owner rejects', () => {
it.only('Budget owner rejects', () => {
const username = Cypress.env('requestor_username');
const password = Cypress.env('requestor_password');
cy.log(`=====username : ${username}`);
@ -498,6 +525,8 @@ describe.only('Software and Licenses Path - Without Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -645,6 +674,8 @@ describe.only('Software and Licenses Path - Without Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -786,6 +817,8 @@ describe.only('Software and Licenses Path - Without Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
});
@ -912,6 +945,8 @@ describe('Software and Licenses Path - Without Files and with only mandatory fi
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -1049,6 +1084,8 @@ describe('Software and Licenses Path - Without Files and with only mandatory fi
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -1145,6 +1182,8 @@ describe('Software and Licenses Path - Without Files and with only mandatory fi
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -1280,6 +1319,8 @@ describe('Software and Licenses Path - Without Files and with only mandatory fi
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -1409,6 +1450,8 @@ describe('Software and Licenses Path - Without Files and with only mandatory fi
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
});
@ -1614,6 +1657,8 @@ describe('Software and Licenses Path - With Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -1817,6 +1862,8 @@ describe('Software and Licenses Path - With Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -1979,6 +2026,8 @@ describe('Software and Licenses Path - With Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -2181,6 +2230,8 @@ describe('Software and Licenses Path - With Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -2378,6 +2429,8 @@ describe('Software and Licenses Path - With Files', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
});
@ -2602,6 +2655,8 @@ describe('Software and Licenses Path - With Files and Multiple items', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -2836,6 +2891,8 @@ describe('Software and Licenses Path - With Files and Multiple items', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -3030,6 +3087,8 @@ describe('Software and Licenses Path - With Files and Multiple items', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -3261,6 +3320,8 @@ describe('Software and Licenses Path - With Files and Multiple items', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -3481,6 +3542,8 @@ describe('Software and Licenses Path - With Files and Multiple items', () => {
null,
'reject'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
});