diff --git a/spiffworkflow-frontend/cypress/e2e/NDR_PP1/consultingfees.cy.js b/spiffworkflow-frontend/cypress/e2e/NDR_PP1/consultingfees.cy.js new file mode 100644 index 00000000..df431918 --- /dev/null +++ b/spiffworkflow-frontend/cypress/e2e/NDR_PP1/consultingfees.cy.js @@ -0,0 +1,856 @@ +const submitWithUser = ( + username, + password, + processInstanceId, + expectAdditionalApprovalInfoPage = false, + approvaltype +) => { + cy.wait(2000); + cy.log('========Login with : ', username); + cy.log('========processInstanceId: ', processInstanceId); + cy.login(username, password); + + cy.wait(1000); + cy.log('=======visit find by id : '); + cy.visit('/admin/process-instances/find-by-id'); + cy.get('#process-instance-id-input').type(processInstanceId); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks I can complete', { timeout: 60000 }); + + cy.get('.cds--btn').contains(/^Go$/).click(); + + cy.wait(2000); + // approve! + if (approvaltype === "approve") { + cy.get('#root > label:nth-child(1)').click(); + cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' is approving this.')); + } else if (approvaltype === "reject") { + cy.get('#root > label:nth-child(3)').click(); + cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' is rejecting this.')); + } else if (approvaltype === "needmoreinfo") { + cy.get('#root > label:nth-child(2)').click(); + cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' needs additional info. A software license is a document that provides legally binding guidelines for the use and distribution of software.Software licenses typically provide end users with the right to END.')); + } else if (approvaltype === "providemoreinfo") { + //Form 1 + cy.contains('Task: Submit New Demand Request Details', { timeout: 60000 }); + cy.get('button') + .contains(/^Submit$/) + .click(); + //Form 2 + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('button') + .contains(/^Submit$/) + .click(); + //Form 3 + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 }); + + cy.get('.cds--text-area__wrapper').find('#root').clear().type('Providing additional info. It\’s free and easy to post a job. Simply fill in a title, description and budget and competitive bids come within minutes. No job is too big or too small. We\'ve got people for jobs of any size.'); + + cy.contains('Submit the Request').click(); + cy.get('input[value="Submit the Request"]').click(); + + } else { + + } + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + if (expectAdditionalApprovalInfoPage) { + cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 }); + + cy.get('button') + .contains(/^Continue$/) + .click(); + + } + cy.location({ timeout: 60000 }).should((loc) => { + expect(loc.pathname).to.eq('/tasks'); + }); + cy.wait(2000); + cy.logout(); + cy.wait(2000); +}; + +//Consulting Fees Path - Without Files +describe('Consulting Fees Path - Without Files', () => { + Cypress._.times(5, () => { + //Budget owner approves the request + it('Budget owner approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('consult_fees'); + cy.get('#root_purpose').clear().type('Consulting ==== Management consulting includes a broad range of activities, and the many firms and their members often define these practices quite differently. One way to categorize the activities is in terms of the professional’s area of expertise.'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-12-25'); + cy.get('#root_vendor').clear().type('Embassar'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + //item 0 + cy.get('#root_0_sub_category').select('ambassadors'); + cy.get('#root_0_item').clear().type('An ambassador is an official envoy, especially a high-ranking diplomat who represents a state.'); + cy.get('#root_0_qty').clear().type('4'); + cy.get('#root_0_currency_type').select('Crypto'); + cy.get('#root_0_currency').select('ETH'); + cy.get('#root_0_unit_price').type('1.15'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('consultants'); + cy.get('#root_1_item').clear().type('A consultant (from Latin: consultare "to deliberate") is a professional'); + cy.get('#root_1_qty').clear().type('1'); + cy.get('#root_1_currency_type').select('Fiat'); + cy.get('#root_1_currency').select('CAD'); + cy.get('#root_1_unit_price').type('1355'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 2 + cy.get('#root_2_sub_category').select('freelancers'); + cy.get('#root_2_item').clear().type('Find & hire top freelancers, web developers & designers inexpensively. '); + cy.get('#root_2_qty').clear().type('6'); + cy.get('#root_2_currency_type').select('Crypto'); + cy.get('#root_2_currency').select('SNT'); + cy.get('#root_2_unit_price').type('2300'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('For professionals working in the professional services, \‘consultant\’ and advisor\’ are often used and fall under common terminology. Consultancy.uk zooms in on this field to get a closer look. \n https://www.consultancy.uk/career/what-is-consulting'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + }); + }); + + //Budget owner rejects the request + it('Budget owner rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('consult_fees'); + cy.get('#root_purpose').clear().type('Consulting is defined as the practise of providing a third party with expertise on a matter in exchange for a fee. The service may involve either advisory or implementation services.'); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('2024-10-02'); + cy.get('#root_vendor').clear().type('Consultancy.uk'); + cy.get('#root_payment_method').select('Crypto Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + + //Item 0 + cy.get('#root_0_sub_category').select('consultants'); + cy.get('#root_0_item').clear().type('Software development consultants with Python background'); + cy.get('#root_0_qty').clear().type('5'); + cy.get('#root_0_currency_type').select('Crypto'); + cy.get('#root_0_currency').select('DAI'); + cy.get('#root_0_unit_price').type('1500'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('consultants'); + cy.get('#root_1_item').clear().type('A consultant (from Latin: consultare "to deliberate") is a professional'); + cy.get('#root_1_qty').clear().type('1'); + cy.get('#root_1_currency_type').select('Fiat'); + cy.get('#root_1_currency').select('CAD'); + cy.get('#root_1_unit_price').type('1355'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 2 + cy.get('#root_2_sub_category').select('freelancers'); + cy.get('#root_2_item').clear().type('Find & hire top freelancers, web developers & designers inexpensively. '); + cy.get('#root_2_qty').clear().type('6'); + cy.get('#root_2_currency_type').select('Crypto'); + cy.get('#root_2_currency').select('SNT'); + cy.get('#root_2_unit_price').type('2300'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('For professionals working in the professional services, ‘consultant’ and advisor’ are often used and fall under common terminology. Consultancy.uk zooms in on this field to get a closer look. \n https://www.consultancy.uk/career/what-is-consulting'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + //Budget owner request for additional details + it('Budget owner need more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('consult_fees'); + cy.get('#root_purpose').clear().type('Freelancing - Freelancing is doing specific work for clients without committing to full-time employment. Freelancers often take on multiple projects with different clients simultaneously. IRS considers freelancers to be self-employed individuals.'); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('2025-04-15'); + cy.get('#root_vendor').clear().type('Upwork'); + cy.get('#root_payment_method').select('Debit Card'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + + //item 0 + cy.get('#root_0_sub_category').select('freelancers'); + cy.get('#root_0_item').clear().type('Freelancers to do the Python development and front end react app development'); + cy.get('#root_0_qty').clear().type('4'); + cy.get('#root_0_currency_type').select('Crypto'); + cy.get('#root_0_currency').select('SNT'); + cy.get('#root_0_unit_price').type('1750'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('consultants'); + cy.get('#root_1_item').clear().type('A consultant (from Latin: consultare "to deliberate") is a professional'); + cy.get('#root_1_qty').clear().type('1'); + cy.get('#root_1_currency_type').select('Fiat'); + cy.get('#root_1_currency').select('CAD'); + cy.get('#root_1_unit_price').type('1355'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 2 + cy.get('#root_2_sub_category').select('freelancers'); + cy.get('#root_2_item').clear().type('Find & hire top freelancers, web developers & designers inexpensively. '); + cy.get('#root_2_qty').clear().type('6'); + cy.get('#root_2_currency_type').select('Crypto'); + cy.get('#root_2_currency').select('SNT'); + cy.get('#root_2_unit_price').type('2300'); + + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('It\’s free and easy to post a job. Simply fill in a title, description and budget and competitive bids come within minutes. No job is too big or too small. We\'ve got freelancers for jobs of any size or budget across 1800 skills. No job is too complex.'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + //budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + }); + }); + + }); +}); + +//Consulting Fees Path - With Files +describe('Consulting Fees Path - With Files', () => { + Cypress._.times(1, () => { + //Budget owner approves the request + it('Budget owner approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('consult_fees'); + cy.get('#root_purpose').clear().type('Consulting ==== Management consulting includes a broad range of activities, and the many firms and their members often define these practices quite differently. One way to categorize the activities is in terms of the professional’s area of expertise.'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-12-25'); + cy.get('#root_vendor').clear().type('Embassar'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + + //item 0 + cy.get('#root_0_sub_category').select('ambassadors'); + cy.get('#root_0_item').clear().type('An ambassador is an official envoy, especially a high-ranking diplomat who represents a state.'); + cy.get('#root_0_qty').clear().type('4'); + cy.get('#root_0_currency_type').select('Crypto'); + cy.get('#root_0_currency').select('ETH'); + cy.get('#root_0_unit_price').type('1.15'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('consultants'); + cy.get('#root_1_item').clear().type('A consultant (from Latin: consultare "to deliberate") is a professional'); + cy.get('#root_1_qty').clear().type('1'); + cy.get('#root_1_currency_type').select('Fiat'); + cy.get('#root_1_currency').select('CAD'); + cy.get('#root_1_unit_price').type('1355'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 2 + cy.get('#root_2_sub_category').select('freelancers'); + cy.get('#root_2_item').clear().type('Find & hire top freelancers, web developers & designers inexpensively. '); + cy.get('#root_2_qty').clear().type('6'); + cy.get('#root_2_currency_type').select('Crypto'); + cy.get('#root_2_currency').select('SNT'); + cy.get('#root_2_unit_price').type('2300'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('For professionals working in the professional services, ‘consultant’ and advisor’ are often used and fall under common terminology. Consultancy.uk zooms in on this field to get a closer look. \n https://www.consultancy.uk/career/what-is-consulting'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + }); + }); + + //Budget owner rejects the request + it('Budget owner rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('consult_fees'); + cy.get('#root_purpose').clear().type('Consulting is defined as the practise of providing a third party with expertise on a matter in exchange for a fee. The service may involve either advisory or implementation services.'); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('2024-10-02'); + cy.get('#root_vendor').clear().type('Consultancy.uk'); + cy.get('#root_payment_method').select('Crypto Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + + //item 0 + cy.get('#root_0_sub_category').select('consultants'); + cy.get('#root_0_item').clear().type('Software development consultants with Python background'); + cy.get('#root_0_qty').clear().type('5'); + cy.get('#root_0_currency_type').select('Crypto'); + cy.get('#root_0_currency').select('DAI'); + cy.get('#root_0_unit_price').type('1500'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('consultants'); + cy.get('#root_1_item').clear().type('A consultant (from Latin: consultare "to deliberate") is a professional'); + cy.get('#root_1_qty').clear().type('1'); + cy.get('#root_1_currency_type').select('Fiat'); + cy.get('#root_1_currency').select('CAD'); + cy.get('#root_1_unit_price').type('1355'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 2 + cy.get('#root_2_sub_category').select('freelancers'); + cy.get('#root_2_item').clear().type('Find & hire top freelancers, web developers & designers inexpensively. '); + cy.get('#root_2_qty').clear().type('6'); + cy.get('#root_2_currency_type').select('Crypto'); + cy.get('#root_2_currency').select('SNT'); + cy.get('#root_2_unit_price').type('2300'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('For professionals working in the professional services, ‘consultant’ and advisor’ are often used and fall under common terminology. Consultancy.uk zooms in on this field to get a closer look. \n https://www.consultancy.uk/career/what-is-consulting'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + //Budget owner request for additional details + it('Budget owner need more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('consult_fees'); + cy.get('#root_purpose').clear().type('Freelancing - Freelancing is doing specific work for clients without committing to full-time employment. Freelancers often take on multiple projects with different clients simultaneously. IRS considers freelancers to be self-employed individuals.'); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('2025-04-15'); + cy.get('#root_vendor').clear().type('Upwork'); + cy.get('#root_payment_method').select('Debit Card'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + //item 0 + cy.get('#root_0_sub_category').select('freelancers'); + cy.get('#root_0_item').clear().type('Freelancers to do the Python development and front end react app development'); + cy.get('#root_0_qty').clear().type('4'); + cy.get('#root_0_currency_type').select('Crypto'); + cy.get('#root_0_currency').select('SNT'); + cy.get('#root_0_unit_price').type('1750'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('consultants'); + cy.get('#root_1_item').clear().type('A consultant (from Latin: consultare "to deliberate") is a professional'); + cy.get('#root_1_qty').clear().type('1'); + cy.get('#root_1_currency_type').select('Fiat'); + cy.get('#root_1_currency').select('CAD'); + cy.get('#root_1_unit_price').type('1355'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 2 + cy.get('#root_2_sub_category').select('freelancers'); + cy.get('#root_2_item').clear().type('Find & hire top freelancers, web developers & designers inexpensively. '); + cy.get('#root_2_qty').clear().type('6'); + cy.get('#root_2_currency_type').select('Crypto'); + cy.get('#root_2_currency').select('SNT'); + cy.get('#root_2_unit_price').type('2300'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('It\’s free and easy to post a job. Simply fill in a title, description and budget and competitive bids come within minutes. No job is too big or too small. We\'ve got freelancers for jobs of any size or budget across 1800 skills. No job is too complex.'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + //budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + + }); + }); + + }); +}); + + diff --git a/spiffworkflow-frontend/cypress/e2e/NDR_PP1/equipment.cy.js b/spiffworkflow-frontend/cypress/e2e/NDR_PP1/equipment.cy.js new file mode 100644 index 00000000..4e521696 --- /dev/null +++ b/spiffworkflow-frontend/cypress/e2e/NDR_PP1/equipment.cy.js @@ -0,0 +1,2234 @@ +const submitWithUser = ( + username, + password, + processInstanceId, + expectAdditionalApprovalInfoPage = false, + approvaltype +) => { + cy.wait(2000); + cy.log('========Login with : ', username); + cy.log('========processInstanceId: ', processInstanceId); + cy.login(username, password); + + cy.wait(1000); + cy.log('=======visit find by id : '); + cy.visit('/admin/process-instances/find-by-id'); + cy.get('#process-instance-id-input').type(processInstanceId); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks I can complete', { timeout: 60000 }); + + cy.get('.cds--btn').contains(/^Go$/).click(); + + cy.wait(2000); + // approve! + if (approvaltype === "approve") { + cy.get('#root > label:nth-child(1)').click(); + cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' is approving this.')); + } else if (approvaltype === "reject") { + cy.get('#root > label:nth-child(3)').click(); + cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' is rejecting this.')); + } else if (approvaltype === "needmoreinfo") { + cy.get('#root > label:nth-child(2)').click(); + cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' needs additional info. By contrast, software is the set of instructions that can be stored and run by hardware. Hardware is so-termed because it is "hard" or rigid with respect to changes, whereas software is "soft" END.')); + } else if (approvaltype === "escalateBO") { + cy.get('#root > label:nth-child(1)').click(); + cy.get('.field-boolean > label:nth-child(1)').click(); + cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' is escalating to Budget owner.')); + } else if (approvaltype === "providemoreinfo") { + //Form 1 + cy.contains('Task: Submit New Demand Request Details', { timeout: 60000 }); + cy.get('button') + .contains(/^Submit$/) + .click(); + //Form 2 + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('button') + .contains(/^Submit$/) + .click(); + //Form 3 + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 }); + + cy.get('.cds--text-area__wrapper').find('#root').clear().type('Providing additional info. Computer hardware includes the physical parts of a computer, such as the case, central processing unit (CPU), random access memory (RAM), monitor, mouse, keyboard, computer data storage, graphics card, sound card'); + + cy.contains('Submit the Request').click(); + cy.get('input[value="Submit the Request"]').click(); + + } else { + + } + + cy.get('button') + .contains(/^Submit$/) + .click(); + + if (expectAdditionalApprovalInfoPage) { + cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 }); + + cy.get('button') + .contains(/^Continue$/) + .click(); + + } + cy.location({ timeout: 60000 }).should((loc) => { + expect(loc.pathname).to.eq('/tasks'); + }); + cy.wait(2000); + cy.logout(); + cy.wait(2000); +}; + +//Equipment Path - Without Files +describe('Equipment Path - Without Files', () => { + + Cypress._.times(1, () => { + //Out of Policy. People Ops Partner Group and Budget owner approves the request + it('Out of Policy. People Ops Partner Group and Budget owner approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('By contrast, software is the set of instructions that can be stored and run by hardware. Hardware is so-termed because it is "hard" or rigid with respect to changes, whereas software is "soft" because it is easy to change..'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Mech Tech'); + cy.get('#root_payment_method').select('Reimbursement'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + //item 0 + cy.get('#root_0_sub_category').select('laptops'); + cy.get('#root_0_item').clear().type('Hardware is typically directed by the software to execute any command or instruction'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('AUD'); + cy.get('#root_0_unit_price').type('5000'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('ledger'); + cy.get('#root_1_item').clear().type('A mainframe computer is a much larger computer that typically fills a room and may cost many hundred'); + cy.get('#root_1_qty').clear().type('1'); + cy.get('#root_1_currency_type').select('Fiat'); + cy.get('#root_1_currency').select('CAD'); + cy.get('#root_1_unit_price').type('1355'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 2 + cy.get('#root_2_sub_category').select('yubikey'); + cy.get('#root_2_item').clear().type('A supercomputer is superficially similar to a mainframe but is instead intended for extremely demand'); + cy.get('#root_2_qty').clear().type('6'); + cy.get('#root_2_currency_type').select('Crypto'); + cy.get('#root_2_currency').select('ETH'); + cy.get('#root_2_unit_price').type('2.34'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 3 + cy.get('#root_3_sub_category').select('mic_and_head'); + cy.get('#root_3_item').clear().type('The term supercomputer does not refer to a specific technology.'); + cy.get('#root_3_qty').clear().type('6'); + cy.get('#root_3_currency_type').select('Crypto'); + cy.get('#root_3_currency').select('SNT'); + cy.get('#root_3_unit_price').type('2300'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('The template for all modern computers is the Von Neumann architecture, detailed in a 1945 paper by Hungarian mathematician John von Neumann. This describes a design architecture for a electronic digital computer with subdivisions of a processing unit'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + + }); + }); + + //Out of Policy. People Ops Partner Group approves and Budget owner rejects the request + it('Out of Policy. People Ops Partner Group approves and Budget owner rejects ', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('Electronic appliances and services related to the personal computer, including the PC (desktop or laptop), and communication between computers and the services required by intercommunication networks. These fundamentally include'); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('2024-02-06'); + cy.get('#root_vendor').clear().type('BestBUY'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + //item 0 + cy.get('#root_0_sub_category').select('yubikey'); + cy.get('#root_0_item').clear().type('Output devices are designed around the senses of human beings. For example, monitors display text'); + cy.get('#root_0_qty').clear().type('5'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('EUR'); + cy.get('#root_0_unit_price').type('3200'); + + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('When using computer hardware, an upgrade means adding new or additional hardware to a computer that improves its performance, increases its capacity, or adds new features. For example, \nhttps://en.wikipedia.org/wiki/Computer_hardware'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "reject" + ); + + + }); + }); + + //Out of Policy. People Ops Partner Group approves and Budget owner request for additional details + it('Out of Policy. People Ops Partner Group approves and Budget owner needs more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('Computer hardware includes the physical parts of a computer, such as the case, central processing unit (CPU), random access memory (RAM), monitor, mouse, keyboard, computer data storage, graphics card, sound card, speakers and motherboard.[1][2]'); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('2025-02-25'); + cy.get('#root_vendor').clear().type('Amazon.com'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('laptops'); + cy.get('#root_0_item').clear().type('Rather it indicates the fastest computations available at any given time. In mid-2011, the fastest'); + cy.get('#root_0_qty').clear().type('4'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('USD'); + cy.get('#root_0_unit_price').type('4000'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('A supercomputer is superficially similar to a mainframe but is instead intended for extremely demanding computational tasks. As of November 2021, the fastest supercomputer on the TOP500 supercomputer list is Fugaku, in Japan'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + // people ops approves second time + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + //budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + + }); + }); + + //Within Policy. People Ops Partner Group approves the request + it('Within Policy. People Ops Partner Group approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('By contrast, software is the set of instructions that can be stored and run by hardware. Hardware is so-termed because it is "hard" or rigid with respect to changes, whereas software is "soft" because it is easy to change.'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('EBAY'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('laptops'); + cy.get('#root_0_item').clear().type('Because computer parts contain hazardous materials, there is a growing movement to recycle '); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('HKD'); + cy.get('#root_0_unit_price').type('1236'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('Computer hardware contain dangerous chemicals such as lead, mercury, nickel, and cadmium. According to the EPA these e-wastes have a harmful effect on the environment unless they are disposed properly. \nhttps://en.wikipedia.org/wiki/Computer_hardware'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + }); + }); + + //Within Policy. People Ops Partner Group rejects the request + it('Within Policy. People Ops Partner Group rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('The template for all modern computers is the Von Neumann architecture, detailed in a 1945 paper by Hungarian mathematician John von Neumann. This describes a design architecture for a electronic digital computer with subdivisions of a processing unit'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Best Buy'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('laptops'); + cy.get('#root_0_item').clear().type('Computer components contain many toxic substances, like dioxins, polychlorinated biphenyls (PCBs)'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('AED'); + cy.get('#root_0_unit_price').type('320'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('For professionals working in the professional services, \‘consultant\’ and advisor\’ are often used and fall under common terminology. Consultancy.uk zooms in on this field to get a closer look. \n https://www.consultancy.uk/career/what-is-consulting'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + //Within Policy. People Ops Partner Group request additional info + it('Within Policy. People Ops Partner Group needs more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('The personal computer is one of the most common types of computer due to its versatility and relatively low price. Desktop personal computers have a monitor, a keyboard, a mouse, and a computer case. The computer case holds the motherboard'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Walmart'); + cy.get('#root_payment_method').select('Crypto Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('laptops'); + cy.get('#root_0_item').clear().type('As computer hardware contain a wide number of metals inside, the United States Environmental'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('CAD'); + cy.get('#root_0_unit_price').type('435'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('The template for all modern computers is the Von Neumann architecture, detailed in a 1945 paper by Hungarian mathematician John von Neumann. \nhttps://en.wikipedia.org/wiki/Computer_hardware'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + //peopleops approves second time + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + + }); + }); + //Within Policy. People Ops Partner Group and Budget owner approves the request + it('Within Policy. People Ops Partner Group and Budget owner approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('Laptops are designed for portability but operate similarly to desktop PCs.[5] They may use lower-power or reduced size components, with lower performance than a similarly priced desktop computer'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Fry\'s'); + cy.get('#root_payment_method').select('Crypto Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('laptops'); + cy.get('#root_0_item').clear().type('Recycling a computer is made easier by a few of the national services, such as Dell and Apple.'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('USD'); + cy.get('#root_0_unit_price').type('1200'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('The template for all modern computers is the Von Neumann architecture, detailed in a 1945 paper by Hungarian mathematician John von Neumann. \nhttps://en.wikipedia.org/wiki/Computer_hardware'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "escalateBO" + ); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + + }); + }); + + //Within Policy. People Ops Partner Group approves and Budget owner rejects the request + it('Within Policy. People Ops Partner Group approves and Budget owner rejects ', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('The computer case encloses most of the components of the system. It provides mechanical support and protection for internal elements such as the motherboard, disk drives, and power supplies, and controls and directs the flow of cooling air over int. '); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('2024-02-06'); + cy.get('#root_vendor').clear().type('BestBUY'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('laptops'); + cy.get('#root_0_item').clear().type('Because computer parts contain hazardous materials, there is a growing movement to recycle old'); + cy.get('#root_0_qty').clear().type('5'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('EUR'); + cy.get('#root_0_unit_price').type('300'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('The personal computer is one of the most common types of computer due to its versatility and relatively low price. Desktop personal computers have a monitor, a keyboard, a mouse, and a computer case.\nhttps://en.wikipedia.org/wiki/Computer_hardware'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "escalateBO" + ); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "reject" + ); + + + }); + }); + + //Within Policy. People Ops Partner Group approves and Budget owner request for additional details + it('Within Policy. People Ops Partner Group approves and Budget owner needs more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('The motherboard is the main component of a computer. It is a board with integrated circuitry that connects the other parts of the computer including the CPU, the RAM, the disk drives (CD, DVD, hard disk, or any others) as well as any peripherals'); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('2025-02-25'); + cy.get('#root_vendor').clear().type('Amazon.com'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('laptops'); + cy.get('#root_0_item').clear().type('Recycling a computer is made easier by a few of the national services, such as Dell and Apple.'); + cy.get('#root_0_qty').clear().type('4'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('USD'); + cy.get('#root_0_unit_price').type('400'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('The personal computer is one of the most common types of computer due to its versatility and relatively low price. Desktop personal computers have a monitor, a keyboard, a mouse, and a computer case.\nhttps://en.wikipedia.org/wiki/Computer_hardware'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "escalateBO" + ); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + //people ops approves second time + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + + }); + }); + + }); +}); + +//Equipment Path - With Files +describe('Equipment Path - With Files', () => { + + Cypress._.times(1, () => { + //Out of Policy. People Ops Partner Group and Budget owner approves the request + it('Out of Policy. People Ops Partner Group and Budget owner approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('Equipment most commonly refers to a set of tools or other objects commonly used to achieve a particular objective. Different jobs require different kinds of equipment.\nhttps://en.wikipedia.org/wiki/Equipment'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Mech Tech'); + cy.get('#root_payment_method').select('Debit Card'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + //item 0 + cy.get('#root_0_sub_category').select('laptops'); + cy.get('#root_0_item').clear().type('When using computer hardware, an upgrade means adding new or additional hardware to a computer that'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('AUD'); + cy.get('#root_0_unit_price').type('12300'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('ledger'); + cy.get('#root_1_item').clear().type('A mainframe computer is a much larger computer that typically fills a room and may cost many hundred'); + cy.get('#root_1_qty').clear().type('1'); + cy.get('#root_1_currency_type').select('Fiat'); + cy.get('#root_1_currency').select('CAD'); + cy.get('#root_1_unit_price').type('1355'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 2 + cy.get('#root_2_sub_category').select('yubikey'); + cy.get('#root_2_item').clear().type('A supercomputer is superficially similar to a mainframe but is instead intended for extremely demand'); + cy.get('#root_2_qty').clear().type('6'); + cy.get('#root_2_currency_type').select('Crypto'); + cy.get('#root_2_currency').select('ETH'); + cy.get('#root_2_unit_price').type('2.10'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 3 + cy.get('#root_3_sub_category').select('mic_and_head'); + cy.get('#root_3_item').clear().type('The term supercomputer does not refer to a specific technology.'); + cy.get('#root_3_qty').clear().type('6'); + cy.get('#root_3_currency_type').select('Crypto'); + cy.get('#root_3_currency').select('SNT'); + cy.get('#root_3_unit_price').type('2300'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('The personal computer is one of the most common types of computer due to its versatility and relatively low price. Desktop personal computers have a monitor, a keyboard, a mouse, and a computer case.\nhttps://en.wikipedia.org/wiki/Computer_hardware'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + + }); + }); + + //Out of Policy. People Ops Partner Group approves and Budget owner rejects the request + it('Out of Policy. People Ops Partner Group approves and Budget owner rejects ', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('The motherboard is the main component of a computer. It is a board with integrated circuitry that connects the other parts of the computer including the CPU, the RAM, the disk drives (CD, DVD, hard disk, or any others) as well as any peripherals'); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('2024-02-06'); + cy.get('#root_vendor').clear().type('BestBUY'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('laptops'); + cy.get('#root_0_item').clear().type('Because computer parts contain hazardous materials, there is a growing movement to recycle old'); + cy.get('#root_0_qty').clear().type('5'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('EUR'); + cy.get('#root_0_unit_price').type('3000'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('The personal computer is one of the most common types of computer due to its versatility and relatively low price. Desktop personal computers have a monitor, a keyboard, a mouse, and a computer case.\nhttps://en.wikipedia.org/wiki/Computer_hardware'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "reject" + ); + + + }); + }); + + //Out of Policy. People Ops Partner Group approves and Budget owner request for additional details + it('Out of Policy. People Ops Partner Group approves and Budget owner needs more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('The CPU (central processing unit), which performs most of the calculations which enable a computer to function, and is referred to as the brain of the computer.\nhttps://en.wikipedia.org/wiki/Computer_hardware'); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('2025-02-25'); + cy.get('#root_vendor').clear().type('Amazon.com'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('laptops'); + cy.get('#root_0_item').clear().type('Because computer parts contain hazardous materials, there is a growing movement to recycle old'); + cy.get('#root_0_qty').clear().type('4'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('USD'); + cy.get('#root_0_unit_price').type('4000'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('The personal computer is one of the most common types of computer due to its versatility and relatively low price. Desktop personal computers have a monitor, a keyboard, a mouse, and a computer case.\nhttps://en.wikipedia.org/wiki/Computer_hardware'); + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + //people ops approves second time + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + //budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + + }); + }); + + //Within Policy. People Ops Partner Group approves the request + it('Within Policy. People Ops Partner Group approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('An expansion card in computing is a printed circuit board that can be inserted into an expansion slot of a computer motherboard or backplane to add functionality to a computer system via the expansion bus. Expansion cards can be used to obtain'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Amazon'); + cy.get('#root_payment_method').select('Debit Card'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('laptops'); + cy.get('#root_0_item').clear().type('Recycling a computer is made easier by a few of the national services, such as Dell and Apple.'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('CHF'); + cy.get('#root_0_unit_price').type('240'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('The personal computer is one of the most common types of computer due to its versatility and relatively low price. Desktop personal computers have a monitor, a keyboard, a mouse, and a computer case.\nhttps://en.wikipedia.org/wiki/Computer_hardware'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + }); + }); + + //Within Policy. People Ops Partner Group rejects the request + it('Within Policy. People Ops Partner Group rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('Storage device is any computing hardware and digital media that is used for storing, porting and extracting data files and objects. It can hold and store information both temporarily and permanently and can be internal or external to a computer.'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Best Buy'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('ledger'); + cy.get('#root_0_item').clear().type('The central processing unit contains many toxic materials. It contains lead and chromium in metal'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('CNY'); + cy.get('#root_0_unit_price').type('1560'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('The template for all modern computers is the Von Neumann architecture, detailed in a 1945 paper by Hungarian mathematician John von Neumann..\nhttps://en.wikipedia.org/wiki/Computer_hardware'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + //Within Policy. People Ops Partner Group request additional info + it('Within Policy. People Ops Partner Group needs more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('Data is stored by a computer using a variety of media. Hard disk drives (HDDs) are found in virtually all older computers, due to their high capacity and low cost, but solid-state drives (SSDs) are faster and more power efficient.'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Fry\'s'); + cy.get('#root_payment_method').select('Debit Card'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('yubikey'); + cy.get('#root_0_item').clear().type('Data is stored by a computer using a variety of media. Hard disk drives (HDDs) are found'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('COP'); + cy.get('#root_0_unit_price').type('1230'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('The template for all modern computers is the Von Neumann architecture, detailed in a 1945 paper by Hungarian mathematician John von Neumann..\nhttps://en.wikipedia.org/wiki/Computer_hardware'); + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + //people ops approves second time + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + + }); + }); + //Within Policy. People Ops Partner Group and Budget owner approves the request + it('Within Policy. People Ops Partner Group and Budget owner approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('To transfer data between computers, an external flash memory device (such as a memory card or USB flash drive) or optical disc (such as a CD-ROM, DVD-ROM or BD-ROM) may be used. '); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Amazon.com'); + cy.get('#root_payment_method').select('Reimbursement'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('mic_and_head'); + cy.get('#root_0_item').clear().type('Data is stored by a computer using a variety of media. Hard disk drives (HDDs) are found'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('ETB'); + cy.get('#root_0_unit_price').type('3200'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('The template for all modern computers is the Von Neumann architecture, detailed in a 1945 paper by Hungarian mathematician John von Neumann..\nhttps://en.wikipedia.org/wiki/Computer_hardware'); + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "escalateBO" + ); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + + }); + }); + + //Within Policy. People Ops Partner Group approves and Budget owner rejects the request + it('Within Policy. People Ops Partner Group approves and Budget owner rejects ', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('Input and output devices are typically housed externally to the main computer chassis. The following are either standard or very common to many computer systems.'); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('2024-02-06'); + cy.get('#root_vendor').clear().type('BestBUY'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('mic_and_head'); + cy.get('#root_0_item').clear().type('The central processing unit contains many toxic materials. It contains lead and chromium in metal'); + cy.get('#root_0_qty').clear().type('5'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('EUR'); + cy.get('#root_0_unit_price').type('1'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('The template for all modern computers is the Von Neumann architecture, detailed in a 1945 paper by Hungarian mathematician John von Neumann..\nhttps://en.wikipedia.org/wiki/Computer_hardware'); + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "escalateBO" + ); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "reject" + ); + + + }); + }); + + //Within Policy. People Ops Partner Group approves and Budget owner request for additional details + it('Within Policy. People Ops Partner Group approves and Budget owner needs more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('equip'); + cy.get('#root_purpose').clear().type('Input devices allow the user to enter information into the system, or control its operation. Most personal computers have a mouse and keyboard, but laptop systems typically use a touchpad instead of a mouse. Other input devices include webcams, mic'); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('2025-02-25'); + cy.get('#root_vendor').clear().type('Amazon.com'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('laptops'); + cy.get('#root_0_item').clear().type('Because computer parts contain hazardous materials, there is a growing movement to recycle old'); + cy.get('#root_0_qty').clear().type('4'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('GBP'); + cy.get('#root_0_unit_price').type('420'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('The personal computer is one of the most common types of computer due to its versatility and relatively low price. Desktop personal computers have a monitor, a keyboard, a mouse, and a computer case.\nhttps://en.wikipedia.org/wiki/Computer_hardware'); + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "escalateBO" + ); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + //people ops escalate to BO second time + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "escalateBO" + ); + + //budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + + }); + }); + + }); +}); \ No newline at end of file diff --git a/spiffworkflow-frontend/cypress/e2e/NDR_PP1/learninganddev.cy.js b/spiffworkflow-frontend/cypress/e2e/NDR_PP1/learninganddev.cy.js new file mode 100644 index 00000000..b5aabe7d --- /dev/null +++ b/spiffworkflow-frontend/cypress/e2e/NDR_PP1/learninganddev.cy.js @@ -0,0 +1,1439 @@ +const submitWithUser = ( + username, + password, + processInstanceId, + expectAdditionalApprovalInfoPage = false, + approvaltype +) => { + cy.wait(2000); + cy.log('========Login with : ', username); + cy.log('========processInstanceId: ', processInstanceId); + cy.login(username, password); + + cy.wait(1000); + cy.log('=======visit find by id : '); + cy.visit('/admin/process-instances/find-by-id'); + cy.get('#process-instance-id-input').type(processInstanceId); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks I can complete', { timeout: 60000 }); + + cy.get('.cds--btn').contains(/^Go$/).click(); + + cy.wait(2000); + // approve! + if (approvaltype === "approve") { + cy.get('#root > label:nth-child(1)').click(); + cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' is approving this.')); + } else if (approvaltype === "reject") { + cy.get('#root > label:nth-child(3)').click(); + cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' is rejecting this.')); + } else if (approvaltype === "needmoreinfo") { + cy.get('#root > label:nth-child(2)').click(); + cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' needs additional info. The term, learning and development, encompasses any professional development a business provides to its employees END.')); + } else if (approvaltype === "providemoreinfo") { + //Form 1 + cy.contains('Task: Submit New Demand Request Details', { timeout: 60000 }); + cy.get('button') + .contains(/^Submit$/) + .click(); + //Form 2 + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('button') + .contains(/^Submit$/) + .click(); + //Form 3 + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 }); + + cy.get('.cds--text-area__wrapper').find('#root').clear().type('Providing additional info. Learning and development (L&D) is a function within an organization that is responsible for empowering employees\’ growth and developing their knowledge, skills, and capabilities to drive better business performance.'); + + cy.contains('Submit the Request').click(); + cy.get('input[value="Submit the Request"]').click(); + + } else { + + } + + cy.get('button') + .contains(/^Submit$/) + .click(); + + if (expectAdditionalApprovalInfoPage) { + cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 }); + + cy.get('button') + .contains(/^Continue$/) + .click(); + + } + cy.location({ timeout: 60000 }).should((loc) => { + expect(loc.pathname).to.eq('/tasks'); + }); + cy.wait(2000); + cy.logout(); + cy.wait(2000); +}; + +//Learning and Development Path - Without Files +describe('Learning and Development Path - Without Files', () => { + + Cypress._.times(1, () => { + //People Ops Partner Group approves the request + it('Books Only. People Ops Partner Group approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('learn_and_dev'); + cy.get('#root_purpose').clear().type('A L&D strategy should be aligned to the organization’s business strategy and goals with the aim of developing the workforce’s capability and driving business results.'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('AIHR'); + cy.get('#root_payment_method').select('Debit Card'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('books'); + cy.get('#root_0_item').clear().type('A bounty is a payment or reward of money to locate'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('AUD'); + cy.get('#root_0_unit_price').type('2416'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('A L&D strategy should be aligned to the organization\’s business strategy and goals with the aim of developing the workforce\’s capability and driving business results.'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + }); + }); + + //People Ops Partner Group rejects the request + it('Books Only. People Ops Partner Group rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('learn_and_dev'); + cy.get('#root_purpose').clear().type('Learning and development (L&D) is a function within an organization that is responsible for empowering employees’ growth and developing their knowledge, skills, and capabilities to drive better business performance. '); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('2024-02-06'); + cy.get('#root_vendor').clear().type('EYK Books'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('books'); + cy.get('#root_0_item').clear().type('The role of the L&D function has evolved to meet the demands of digital transformation and a modern workforce.'); + cy.get('#root_0_qty').clear().type('5'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('EUR'); + cy.get('#root_0_unit_price').type('250'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('The function may be organized centrally, either independently or sitting under human resources (HR); decentralized throughout different business units; or be a hybrid (sometimes referred to as federated) structure.'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + //People Ops Partner Group request for additional details + it('Books Only. People Ops Partner Group needs more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('learn_and_dev'); + cy.get('#root_purpose').clear().type('A comprehensive collection of the concepts, definitions, and methodologies for the profession can be found in the. \nhttps://www.aihr.com/blog/learning-and-development/'); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('2025-02-25'); + cy.get('#root_vendor').clear().type('BOUNTY'); + cy.get('#root_payment_method').select('Crypto Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('books'); + cy.get('#root_0_item').clear().type('There are many different roles that make up a learning and development team or fall under the umbrel'); + cy.get('#root_0_qty').clear().type('4'); + cy.get('#root_0_currency_type').select('Crypto'); + cy.get('#root_0_currency').select('SNT'); + cy.get('#root_0_unit_price').type('450'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('Current and aspiring talent development professionals can enhance their skills with the various professional education courses offered by ATD Education \nhttps://www.aihr.com/blog/learning-and-development/'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + //people ops approves second time + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + + }); + }); + + //Budget owner approves and People Ops Partner Group approves the request + it('NOT Books Only. Budget owner approves and People Ops Partner Group approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('learn_and_dev'); + cy.get('#root_purpose').clear().type('In 2019, the Association for Talent Development (ATD) conducted a competency study to assess needed talent development capabilities. The research found that the knowledge, skills, and attitudes (KSAs) of effective talent development professionals'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Lynda.com'); + cy.get('#root_payment_method').select('Reimbursement'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + //item 0 + cy.get('#root_0_sub_category').select('on_conf'); + cy.get('#root_0_item').clear().type('The goal of learning and development is to develop or change the behavior of individuals or groups'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('AUD'); + cy.get('#root_0_unit_price').type('2416'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('course'); + cy.get('#root_1_item').clear().type('The goal of learning and development is to change the behavior of individuals or groups for better'); + cy.get('#root_1_qty').clear().type('1'); + cy.get('#root_1_currency_type').select('Crypto'); + cy.get('#root_1_currency').select('DAI'); + cy.get('#root_1_unit_price').type('2450'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 2 + cy.get('#root_2_sub_category').select('books'); + cy.get('#root_2_item').clear().type('A L&D strategy should be aligned to the organization\’s business strategy'); + cy.get('#root_2_qty').clear().type('6'); + cy.get('#root_2_currency_type').select('Crypto'); + cy.get('#root_2_currency').select('SNT'); + cy.get('#root_2_unit_price').type('2300'); + + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('Learning and development is a systematic process to enhance an employee\’s skills, knowledge, and competency, resulting in better performance in a work setting. \nhttps://www.aihr.com/blog/learning-and-development/'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + }); + }); + + //Budget owner rejects the request + it('NOT Books Only. Budget owner rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('learn_and_dev'); + cy.get('#root_purpose').clear().type('Learning and development is a systematic process to enhance an employee\’s skills, knowledge, and competency, resulting in better performance in a work setting. \nhttps://www.aihr.com/blog/learning-and-development/'); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('2024-02-06'); + cy.get('#root_vendor').clear().type('Udemy Courses'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('course'); + cy.get('#root_0_item').clear().type('There are many different roles that make up a learning and development team or fall under the'); + cy.get('#root_0_qty').clear().type('5'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('EUR'); + cy.get('#root_0_unit_price').type('250'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('A L&D strategy should be aligned to the organization\’s business strategy and goals with the aim of developing the workforce\’s capability and driving business results.'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + //Budget owner request for additional details + it('NOT Books Only. Budget owner needs more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('learn_and_dev'); + cy.get('#root_purpose').clear().type('Research found that the knowledge, skills, and attitudes (KSAs) of effective talent development professionals, at every level of their career, fell into three major domains of practice.'); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('2025-02-25'); + cy.get('#root_vendor').clear().type('Conference LTD'); + cy.get('#root_payment_method').select('Crypto Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('on_conf'); + cy.get('#root_0_item').clear().type('Learning and development is a systematic process to enhance an employee\’s skills'); + cy.get('#root_0_qty').clear().type('4'); + cy.get('#root_0_currency_type').select('Crypto'); + cy.get('#root_0_currency').select('SNT'); + cy.get('#root_0_unit_price').type('450'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('Learning and development is a systematic process to enhance an employee\’s skills, knowledge, and competency, resulting in better performance in a work setting. \nhttps://www.aihr.com/blog/learning-and-development/'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + //budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + + }); + }); + + }); + +}); + +//Learning and Development Path - With Files +describe('Learning and Development Path - With Files', () => { + + Cypress._.times(1, () => { + //People Ops Partner Group approves the request + it('Books Only. People Ops Partner Group approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('learn_and_dev'); + cy.get('#root_purpose').clear().type('Learning and development is a systematic process to enhance an employee\’s skills, knowledge, and competency, resulting in better performance in a work setting. \nhttps://www.aihr.com/blog/learning-and-development/'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Training Industry'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('books'); + cy.get('#root_0_item').clear().type('A L&D strategy should be aligned to the organization\’s business strategy and goals'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('AUD'); + cy.get('#root_0_unit_price').type('2416'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('A L&D strategy should be aligned to the organization\’s business strategy and goals with the aim of developing the workforce\’s capability and driving business results.'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + }); + }); + + //People Ops Partner Group rejects the request + it('Books Only. People Ops Partner Group rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('learn_and_dev'); + cy.get('#root_purpose').clear().type('The goal of learning and development is to develop or change the behavior of individuals or groups for the better, sharing knowledge and insights that enable them to do their work better, or cultivate attitudes that help them perform better'); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('2024-02-06'); + cy.get('#root_vendor').clear().type('EYK Books'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('books'); + cy.get('#root_0_item').clear().type('There are many different roles that make up a learning and development team or fall'); + cy.get('#root_0_qty').clear().type('5'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('EUR'); + cy.get('#root_0_unit_price').type('250'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('Learning and development is a systematic process to enhance an employee\’s skills, knowledge, and competency, resulting in better performance in a work setting. \nhttps://www.aihr.com/blog/learning-and-development/'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + //People Ops Partner Group request for additional details + it('Books Only. People Ops Partner Group needs more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('learn_and_dev'); + cy.get('#root_purpose').clear().type('A L&D strategy should be aligned to the organization\’s business strategy and goals with the aim of developing the workforce\’s capability and driving business results.'); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('2025-02-25'); + cy.get('#root_vendor').clear().type('Conference LTD'); + cy.get('#root_payment_method').select('Crypto Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('books'); + cy.get('#root_0_item').clear().type('Learning and development is a systematic process to enhance an employee\’s skills'); + cy.get('#root_0_qty').clear().type('4'); + cy.get('#root_0_currency_type').select('Crypto'); + cy.get('#root_0_currency').select('SNT'); + cy.get('#root_0_unit_price').type('450'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('Learning, training, and development are often used interchangeably. However, there are subtle differences between these concepts, which are shown in the table below. \nhttps://www.aihr.com/blog/learning-and-development/'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + //people ops approves second time + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + + }); + }); + + //Budget owner approves and People Ops Partner Group approves the request + it('NOT Books Only. Budget owner approves and People Ops Partner Group approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('learn_and_dev'); + cy.get('#root_purpose').clear().type('Learning and development is a systematic process to enhance an employee\’s skills, knowledge, and competency, resulting in better performance in a work setting. \nhttps://www.aihr.com/blog/learning-and-development/'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('The Leadership Laboratory'); + cy.get('#root_payment_method').select('Crypto Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + //item 0 + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('on_conf'); + cy.get('#root_0_item').clear().type('There are many different roles that make up a learning and development team'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('AUD'); + cy.get('#root_0_unit_price').type('2416'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('course'); + cy.get('#root_1_item').clear().type('The goal of learning and development is to change the behavior of individuals or groups for better'); + cy.get('#root_1_qty').clear().type('1'); + cy.get('#root_1_currency_type').select('Fiat'); + cy.get('#root_1_currency').select('CAD'); + cy.get('#root_1_unit_price').type('1355'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 2 + cy.get('#root_2_sub_category').select('books'); + cy.get('#root_2_item').clear().type('A L&D strategy should be aligned to the organization\’s business strategy'); + cy.get('#root_2_qty').clear().type('6'); + cy.get('#root_2_currency_type').select('Crypto'); + cy.get('#root_2_currency').select('SNT'); + cy.get('#root_2_unit_price').type('2300'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('A L&D strategy should be aligned to the organization\’s business strategy and goals with the aim of developing the workforce\’s capability and driving business results.'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + }); + }); + + //Budget owner rejects the request + it('NOT Books Only. Budget owner rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('learn_and_dev'); + cy.get('#root_purpose').clear().type('The goal of learning and development is to develop or change the behavior of individuals or groups for the better, sharing knowledge and insights that enable them to do their work better, or cultivate attitudes that help them perform better'); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('2024-02-06'); + cy.get('#root_vendor').clear().type('Lynda.com'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('course'); + cy.get('#root_0_item').clear().type('The goal of learning and development is to develop or change the behavior of individuals or groups'); + cy.get('#root_0_qty').clear().type('5'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('EUR'); + cy.get('#root_0_unit_price').type('250'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('Learning and development is a systematic process to enhance an employee\’s skills, knowledge, and competency, resulting in better performance in a work setting. \nhttps://www.aihr.com/blog/learning-and-development/'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + //Budget owner request for additional details + it('NOT Books Only. Budget owner needs more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('learn_and_dev'); + cy.get('#root_purpose').clear().type('Learning, training, and development are often used interchangeably. However, there are subtle differences between these concepts, which are shown in the table below. '); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('2025-02-25'); + cy.get('#root_vendor').clear().type('Conference LTD'); + cy.get('#root_payment_method').select('Crypto Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('on_conf'); + cy.get('#root_0_item').clear().type('There are many different roles that make up a learning and development team'); + cy.get('#root_0_qty').clear().type('4'); + cy.get('#root_0_currency_type').select('Crypto'); + cy.get('#root_0_currency').select('SNT'); + cy.get('#root_0_unit_price').type('450'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('A L&D strategy should be aligned to the organization\’s business strategy and goals with the aim of developing the workforce\’s capability and driving business results.'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + //budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + let peopleOpsUsername = Cypress.env('peopleopssme_username'); + let peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log('=====peopleOpsUsername : ' + peopleOpsUsername); + cy.log('=====peopleOpsPassword : ' + peopleOpsPassword); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + "approve" + ); + + + }); + }); + + }); +}); \ No newline at end of file diff --git a/spiffworkflow-frontend/cypress/e2e/NDR_PP1/otherfees.cy.js b/spiffworkflow-frontend/cypress/e2e/NDR_PP1/otherfees.cy.js new file mode 100644 index 00000000..3be8706f --- /dev/null +++ b/spiffworkflow-frontend/cypress/e2e/NDR_PP1/otherfees.cy.js @@ -0,0 +1,744 @@ +const submitWithUser = ( + username, + password, + processInstanceId, + expectAdditionalApprovalInfoPage = false, + approvaltype +) => { + cy.wait(2000); + cy.log('========Login with : ', username); + cy.log('========processInstanceId: ', processInstanceId); + cy.login(username, password); + + cy.wait(1000); + cy.log('=======visit find by id : '); + cy.visit('/admin/process-instances/find-by-id'); + cy.get('#process-instance-id-input').type(processInstanceId); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks I can complete', { timeout: 60000 }); + + cy.get('.cds--btn').contains(/^Go$/).click(); + + cy.wait(2000); + // approve! + if (approvaltype === "approve") { + cy.get('#root > label:nth-child(1)').click(); + cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' is approving this.')); + } else if (approvaltype === "reject") { + cy.get('#root > label:nth-child(3)').click(); + cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' is rejecting this.')); + } else if (approvaltype === "needmoreinfo") { + cy.get('#root > label:nth-child(2)').click(); + cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' needs additional info. Coworking is not only about providing a physical place, but also about establishing a community. Its rapid growth has been seen as a possible way for city planners to address.')); + } else if (approvaltype === "providemoreinfo") { + //Form 1 + cy.contains('Task: Submit New Demand Request Details', { timeout: 60000 }); + cy.get('button') + .contains(/^Submit$/) + .click(); + //Form 2 + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('button') + .contains(/^Submit$/) + .click(); + //Form 3 + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 }); + + cy.get('.cds--text-area__wrapper').find('#root').clear().type('Providing additional info. Coworking tends to fall into two sides: Those that are real-estate-centric (all about selling desks and offices first) while others are community-centric (focused on building community that happens to also have offices)'); + + cy.contains('Submit the Request').click(); + cy.get('input[value="Submit the Request"]').click(); + + } else { + + } + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + if (expectAdditionalApprovalInfoPage) { + cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 }); + + cy.get('button') + .contains(/^Continue$/) + .click(); + + } + cy.location({ timeout: 60000 }).should((loc) => { + expect(loc.pathname).to.eq('/tasks'); + }); + cy.wait(2000); + cy.logout(); + cy.wait(2000); +}; + +describe('Other Fees Path - Without Files', () => { + + Cypress._.times(1, () => { + //Budget owner approves the request + it('Budget owner approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('other_fees'); + cy.get('#root_purpose').clear().type('Other Fees and Expenses means, collectively, all fees and expenses payable to Lenders under the Loan Documents, other than principal, interest and default interest/penalty amounts.'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('ABC CO'); + cy.get('#root_payment_method').select('Reimbursement'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + //item 0 + cy.get('#root_0_sub_category').select('bounties'); + cy.get('#root_0_item').clear().type('A bounty is a payment or reward of money to locate'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('AUD'); + cy.get('#root_0_unit_price').type('2416'); + + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('coworking'); + cy.get('#root_1_item').clear().type('A consultant (from Latin: consultare "to deliberate") is a professional'); + cy.get('#root_1_qty').clear().type('1'); + cy.get('#root_1_currency_type').select('Crypto'); + cy.get('#root_1_currency').select('SNT'); + cy.get('#root_1_unit_price').type('1355'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('For professionals working in the professional services, ‘consultant’ and advisor’ are often used and fall under common terminology. Consultancy.uk zooms in on this field to get a closer look. \n https://www.consultancy.uk/career/what-is-consulting'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + }); + }); + + //Budget owner rejects the request + it('Budget owner rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('other_fees'); + cy.get('#root_purpose').clear().type('Other Fees and Expenses means, collectively, all fees and expenses payable to Lenders under the Loan Documents, other than principal, interest and default interest/penalty amounts.'); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('2024-02-06'); + cy.get('#root_vendor').clear().type('CO-WORK ENG'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('coworking'); + cy.get('#root_0_item').clear().type('Coworking is an arrangement in which workers for different companies share an office space'); + cy.get('#root_0_qty').clear().type('5'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('EUR'); + cy.get('#root_0_unit_price').type('250'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('For professionals working in the professional services, ‘consultant’ and advisor’ are often used and fall under common terminology. Consultancy.uk zooms in on this field to get a closer look. \n https://www.consultancy.uk/career/what-is-consulting'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + //Budget owner request for additional details + it('Budget owner need more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('other_fees'); + cy.get('#root_purpose').clear().type(' It allows cost savings and convenience through the use of common infrastructures, such as equipment, utilities and receptionist and custodial services, and in some cases refreshments and parcel services.\nhttps://en.wikipedia.org/wiki/Coworking'); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('2025-02-25'); + cy.get('#root_vendor').clear().type('Bounty Co'); + cy.get('#root_payment_method').select('Crypto Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('bounties'); + cy.get('#root_0_item').clear().type('Coworking is not only about providing a physical place, but also about establishing a community.'); + cy.get('#root_0_qty').clear().type('4'); + cy.get('#root_0_currency_type').select('Crypto'); + cy.get('#root_0_currency').select('SNT'); + cy.get('#root_0_unit_price').type('450'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('It\’s free and easy to post a job. Simply fill in a title, description and budget and competitive bids come within minutes. No job is too big or too small. We\'ve got freelancers for jobs of any size or budget across 1800 skills. No job is too complex.'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + //budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + }); + }); + + }); +}); + +describe('Other Fees Path - With Files', () => { + + Cypress._.times(1, () => { + //Budget owner approves the request + it('Budget owner approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('other_fees'); + cy.get('#root_purpose').clear().type('It allows cost savings and convenience through the use of common infrastructures, such as equipment, utilities and receptionist and custodial services, and in some cases refreshments and parcel acceptance services'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Embassar'); + cy.get('#root_payment_method').select('Reimbursement'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + //item 0 + cy.get('#root_0_sub_category').select('bounties'); + cy.get('#root_0_item').clear().type('A bounty is a payment or reward of money to locate'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('AUD'); + cy.get('#root_0_unit_price').type('2416'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('coworking'); + cy.get('#root_1_item').clear().type('A consultant (from Latin: consultare "to deliberate") is a professional'); + cy.get('#root_1_qty').clear().type('1'); + cy.get('#root_1_currency_type').select('Crypto'); + cy.get('#root_1_currency').select('DAI'); + cy.get('#root_1_unit_price').type('4250'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('For professionals working in the professional services, ‘consultant’ and advisor’ are often used and fall under common terminology. Consultancy.uk zooms in on this field to get a closer look. \n https://www.consultancy.uk/career/what-is-consulting'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + }); + }); + + //Budget owner rejects the request + it('Budget owner rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('other_fees'); + cy.get('#root_purpose').clear().type('Other Fees and Expenses means, collectively, all fees and expenses payable to Lenders under the Loan Documents, other than principal, interest and default interest/penalty amounts.'); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('2024-02-06'); + cy.get('#root_vendor').clear().type('CO-WORK ENG'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('coworking'); + cy.get('#root_0_item').clear().type('Coworking is not only about providing a physical place, but also about establishing a community'); + cy.get('#root_0_qty').clear().type('5'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('EUR'); + cy.get('#root_0_unit_price').type('250'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('For professionals working in the professional services, ‘consultant’ and advisor’ are often used and fall under common terminology. Consultancy.uk zooms in on this field to get a closer look. \n https://www.consultancy.uk/career/what-is-consulting'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + //Budget owner request for additional details + it('Budget owner need more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('other_fees'); + cy.get('#root_purpose').clear().type('It allows cost savings and convenience through the use of common infrastructures, such as equipment, utilities and receptionist and custodial services, and in some cases refreshments and parcel services.\nhttps://en.wikipedia.org/wiki/Coworking'); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('2025-02-25'); + cy.get('#root_vendor').clear().type('BOUNTY'); + cy.get('#root_payment_method').select('Crypto Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('bounties'); + cy.get('#root_0_item').clear().type('Coworking is distinct from business accelerators, business incubators, and executive suites.'); + cy.get('#root_0_qty').clear().type('4'); + cy.get('#root_0_currency_type').select('Crypto'); + cy.get('#root_0_currency').select('SNT'); + cy.get('#root_0_unit_price').type('450'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('It\’s free and easy to post a job. Simply fill in a title, description and budget and competitive bids come within minutes. No job is too big or too small. We\'ve got freelancers for jobs of any size or budget across 1800 skills. No job is too complex.'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + //budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + }); + }); + + }); +}); \ No newline at end of file diff --git a/spiffworkflow-frontend/cypress/e2e/NDR_PP1/softwarelicense.cy.js b/spiffworkflow-frontend/cypress/e2e/NDR_PP1/softwarelicense.cy.js new file mode 100644 index 00000000..f0675f0d --- /dev/null +++ b/spiffworkflow-frontend/cypress/e2e/NDR_PP1/softwarelicense.cy.js @@ -0,0 +1,2801 @@ +const submitWithUser = ( + username, + password, + processInstanceId, + expectAdditionalApprovalInfoPage = false, + approvaltype +) => { + cy.wait(2000); + cy.log('========Login with : ', username); + cy.log('========processInstanceId: ', processInstanceId); + cy.login(username, password); + + cy.wait(1000); + cy.log('=======visit find by id : '); + cy.visit('/admin/process-instances/find-by-id'); + cy.get('#process-instance-id-input').type(processInstanceId); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks I can complete', { timeout: 60000 }); + + cy.get('.cds--btn').contains(/^Go$/).click(); + + cy.wait(2000); + // approve! + if (approvaltype === "approve") { + cy.get('#root > label:nth-child(1)').click(); + //cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' is approving this.')); + } else if (approvaltype === "reject") { + cy.get('#root > label:nth-child(3)').click(); + cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' is rejecting this.')); + } else if (approvaltype === "needmoreinfo") { + cy.get('#root > label:nth-child(2)').click(); + cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' needs additional info. A software license is a document that provides legally binding guidelines for the use and distribution of software.Software licenses typically provide end users with the right to END.')); + //cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' needs additional info.')); + } else if (approvaltype === "cpapproved") { + cy.get('#root > label:nth-child(3)').click(); + cy.get('.cds--text-area__wrapper').find('#root').type(username.concat(' is selecting CP is Approved.')); + } else if (approvaltype === "providemoreinfo") { + //Form 1 + cy.contains('Task: Submit New Demand Request Details', { timeout: 60000 }); + cy.get('button') + .contains(/^Submit$/) + .click(); + //Form 2 + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('button') + .contains(/^Submit$/) + .click(); + //Form 3 + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 }); + + cy.get('.cds--text-area__wrapper').find('#root').clear().type('Providing additional info. Open source is a term that originally referred to open source software (OSS). Open source software is code that is designed to be publicly accessible—anyone can see, modify, and distribute.'); + + cy.contains('Submit the Request').click(); + cy.get('input[value="Submit the Request"]').click(); + + } else { + + } + + cy.get('button') + .contains(/^Submit$/) + .click(); + + if (expectAdditionalApprovalInfoPage) { + cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 }); + + cy.get('button') + .contains(/^Continue$/) + .click(); + + } + cy.location({ timeout: 60000 }).should((loc) => { + expect(loc.pathname).to.eq('/tasks'); + }); + cy.wait(2000); + cy.logout(); + cy.wait(2000); +}; + +//Software and Licenses Path - Without Files +describe('Software and Licenses Path - Without Files', () => { + + Cypress._.times(1, () => { + + //Everyone approves with CP + it('Everyone approves with CP', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('Sware\nA software license is a document that provides legally binding guidelines for the use and distribution of software.\nSoftware licenses typically provide end users with the right to one or more copies of the software without violating copyrights'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Microsoft'); + cy.get('#root_payment_method').select('Reimbursement'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + //item 0 + cy.get('#root_0_sub_category').select('op_src'); + cy.get('#root_0_item').clear().type('Open source software is code that is designed to be publicly accessible anyone can see, modify, END'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Crypto'); + cy.get('#root_0_currency').select('SNT'); + cy.get('#root_0_unit_price').type('1915'); + + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('lic_and_sub'); + cy.get('#root_1_item').clear().type('A software license is a document that provides legally binding guidelines for the use and distri END'); + cy.get('#root_1_qty').clear().type('1'); + cy.get('#root_1_currency_type').select('Fiat'); + cy.get('#root_1_currency').select('AED'); + cy.get('#root_1_unit_price').type('4500'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('2021 Newest HP 17.3 inch FHD Laptop, AMD Ryzen 5 5500U 6core(Beat i7-1160G7, up to 4.0GHz),16GB RAM, 1TB PCIe SSD, Bluetooth 4.2, WiFi, HDMI, USB-A&C, Windows 10 S, w/Ghost Manta Accessories, Silver\nhttps://www.amazon.com/HP-i7-11G7-Bluetooth-Windows'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + let ppgbasmeUsername = Cypress.env('ppgbasme_username'); + let ppgbasmePassword = Cypress.env('ppgbasme_username'); + let securitysmeUsername = Cypress.env('securitysme_username'); + let securitysmePassword = Cypress.env('securitysme_password'); + let infrasmeUsername = Cypress.env('infrasme_username'); + let infrasmePassword = Cypress.env('infrasme_password'); + let legalsmeUsername = Cypress.env('legalsme_username'); + let legalsmePassword = Cypress.env('legalsme_password'); + + submitWithUser( + ppgbasmeUsername, + ppgbasmePassword, + processInstanceId, + null, + "cpapproved" + ); + + submitWithUser( + legalsmeUsername, + legalsmePassword, + processInstanceId, + null, + "approve" + ); + + }); + }); + + //Everyone approves the request + it('Everyone approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('Software licenses typically are proprietary, free or open source. The distinguishing feature is the terms under which users may redistribute or copy the software for future development or use.'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Red Hat'); + cy.get('#root_payment_method').select('Reimbursement'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + + //item 0 + cy.get('#root_0_sub_category').select('op_src'); + cy.get('#root_0_item').clear().type('Open source has become a movement and a way of working that reaches beyond software production'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('NZD'); + cy.get('#root_0_unit_price').type('2416'); + + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('lic_and_sub'); + cy.get('#root_1_item').clear().type('A software license is a document that states the rights of the developer and user of software.'); + cy.get('#root_1_qty').clear().type('1'); + cy.get('#root_1_currency_type').select('Fiat'); + cy.get('#root_1_currency').select('STN'); + cy.get('#root_1_unit_price').type('380'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('Software also comes with a license key or product key. The key is used to identify and verify the specific version of the software. It is also used to activate the software device.\nhttps://www.techtarget.com/searchcio/definition/software-license'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + let ppgbasmeUsername = Cypress.env('ppgbasme_username'); + let ppgbasmePassword = Cypress.env('ppgbasme_username'); + let securitysmeUsername = Cypress.env('securitysme_username'); + let securitysmePassword = Cypress.env('securitysme_password'); + let infrasmeUsername = Cypress.env('infrasme_username'); + let infrasmePassword = Cypress.env('infrasme_password'); + let legalsmeUsername = Cypress.env('legalsme_username'); + let legalsmePassword = Cypress.env('legalsme_password'); + + submitWithUser( + ppgbasmeUsername, + ppgbasmePassword, + processInstanceId, + null, + "approve" + ); + + submitWithUser( + securitysmeUsername, + securitysmePassword, + processInstanceId, + null, + "approve" + ); + + submitWithUser( + infrasmeUsername, + infrasmePassword, + processInstanceId, + 'Task: Update Application Landscape', + "approve" + ); + + submitWithUser( + legalsmeUsername, + legalsmePassword, + processInstanceId, + null, + "approve" + ); + + }); + }); + + //Budget owner rejects the request + it('Budget owner rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('Sware\nA software license is a document that provides legally binding guidelines for the use and distribution of software.\nSoftware licenses typically provide end users with the right to one or more copies of the software without violating copyrights'); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('2024-02-06'); + cy.get('#root_vendor').clear().type('Oracle'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('lic_and_sub'); + cy.get('#root_0_item').clear().type('It defines the terms of. A user must agree to the terms of the license when acquiring the software.'); + cy.get('#root_0_qty').clear().type('5'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('EUR'); + cy.get('#root_0_unit_price').type('250'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('Software also comes with a license key or product key. The key is used to identify and verify the specific version of the software. It is also used to activate the software device.\nhttps://www.techtarget.com/searchcio/definition/software-license'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + //Budget owner request for additional details + it('Budget owner need more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('A software license establishes the rights of all parties involved with the software: the author, the provider and the end users. It defines the relationship between the software company and users and explains how they are protected'); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('2025-02-25'); + cy.get('#root_vendor').clear().type('ABC Licensing Co'); + cy.get('#root_payment_method').select('Crypto Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('lic_and_sub'); + cy.get('#root_0_item').clear().type('They protect developers\' intellectual property and trade secrets based on copyright laws'); + cy.get('#root_0_qty').clear().type('4'); + cy.get('#root_0_currency_type').select('Crypto'); + cy.get('#root_0_currency').select('SNT'); + cy.get('#root_0_unit_price').type('450'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('They define what users can do with software code they did not write.'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + //budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + let ppgbasmeUsername = Cypress.env('ppgbasme_username'); + let ppgbasmePassword = Cypress.env('ppgbasme_username'); + let legalsmeUsername = Cypress.env('legalsme_username'); + let legalsmePassword = Cypress.env('legalsme_password'); + + submitWithUser( + ppgbasmeUsername, + ppgbasmePassword, + processInstanceId, + null, + "cpapproved" + ); + + submitWithUser( + legalsmeUsername, + legalsmePassword, + processInstanceId, + null, + "approve" + ); + + + }); + }); + + //Infra reject the request + it('Infra rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('There are two general types of software licenses that differ based on how they are viewed under copyright law.'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Meta'); + cy.get('#root_payment_method').select('Reimbursement'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('op_src'); + cy.get('#root_0_item').clear().type('The open source movement uses the values and decentralized production model of open source software'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('AUD'); + cy.get('#root_0_unit_price').type('2416'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('Free and open source software (FOSS) licenses are often referred to as open source. FOSS source code is available to the customer along with the software product. The customer is usually allowed to use the source code to change the software.'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + let ppgbasmeUsername = Cypress.env('ppgbasme_username'); + let ppgbasmePassword = Cypress.env('ppgbasme_username'); + let securitysmeUsername = Cypress.env('securitysme_username'); + let securitysmePassword = Cypress.env('securitysme_password'); + let infrasmeUsername = Cypress.env('infrasme_username'); + let infrasmePassword = Cypress.env('infrasme_password'); + let legalsmeUsername = Cypress.env('legalsme_username'); + let legalsmePassword = Cypress.env('legalsme_password'); + + submitWithUser( + ppgbasmeUsername, + ppgbasmePassword, + processInstanceId, + null, + "approve" + ); + + submitWithUser( + securitysmeUsername, + securitysmePassword, + processInstanceId, + null, + "approve" + ); + + submitWithUser( + infrasmeUsername, + infrasmePassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + + }); +}); + +//Software and Licenses Path - With Files +describe('Software and Licenses Path - With Files', () => { + + Cypress._.times(1, () => { + + //Everyone approves with CP + it('Everyone approves with CP', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('Sware\nA software license is a document that provides legally binding guidelines for the use and distribution of software.\nSoftware licenses typically provide end users with the right to one or more copies of the software without violating copyrights'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Microsoft Corp'); + cy.get('#root_payment_method').select('Reimbursement'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + //item 0 + cy.get('#root_0_sub_category').select('op_src'); + cy.get('#root_0_item').clear().type('Open source software is developed in a decentralized and collaborative way'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('JPY'); + cy.get('#root_0_unit_price').type('2416'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('lic_and_sub'); + cy.get('#root_1_item').clear().type('A software license is a document that provides legally binding guidelines for the use and distri END'); + cy.get('#root_1_qty').clear().type('1'); + cy.get('#root_1_currency_type').select('Fiat'); + cy.get('#root_1_currency').select('INR'); + cy.get('#root_1_unit_price').type('4500'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('Open source software is developed in a decentralized and collaborative way, relying on peer review and community production. Open source software is often cheaper more flexible. \nhttps://www.redhat.com/en'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + let ppgbasmeUsername = Cypress.env('ppgbasme_username'); + let ppgbasmePassword = Cypress.env('ppgbasme_username'); + let securitysmeUsername = Cypress.env('securitysme_username'); + let securitysmePassword = Cypress.env('securitysme_password'); + let infrasmeUsername = Cypress.env('infrasme_username'); + let infrasmePassword = Cypress.env('infrasme_password'); + let legalsmeUsername = Cypress.env('legalsme_username'); + let legalsmePassword = Cypress.env('legalsme_password'); + + submitWithUser( + ppgbasmeUsername, + ppgbasmePassword, + processInstanceId, + null, + "cpapproved" + ); + + submitWithUser( + legalsmeUsername, + legalsmePassword, + processInstanceId, + null, + "approve" + ); + + }); + }); + + //Everyone approves the request + it('Everyone approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('Stware\nA software license is a document that provides legally binding guidelines for the use and distribution of software.\nSoftware licenses typically provide end users with the right to one or more copies of the software without violating copyrights'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('ORACLE LTD'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('op_src'); + cy.get('#root_0_item').clear().type('A bounty is a payment or reward of money to locate'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('SGD'); + cy.get('#root_0_unit_price').type('2416'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('Open source software is developed in a decentralized and collaborative way, relying on peer review and community production. Open source software is often cheaper more flexible. \nhttps://www.redhat.com/en'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'png-5mb-2.png']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + let ppgbasmeUsername = Cypress.env('ppgbasme_username'); + let ppgbasmePassword = Cypress.env('ppgbasme_username'); + let securitysmeUsername = Cypress.env('securitysme_username'); + let securitysmePassword = Cypress.env('securitysme_password'); + let infrasmeUsername = Cypress.env('infrasme_username'); + let infrasmePassword = Cypress.env('infrasme_password'); + let legalsmeUsername = Cypress.env('legalsme_username'); + let legalsmePassword = Cypress.env('legalsme_password'); + + submitWithUser( + ppgbasmeUsername, + ppgbasmePassword, + processInstanceId, + null, + "approve" + ); + + submitWithUser( + securitysmeUsername, + securitysmePassword, + processInstanceId, + null, + "approve" + ); + + submitWithUser( + infrasmeUsername, + infrasmePassword, + processInstanceId, + 'Task: Update Application Landscape', + "approve" + ); + + submitWithUser( + legalsmeUsername, + legalsmePassword, + processInstanceId, + null, + "approve" + ); + + }); + }); + + //Budget owner rejects the request + it('Budget owner rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('Stware\nA software license is a document that provides legally binding guidelines for the use and distribution of software.\nSoftware licenses typically provide end users with the right to one or more copies of the software without violating copyrights'); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('2024-02-06'); + cy.get('#root_vendor').clear().type('Subscription PVT'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('lic_and_sub'); + cy.get('#root_0_item').clear().type('Software development consultants with Python background'); + cy.get('#root_0_qty').clear().type('5'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('EUR'); + cy.get('#root_0_unit_price').type('250'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('Open source software is developed in a decentralized and collaborative way, relying on peer review and community production. Open source software is often cheaper more flexible. \nhttps://www.redhat.com/en'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + //Budget owner request for additional details + it('Budget owner need more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('Stware\nA software license is a document that provides legally binding guidelines for the use and distribution of software.\nSoftware licenses typically provide end users with the right to one or more copies of the software without violating copyrights'); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('2025-02-25'); + cy.get('#root_vendor').clear().type('LIC INST'); + cy.get('#root_payment_method').select('Crypto Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('lic_and_sub'); + cy.get('#root_0_item').clear().type('Freelancers to do the Python development and front end react app development'); + cy.get('#root_0_qty').clear().type('4'); + cy.get('#root_0_currency_type').select('Crypto'); + cy.get('#root_0_currency').select('SNT'); + cy.get('#root_0_unit_price').type('450'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('A software license is a legal instrument (usually by way of contract law, with or without printed material) governing the use or redistribution of software. Under United States copyright law, all software is copyright protected.'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + //budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + let ppgbasmeUsername = Cypress.env('ppgbasme_username'); + let ppgbasmePassword = Cypress.env('ppgbasme_username'); + let legalsmeUsername = Cypress.env('legalsme_username'); + let legalsmePassword = Cypress.env('legalsme_password'); + + submitWithUser( + ppgbasmeUsername, + ppgbasmePassword, + processInstanceId, + null, + "cpapproved" + ); + + submitWithUser( + legalsmeUsername, + legalsmePassword, + processInstanceId, + null, + "approve" + ); + + + + }); + }); + + //Infra rejects the request + it('Infra Rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('Proprietary licenses are often referred to as closed source. They provide customers with operational code. Users cannot freely alter this software. These licenses also usually restrict reverse engineering the software\'s code to obtain the source code'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Red HAT'); + cy.get('#root_payment_method').select('Reimbursement'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('op_src'); + cy.get('#root_0_item').clear().type('They provide customers with operational code. Users cannot freely alter this software.'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('STN'); + cy.get('#root_0_unit_price').type('2416'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('Free and open source software (FOSS) licenses are often referred to as open source. FOSS source code is available to the customer along with the software product. The customer is usually allowed to use the source code to change the software.'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'png-5mb-2.png']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + let ppgbasmeUsername = Cypress.env('ppgbasme_username'); + let ppgbasmePassword = Cypress.env('ppgbasme_username'); + let securitysmeUsername = Cypress.env('securitysme_username'); + let securitysmePassword = Cypress.env('securitysme_password'); + let infrasmeUsername = Cypress.env('infrasme_username'); + let infrasmePassword = Cypress.env('infrasme_password'); + let legalsmeUsername = Cypress.env('legalsme_username'); + let legalsmePassword = Cypress.env('legalsme_password'); + + submitWithUser( + ppgbasmeUsername, + ppgbasmePassword, + processInstanceId, + null, + "approve" + ); + + submitWithUser( + securitysmeUsername, + securitysmePassword, + processInstanceId, + null, + "approve" + ); + + submitWithUser( + infrasmeUsername, + infrasmePassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + }); +}); + +//Software and Licenses Path - With Files and Multiple items +describe('Software and Licenses Path - With Files and Multiple items', () => { + + Cypress._.times(1, () => { + + //Everyone approves with CP + it('Everyone approves with CP', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('Software licenses typically are proprietary, free or open source. The distinguishing feature is the terms under which users may redistribute or copy the software for future development or use.'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Meta Corp'); + cy.get('#root_payment_method').select('Reimbursement'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + + //item 0 + cy.get('#root_0_sub_category').select('op_src'); + cy.get('#root_0_item').clear().type('Definition. Open source software (OSS) is software that is distributed with its source code'); + cy.get('#root_0_qty').clear().type('1'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('AUD'); + cy.get('#root_0_unit_price').type('2416'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('lic_and_sub'); + cy.get('#root_1_item').clear().type('A software license is a document that provides binding guidelines for the use and distribution.'); + cy.get('#root_1_qty').clear().type('5'); + cy.get('#root_1_currency_type').select('Fiat'); + cy.get('#root_1_currency').select('EUR'); + cy.get('#root_1_unit_price').type('250'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 2 + cy.get('#root_2_sub_category').select('lic_and_sub'); + cy.get('#root_2_item').clear().type('Subscription relates to a licensing model that allows users to pay regularly for a computer program'); + cy.get('#root_2_qty').clear().type('10'); + cy.get('#root_2_currency_type').select('Crypto'); + cy.get('#root_2_currency').select('DAI'); + cy.get('#root_2_unit_price').type('12500'); + + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('A software license is a legal instrument (usually by way of contract law, with or without printed material) governing the use or redistribution of software. Under United States copyright law, all software is copyright protected.'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + let ppgbasmeUsername = Cypress.env('ppgbasme_username'); + let ppgbasmePassword = Cypress.env('ppgbasme_username'); + let securitysmeUsername = Cypress.env('securitysme_username'); + let securitysmePassword = Cypress.env('securitysme_password'); + let infrasmeUsername = Cypress.env('infrasme_username'); + let infrasmePassword = Cypress.env('infrasme_password'); + let legalsmeUsername = Cypress.env('legalsme_username'); + let legalsmePassword = Cypress.env('legalsme_password'); + + submitWithUser( + ppgbasmeUsername, + ppgbasmePassword, + processInstanceId, + null, + "cpapproved" + ); + + submitWithUser( + legalsmeUsername, + legalsmePassword, + processInstanceId, + null, + "approve" + ); + + }); + }); + + //Everyone approves the request + it('Everyone approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('Software licenses typically are proprietary, free or open source. The distinguishing feature is the terms under which users may redistribute or copy the software for future development or use.'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Apple'); + cy.get('#root_payment_method').select('Crypto Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + //item 0 + cy.get('#root_0_sub_category').select('op_src'); + cy.get('#root_0_item').clear().type('Definition. Open source software (OSS) is software that is distributed with its source code'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('AED'); + cy.get('#root_0_unit_price').type('1250'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('lic_and_sub'); + cy.get('#root_1_item').clear().type('A software license is a document that provides binding guidelines for the use and distribution.'); + cy.get('#root_1_qty').clear().type('5'); + cy.get('#root_1_currency_type').select('Crypto'); + cy.get('#root_1_currency').select('SNT'); + cy.get('#root_1_unit_price').type('25000'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 2 + cy.get('#root_2_sub_category').select('lic_and_sub'); + cy.get('#root_2_item').clear().type('Subscription relates to a licensing model that allows users to pay regularly for a computer program'); + cy.get('#root_2_qty').clear().type('3'); + cy.get('#root_2_currency_type').select('Crypto'); + cy.get('#root_2_currency').select('ETH'); + cy.get('#root_2_unit_price').type('2.10'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('A software license is a legal instrument (usually by way of contract law, with or without printed material) governing the use or redistribution of software. Under United States copyright law, \nhttps://en.wikipedia.org/wiki/Software_license'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'png-5mb-2.png']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + let ppgbasmeUsername = Cypress.env('ppgbasme_username'); + let ppgbasmePassword = Cypress.env('ppgbasme_username'); + let securitysmeUsername = Cypress.env('securitysme_username'); + let securitysmePassword = Cypress.env('securitysme_password'); + let infrasmeUsername = Cypress.env('infrasme_username'); + let infrasmePassword = Cypress.env('infrasme_password'); + let legalsmeUsername = Cypress.env('legalsme_username'); + let legalsmePassword = Cypress.env('legalsme_password'); + + submitWithUser( + ppgbasmeUsername, + ppgbasmePassword, + processInstanceId, + null, + "approve" + ); + + submitWithUser( + securitysmeUsername, + securitysmePassword, + processInstanceId, + null, + "approve" + ); + + submitWithUser( + infrasmeUsername, + infrasmePassword, + processInstanceId, + 'Task: Update Application Landscape', + "approve" + ); + + submitWithUser( + legalsmeUsername, + legalsmePassword, + processInstanceId, + null, + "approve" + ); + + }); + }); + + //Budget owner rejects the request + it('Budget owner rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('Software licenses typically are proprietary, free or open source. The distinguishing feature is the terms under which users may redistribute or copy the software for future development or use.'); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('2024-02-06'); + cy.get('#root_vendor').clear().type('Subscription PVT'); + cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + + //item 0 + cy.get('#root_0_sub_category').select('lic_and_sub'); + cy.get('#root_0_item').clear().type('Subscription relates to a licensing model that allows users to pay regularly for a computer program'); + cy.get('#root_0_qty').clear().type('5'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('USD'); + cy.get('#root_0_unit_price').type('250.50'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('lic_and_sub'); + cy.get('#root_1_item').clear().type('A software license is a document that provides binding guidelines for the use and distribution.'); + cy.get('#root_1_qty').clear().type('5'); + cy.get('#root_1_currency_type').select('Fiat'); + cy.get('#root_1_currency').select('GBP'); + cy.get('#root_1_unit_price').type('5200'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 2 + cy.get('#root_2_sub_category').select('op_src'); + cy.get('#root_2_item').clear().type('Definition. Open source software (OSS) is software that is distributed with its source code'); + cy.get('#root_2_qty').clear().type('3'); + cy.get('#root_2_currency_type').select('Fiat'); + cy.get('#root_2_currency').select('HKD'); + cy.get('#root_2_unit_price').type('2100'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('A software license is a legal instrument (usually by way of contract law, with or without printed material) governing the use or redistribution of software. Under United States copyright law, \nhttps://en.wikipedia.org/wiki/Software_license'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + //Budget owner request for additional details + it('Budget owner need more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('Free and open source software (FOSS) licenses are often referred to as open source. FOSS source code is available to the customer along with the software product. The customer is usually allowed to use the source code to change the software.'); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('2025-02-25'); + cy.get('#root_vendor').clear().type('LIC INST'); + cy.get('#root_payment_method').select('Crypto Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + //item 0 + cy.get('#root_0_sub_category').select('lic_and_sub'); + cy.get('#root_0_item').clear().type('A software license is a document that provides binding guidelines for the use and distribution.'); + cy.get('#root_0_qty').clear().type('24'); + cy.get('#root_0_currency_type').select('Crypto'); + cy.get('#root_0_currency').select('SNT'); + cy.get('#root_0_unit_price').type('450'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('op_src'); + cy.get('#root_1_item').clear().type('Definition. Open source software (OSS) is software that is distributed with its source code'); + cy.get('#root_1_qty').clear().type('15'); + cy.get('#root_1_currency_type').select('Crypto'); + cy.get('#root_1_currency').select('ETH'); + cy.get('#root_1_unit_price').type('0.85'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 2 + cy.get('#root_2_sub_category').select('lic_and_sub'); + cy.get('#root_2_item').clear().type('Subscription relates to a licensing model that allows users to pay regularly for a computer program'); + cy.get('#root_2_qty').clear().type('8'); + cy.get('#root_2_currency_type').select('Crypto'); + cy.get('#root_2_currency').select('DAI'); + cy.get('#root_2_unit_price').type('2100'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('A software license is a legal instrument (usually by way of contract law, with or without printed material) governing the use or redistribution of software. Under United States copyright law, \nhttps://en.wikipedia.org/wiki/Software_license'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'sampletext.txt']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + //budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + let ppgbasmeUsername = Cypress.env('ppgbasme_username'); + let ppgbasmePassword = Cypress.env('ppgbasme_username'); + let legalsmeUsername = Cypress.env('legalsme_username'); + let legalsmePassword = Cypress.env('legalsme_password'); + + submitWithUser( + ppgbasmeUsername, + ppgbasmePassword, + processInstanceId, + null, + "cpapproved" + ); + + submitWithUser( + legalsmeUsername, + legalsmePassword, + processInstanceId, + null, + "approve" + ); + + + + }); + }); + + //Infra rejects the request + it('Infra Rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('Free and open source software (FOSS) licenses are often referred to as open source. FOSS source code is available to the customer along with the software product. The customer is usually allowed to use the source code to change the software.'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + cy.get('#root_vendor').clear().type('Atlassian'); + cy.get('#root_payment_method').select('Debit Card'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + //item 0 + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('op_src'); + cy.get('#root_0_item').clear().type('Definition. Open source software (OSS) is software that is distributed with its source code'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('THB'); + cy.get('#root_0_unit_price').type('1350'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 1 + cy.get('#root_1_sub_category').select('op_src'); + cy.get('#root_1_item').clear().type('Open source software (OSS) is software that is distributed with its source code'); + cy.get('#root_1_qty').clear().type('15'); + cy.get('#root_1_currency_type').select('Fiat'); + cy.get('#root_1_currency').select('TRY'); + cy.get('#root_1_unit_price').type('3200'); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + //item 2 + cy.get('#root_2_sub_category').select('lic_and_sub'); + cy.get('#root_2_item').clear().type('Subscription relates to a licensing model that allows users to pay regularly for a computer program'); + cy.get('#root_2_qty').clear().type('8'); + cy.get('#root_2_currency_type').select('Crypto'); + cy.get('#root_2_currency').select('DAI'); + cy.get('#root_2_unit_price').type('2100'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper').find('#root').type('A typical software license grants the licensee, typically an end-user, permission to use one or more copies of software in ways where such a use would otherwise potentially constitute copyright.\nhttps://en.wikipedia.org/wiki/Software_license'); + + cy.get("input[type=file]") + .attachFile(['lorem-ipsum.pdf', 'png-5mb-1.png', 'Free_Test_Data_1MB_PDF.pdf', 'png-5mb-2.png']); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + let ppgbasmeUsername = Cypress.env('ppgbasme_username'); + let ppgbasmePassword = Cypress.env('ppgbasme_username'); + let securitysmeUsername = Cypress.env('securitysme_username'); + let securitysmePassword = Cypress.env('securitysme_password'); + let infrasmeUsername = Cypress.env('infrasme_username'); + let infrasmePassword = Cypress.env('infrasme_password'); + let legalsmeUsername = Cypress.env('legalsme_username'); + let legalsmePassword = Cypress.env('legalsme_password'); + + submitWithUser( + ppgbasmeUsername, + ppgbasmePassword, + processInstanceId, + null, + "approve" + ); + + submitWithUser( + securitysmeUsername, + securitysmePassword, + processInstanceId, + null, + "approve" + ); + + submitWithUser( + infrasmeUsername, + infrasmePassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + }); +}); + +//Software and Licenses Path - Without Files and with only mandatory fields +describe('Software and Licenses Path - Without Files and with only mandatory fields', () => { + + Cypress._.times(1, () => { + + //Everyone approves with CP + it('Everyone approves with CP', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('Need to buy a Software'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2024-11-25'); + //cy.get('#root_vendor').clear().type('Embassar'); + //cy.get('#root_payment_method').select('Reimbursement'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('op_src'); + cy.get('#root_0_item').clear().type('Open source software'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('USD'); + cy.get('#root_0_unit_price').type('550'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + //cy.get('.cds--text-area__wrapper').find('#root').type('For professionals working in the professional services, ‘consultant’ and advisor’ are often used and fall under common terminology. Consultancy.uk zooms in on this field to get a closer look. \n https://www.consultancy.uk/career/what-is-consulting'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + let ppgbasmeUsername = Cypress.env('ppgbasme_username'); + let ppgbasmePassword = Cypress.env('ppgbasme_username'); + let securitysmeUsername = Cypress.env('securitysme_username'); + let securitysmePassword = Cypress.env('securitysme_password'); + let infrasmeUsername = Cypress.env('infrasme_username'); + let infrasmePassword = Cypress.env('infrasme_password'); + let legalsmeUsername = Cypress.env('legalsme_username'); + let legalsmePassword = Cypress.env('legalsme_password'); + + submitWithUser( + ppgbasmeUsername, + ppgbasmePassword, + processInstanceId, + null, + "cpapproved" + ); + + submitWithUser( + legalsmeUsername, + legalsmePassword, + processInstanceId, + null, + "approve" + ); + + }); + }); + + //Everyone approves the request + it('Everyone approves', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('need software'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + //cy.get('#root_vendor').clear().type('Embassar'); + //cy.get('#root_payment_method').select('Reimbursement'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('op_src'); + cy.get('#root_0_item').clear().type('open source'); + cy.get('#root_0_qty').clear().type('1'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('AED'); + cy.get('#root_0_unit_price').type('1520'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + //cy.get('.cds--text-area__wrapper').find('#root').type('For professionals working in the professional services, ‘consultant’ and advisor’ are often used and fall under common terminology. Consultancy.uk zooms in on this field to get a closer look. \n https://www.consultancy.uk/career/what-is-consulting'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + let ppgbasmeUsername = Cypress.env('ppgbasme_username'); + let ppgbasmePassword = Cypress.env('ppgbasme_username'); + let securitysmeUsername = Cypress.env('securitysme_username'); + let securitysmePassword = Cypress.env('securitysme_password'); + let infrasmeUsername = Cypress.env('infrasme_username'); + let infrasmePassword = Cypress.env('infrasme_password'); + let legalsmeUsername = Cypress.env('legalsme_username'); + let legalsmePassword = Cypress.env('legalsme_password'); + + submitWithUser( + ppgbasmeUsername, + ppgbasmePassword, + processInstanceId, + null, + "approve" + ); + + submitWithUser( + securitysmeUsername, + securitysmePassword, + processInstanceId, + null, + "approve" + ); + + submitWithUser( + infrasmeUsername, + infrasmePassword, + processInstanceId, + 'Task: Update Application Landscape', + "approve" + ); + + submitWithUser( + legalsmeUsername, + legalsmePassword, + processInstanceId, + null, + "approve" + ); + + }); + }); + + //Budget owner rejects the request + it('Budget owner rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('Nee license'); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('2024-02-06'); + //cy.get('#root_vendor').clear().type('Subsc LTD'); + //cy.get('#root_payment_method').select('Bank Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('lic_and_sub'); + cy.get('#root_0_item').clear().type('Software development'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('EUR'); + cy.get('#root_0_unit_price').type('1400'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + //cy.get('.cds--text-area__wrapper').find('#root').type('For professionals working in the professional services, ‘consultant’ and advisor’ are often used and fall under common terminology. Consultancy.uk zooms in on this field to get a closer look. \n https://www.consultancy.uk/career/what-is-consulting'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + //Budget owner request for additional details + it('Budget owner need more info', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('Software needed'); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('2025-02-25'); + //cy.get('#root_vendor').clear().type('ABC Licensing Co'); + //cy.get('#root_payment_method').select('Crypto Transfer'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('lic_and_sub'); + cy.get('#root_0_item').clear().type('License'); + cy.get('#root_0_qty').clear().type('4'); + cy.get('#root_0_currency_type').select('Crypto'); + cy.get('#root_0_currency').select('SNT'); + cy.get('#root_0_unit_price').type('450'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + //cy.get('.cds--text-area__wrapper').find('#root').type('It\’s free and easy to post a job. Simply fill in a title, description and budget and competitive bids come within minutes. No job is too big or too small. We\'ve got freelancers for jobs of any size or budget across 1800 skills. No job is too complex.'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + "needmoreinfo" + ); + + //requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + "providemoreinfo" + ); + + //budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + let ppgbasmeUsername = Cypress.env('ppgbasme_username'); + let ppgbasmePassword = Cypress.env('ppgbasme_username'); + let legalsmeUsername = Cypress.env('legalsme_username'); + let legalsmePassword = Cypress.env('legalsme_password'); + + submitWithUser( + ppgbasmeUsername, + ppgbasmePassword, + processInstanceId, + null, + "cpapproved" + ); + + submitWithUser( + legalsmeUsername, + legalsmePassword, + processInstanceId, + null, + "approve" + ); + + + }); + }); + + //Infra reject the request + it('Infra rejects', () => { + let username = Cypress.env('requestor_username'); + let password = Cypress.env('requestor_password'); + cy.log('=====username : ' + username); + cy.log('=====password : ' + password); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Raise New Demand Request'); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Please select the type of request to start the process.'); + // wait a second to ensure we can click the radio button + + cy.wait(2000); + cy.get('input#root-procurement').click(); + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Submit a new demand request for the procurement of needed items', + { timeout: 60000 } + ); + + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + let projectId = Cypress.env('project_id'); + cy.get('#root_project').select(projectId); + cy.get('#root_category').select('soft_and_lic'); + cy.get('#root_purpose').clear().type('Software is needed'); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('2025-11-25'); + // cy.get('#root_vendor').clear().type('Embassar'); + // cy.get('#root_payment_method').select('Reimbursement'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('#root_0_sub_category').select('op_src'); + cy.get('#root_0_item').clear().type('Open source'); + cy.get('#root_0_qty').clear().type('2'); + cy.get('#root_0_currency_type').select('Fiat'); + cy.get('#root_0_currency').select('AUD'); + cy.get('#root_0_unit_price').type('2416'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Review and provide any supporting information or files for your request.', + { timeout: 60000 } + ); + + //cy.get('.cds--text-area__wrapper').find('#root').type('For professionals working in the professional services, ‘consultant’ and advisor’ are often used and fall under common terminology. Consultancy.uk zooms in on this field to get a closer look. \n https://www.consultancy.uk/career/what-is-consulting'); + + cy.contains('Submit the Request').click(); + + cy.get('input[value="Submit the Request"]').click(); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.contains('Tasks for my open instances', { timeout: 60000 }); + cy.logout(); + + let budgetOwnerUsername = Cypress.env('budgetowner_username'); + let budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log('=====budgetOwnerUsername : ' + budgetOwnerUsername); + cy.log('=====budgetOwnerPassword : ' + budgetOwnerPassword); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Request Additional Budget', + "approve" + ); + + let ppgbasmeUsername = Cypress.env('ppgbasme_username'); + let ppgbasmePassword = Cypress.env('ppgbasme_username'); + let securitysmeUsername = Cypress.env('securitysme_username'); + let securitysmePassword = Cypress.env('securitysme_password'); + let infrasmeUsername = Cypress.env('infrasme_username'); + let infrasmePassword = Cypress.env('infrasme_password'); + let legalsmeUsername = Cypress.env('legalsme_username'); + let legalsmePassword = Cypress.env('legalsme_password'); + + submitWithUser( + ppgbasmeUsername, + ppgbasmePassword, + processInstanceId, + null, + "approve" + ); + + submitWithUser( + securitysmeUsername, + securitysmePassword, + processInstanceId, + null, + "approve" + ); + + submitWithUser( + infrasmeUsername, + infrasmePassword, + processInstanceId, + null, + "reject" + ); + + }); + }); + + + }); +}); \ No newline at end of file