finish test for pp1
This commit is contained in:
parent
a71754e722
commit
342e6091c5
|
@ -1,24 +1,33 @@
|
||||||
const submitInputIntoFormField = (taskName, fieldKey, fieldValue) => {
|
const approveWithUser = (
|
||||||
cy.contains(`Task: ${taskName}`, { timeout: 10000 });
|
username,
|
||||||
cy.get(fieldKey).clear().type(fieldValue);
|
processInstanceId,
|
||||||
cy.contains('Submit').click();
|
expectAdditionalApprovalInfoPage = false
|
||||||
};
|
) => {
|
||||||
|
cy.login(username, username);
|
||||||
|
cy.visit('/admin/process-instances/find-by-id');
|
||||||
|
cy.get('#process-instance-id-input').type(processInstanceId);
|
||||||
|
cy.get('button')
|
||||||
|
.contains(/^Submit$/)
|
||||||
|
.click();
|
||||||
|
|
||||||
const checkFormFieldIsReadOnly = (formName, fieldKey) => {
|
cy.contains('Tasks I can complete', { timeout: 20000 });
|
||||||
cy.contains(`Task: ${formName}`);
|
cy.get('.cds--btn').contains(/^Go$/).click();
|
||||||
cy.get(fieldKey).invoke('attr', 'disabled').should('exist');
|
|
||||||
};
|
|
||||||
|
|
||||||
const checkTaskHasClass = (taskName, className) => {
|
// approve!
|
||||||
cy.get(`g[data-element-id=${taskName}]`).should('have.class', className);
|
cy.get('#root-app').click();
|
||||||
};
|
cy.get('button')
|
||||||
|
.contains(/^Submit$/)
|
||||||
const kickOffModelWithForm = () => {
|
.click();
|
||||||
cy.navigateToProcessModel(
|
if (expectAdditionalApprovalInfoPage) {
|
||||||
'Acceptance Tests Group One',
|
cy.contains(expectAdditionalApprovalInfoPage, { timeout: 20000 });
|
||||||
'Acceptance Tests Model 2'
|
cy.get('button')
|
||||||
);
|
.contains(/^Continue$/)
|
||||||
cy.runPrimaryBpmnFile(true);
|
.click();
|
||||||
|
}
|
||||||
|
cy.location({ timeout: 20000 }).should((loc) => {
|
||||||
|
expect(loc.pathname).to.eq('/tasks');
|
||||||
|
});
|
||||||
|
cy.logout();
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('tasks', () => {
|
describe('tasks', () => {
|
||||||
|
@ -28,84 +37,68 @@ describe('tasks', () => {
|
||||||
cy.contains('Start New +').click();
|
cy.contains('Start New +').click();
|
||||||
cy.contains('Raise New Demand Request');
|
cy.contains('Raise New Demand Request');
|
||||||
cy.runPrimaryBpmnFile(true);
|
cy.runPrimaryBpmnFile(true);
|
||||||
|
cy.contains('Procurement').click();
|
||||||
|
// cy.contains('Submit').click();
|
||||||
|
cy.get('button')
|
||||||
|
.contains(/^Submit$/)
|
||||||
|
.click();
|
||||||
|
cy.contains(
|
||||||
|
'Submit a new demand request for the procurement of needed items',
|
||||||
|
{ timeout: 20000 }
|
||||||
|
);
|
||||||
|
|
||||||
// const groupDisplayName = 'Acceptance Tests Group One';
|
cy.url().then((currentUrl) => {
|
||||||
// const modelDisplayName = `Acceptance Tests Model 2`;
|
// if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560"
|
||||||
// const completedTaskClassName = 'completed-task-highlight';
|
// extract the digits after /tasks
|
||||||
// const activeTaskClassName = 'active-task-highlight';
|
const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0];
|
||||||
//
|
|
||||||
// cy.navigateToProcessModel(groupDisplayName, modelDisplayName);
|
cy.get('#root_project').select('18564');
|
||||||
//
|
cy.get('#root_category').select('soft_and_lic');
|
||||||
// submitInputIntoFormField(
|
cy.get('#root_purpose').clear().type('need the software for my work');
|
||||||
// 'get_user_generated_number_one',
|
cy.get('#root_criticality').select('High');
|
||||||
// '#root_user_generated_number_1',
|
cy.get('#root_period').clear().type('2023-10-10');
|
||||||
// 2
|
cy.get('#root_vendor').clear().type('sartography');
|
||||||
// );
|
cy.get('#root_payment_method').select('Bank Transfer');
|
||||||
// submitInputIntoFormField(
|
cy.get('#root_project').select('18564');
|
||||||
// 'get_user_generated_number_two',
|
cy.get('#root_category').select('soft_and_lic');
|
||||||
// '#root_user_generated_number_2',
|
cy.get('button')
|
||||||
// 3
|
.contains(/^Submit$/)
|
||||||
// );
|
.click();
|
||||||
//
|
|
||||||
// cy.contains('Task: get_user_generated_number_three');
|
cy.contains('Task: Enter NDR Items', { timeout: 20000 });
|
||||||
// cy.getBySel('form-nav-form2').click();
|
cy.get('#root_0_sub_category').select('op_src');
|
||||||
// checkFormFieldIsReadOnly(
|
cy.get('#root_0_item').clear().type('spiffworkflow');
|
||||||
// 'get_user_generated_number_two',
|
cy.get('#root_0_qty').clear().type('1');
|
||||||
// '#root_user_generated_number_2'
|
cy.get('#root_0_currency_type').select('Fiat');
|
||||||
// );
|
cy.get('#root_0_currency').select('AUD');
|
||||||
// cy.getBySel('form-nav-form1').click();
|
cy.get('#root_0_unit_price').type('100');
|
||||||
// checkFormFieldIsReadOnly(
|
cy.get('button')
|
||||||
// 'get_user_generated_number_one',
|
.contains(/^Submit$/)
|
||||||
// '#root_user_generated_number_1'
|
.click();
|
||||||
// );
|
|
||||||
//
|
cy.contains(
|
||||||
// cy.getBySel('form-nav-form3').click();
|
'Review and provide any supporting information or files for your request.'
|
||||||
// submitInputIntoFormField(
|
);
|
||||||
// 'get_user_generated_number_three',
|
cy.contains('Submit the Request').click();
|
||||||
// '#root_user_generated_number_3',
|
cy.get('input[value="Submit the Request"]').click();
|
||||||
// 4
|
cy.get('button')
|
||||||
// );
|
.contains(/^Submit$/)
|
||||||
//
|
.click();
|
||||||
// cy.contains('Task: get_user_generated_number_four');
|
|
||||||
// cy.navigateToProcessModel(groupDisplayName, modelDisplayName);
|
cy.logout();
|
||||||
// cy.getBySel('process-instance-list-link').click();
|
approveWithUser(
|
||||||
// cy.assertAtLeastOneItemInPaginatedResults();
|
'infra.project-lead',
|
||||||
//
|
processInstanceId,
|
||||||
// // This should get the first one which should be the one we just completed
|
'Task: Reminder: Request Additional Budget'
|
||||||
// cy.getBySel('process-instance-show-link').first().click();
|
);
|
||||||
// cy.contains('Process Instance Id: ');
|
approveWithUser('ppg.ba.sme', processInstanceId);
|
||||||
//
|
approveWithUser('security.sme', processInstanceId);
|
||||||
// cy.get(`g[data-element-id=form3]`).click();
|
approveWithUser(
|
||||||
// cy.contains('"user_generated_number_1": 2');
|
'infra.sme',
|
||||||
// cy.contains('"user_generated_number_2": 3');
|
processInstanceId,
|
||||||
// cy.contains('"user_generated_number_3": 4');
|
'Task: Update Application Landscape'
|
||||||
// cy.contains('"user_generated_number_4": 5').should('not.exist');
|
);
|
||||||
// checkTaskHasClass('form1', completedTaskClassName);
|
approveWithUser('legal.sme', processInstanceId);
|
||||||
// checkTaskHasClass('form2', completedTaskClassName);
|
});
|
||||||
// checkTaskHasClass('form3', completedTaskClassName);
|
|
||||||
// checkTaskHasClass('form4', activeTaskClassName);
|
|
||||||
// cy.get('.is-visible .cds--modal-close').click();
|
|
||||||
//
|
|
||||||
// cy.navigateToHome();
|
|
||||||
// cy.contains('Tasks').should('exist');
|
|
||||||
//
|
|
||||||
// // FIXME: this will probably need a better way to link to the proper form that we want
|
|
||||||
// cy.contains('Go').click();
|
|
||||||
//
|
|
||||||
// submitInputIntoFormField(
|
|
||||||
// 'get_user_generated_number_four',
|
|
||||||
// '#root_user_generated_number_4',
|
|
||||||
// 5
|
|
||||||
// );
|
|
||||||
// cy.url().should('include', '/tasks');
|
|
||||||
//
|
|
||||||
// cy.navigateToProcessModel(groupDisplayName, modelDisplayName);
|
|
||||||
// cy.getBySel('process-instance-list-link').click();
|
|
||||||
// cy.assertAtLeastOneItemInPaginatedResults();
|
|
||||||
//
|
|
||||||
// // This should get the first one which should be the one we just completed
|
|
||||||
// cy.getBySel('process-instance-show-link').first().click();
|
|
||||||
// cy.contains('Process Instance Id: ');
|
|
||||||
// cy.contains('Status: complete');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -102,8 +102,12 @@ Cypress.Commands.add('createModel', (groupId, modelId, modelDisplayName) => {
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
'runPrimaryBpmnFile',
|
'runPrimaryBpmnFile',
|
||||||
(expectAutoRedirectToHumanTask = false) => {
|
(expectAutoRedirectToHumanTask = false) => {
|
||||||
cy.getBySel('start-process-instance').click();
|
// cy.getBySel('start-process-instance').click();
|
||||||
// cy.contains('Start').click();
|
// click on button with text Start
|
||||||
|
|
||||||
|
cy.get('button')
|
||||||
|
.contains(/^Start$/)
|
||||||
|
.click();
|
||||||
if (expectAutoRedirectToHumanTask) {
|
if (expectAutoRedirectToHumanTask) {
|
||||||
// the url changes immediately, so also make sure we get some content from the next page, "Task:", or else when we try to interact with the page, it'll re-render and we'll get an error with cypress.
|
// the url changes immediately, so also make sure we get some content from the next page, "Task:", or else when we try to interact with the page, it'll re-render and we'll get an error with cypress.
|
||||||
cy.url().should('include', `/tasks/`);
|
cy.url().should('include', `/tasks/`);
|
||||||
|
|
Loading…
Reference in New Issue