Added some test cases for form validations
This commit is contained in:
parent
c5408bdaca
commit
d7a9eb237e
|
@ -847,6 +847,251 @@ describe.only('Initiate a Request - Without Files', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Form validation - Software and License - Without Files
|
||||||
|
describe('Form validation', () => {
|
||||||
|
|
||||||
|
//Special character check
|
||||||
|
it('Special character check', () => {
|
||||||
|
const username = Cypress.env('requestor_username');
|
||||||
|
const 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('Request Goods or Services').click();
|
||||||
|
|
||||||
|
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('Request Goods or Services', { 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);
|
||||||
|
const projectId = Cypress.env('project_id');
|
||||||
|
cy.wait(2000);
|
||||||
|
cy.get('#root_project').select(projectId);
|
||||||
|
cy.get('#root_category').select('soft_and_lic');
|
||||||
|
cy.get('#root_purpose')
|
||||||
|
.clear()
|
||||||
|
.type(
|
||||||
|
'Purpose is to test all the special characters work in the request. ~!@#$%^&*()_+`-= {}[]\ and ;\',./:"<>? end. | this text goes missing', { parseSpecialCharSequences: false }
|
||||||
|
);
|
||||||
|
//.type(
|
||||||
|
// 'Purpose is to test all the special characters work in the request. Test Special chars ~!@#$%^&*()_+`-= {}|[]\ and ;\',./:"<>? end.', { parseSpecialCharSequences: false }
|
||||||
|
//);
|
||||||
|
cy.get('#root_criticality').select('High');
|
||||||
|
cy.get('#root_period').clear().type('25-11-2025');
|
||||||
|
cy.get('body').click();
|
||||||
|
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_item_0_sub_category').select('op_src');
|
||||||
|
cy.get('#root_item_0_item_name')
|
||||||
|
.clear()
|
||||||
|
.type(
|
||||||
|
'Special char test ,./;\'[]\=-0987654321`~!@#$%^&*()_+{}:"<>? end.', { parseSpecialCharSequences: false }
|
||||||
|
);
|
||||||
|
//.type(
|
||||||
|
// 'Special char test ,./;\'[]\=-0987654321`~!@#$%^&*()_+{}|:"<>? end.', { parseSpecialCharSequences: false }
|
||||||
|
// );
|
||||||
|
cy.get('#root_item_0_qty').clear().type('2');
|
||||||
|
cy.get('#root_item_0_currency_type').select('Crypto');
|
||||||
|
cy.get('#root_item_0_currency').select('SNT');
|
||||||
|
cy.get('#root_item_0_unit_price').type('1915');
|
||||||
|
|
||||||
|
cy.get('#root_item > div:nth-child(3) > p > button').click();
|
||||||
|
|
||||||
|
// item 1
|
||||||
|
cy.get('#root_item_1_sub_category').select('lic_and_sub');
|
||||||
|
cy.get('#root_item_1_item_name')
|
||||||
|
.clear()
|
||||||
|
.type(
|
||||||
|
'Special char test 2 +_=)(*&^%$#@!~`?></.,":}{\][\';/., <a> {g} [a]end.', { parseSpecialCharSequences: false }
|
||||||
|
);
|
||||||
|
//.type(
|
||||||
|
// 'Special char test 2 +_=)(*&^%$#@!~`?></.,":}{|\][\';/., <a> {g} [a]end.', { parseSpecialCharSequences: false }
|
||||||
|
//);
|
||||||
|
cy.get('#root_item_1_qty').clear().type('1');
|
||||||
|
cy.get('#root_item_1_currency_type').select('Fiat');
|
||||||
|
cy.get('#root_item_1_currency').select('AED');
|
||||||
|
cy.get('#root_item_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(
|
||||||
|
'Test Special chars afs<sfsd>sfsfs,asfdf. sfsf? sfd/sfs f:sfsf " sfsdf; SDFfsd\' sfsdf{sfsfs} sfsdf[ sfsdf] fsfsfd\ sfsd sfsdf=S dfs+ sfd- sfsdf_ sfsfd (sfsd )sfsfsd * sf&sfsfs ^ sfs % sf $ ss# s@ sf! sfd` ss~ END.', { parseSpecialCharSequences: false }
|
||||||
|
);
|
||||||
|
//.type(
|
||||||
|
// 'Test Special chars afs<sfsd>sfsfs,asfdf. sfsf? sfd/sfs f:sfsf " sfsdf; SDFfsd\' sfsdf{sfsfs} sfsdf[ sfsdf] fsfsfd\ sfsd| sfsdf=S dfs+ sfd- sfsdf_ sfsfd (sfsd )sfsfsd * sf&sfsfs ^ sfs % sf $ ss# s@ sf! sfd` ss~ END.', { parseSpecialCharSequences: false }
|
||||||
|
//);
|
||||||
|
|
||||||
|
// cy.contains('Submit the Request').click();
|
||||||
|
|
||||||
|
// cy.get('input[value="Submit the Request"]').click();
|
||||||
|
|
||||||
|
cy.get('button')
|
||||||
|
.contains(/^Submit$/)
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.get('button')
|
||||||
|
.contains(/^Return to Home$/)
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.contains('Started by me', { timeout: 60000 });
|
||||||
|
cy.logout();
|
||||||
|
cy.wait(2000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//Check field max lengths
|
||||||
|
it.only('Check field max lengths', () => {
|
||||||
|
const username = Cypress.env('requestor_username');
|
||||||
|
const 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('Request Goods or Services').click();
|
||||||
|
|
||||||
|
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('Request Goods or Services', { 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);
|
||||||
|
const projectId = Cypress.env('project_id');
|
||||||
|
cy.wait(2000);
|
||||||
|
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. This is now more than 250 characters'
|
||||||
|
);
|
||||||
|
cy.get('#root_criticality').select('High');
|
||||||
|
cy.get('#root_period').clear().type('25-11-2025');
|
||||||
|
cy.get('body').click();
|
||||||
|
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_item_0_sub_category').select('op_src');
|
||||||
|
cy.get('#root_item_0_item_name')
|
||||||
|
.clear()
|
||||||
|
.type(
|
||||||
|
'Open source software is code that is designed to be publicly accessible anyone can see, modify, END. This is now more than 100 characters'
|
||||||
|
);
|
||||||
|
cy.get('#root_item_0_qty').clear().type('2');
|
||||||
|
cy.get('#root_item_0_currency_type').select('Crypto');
|
||||||
|
cy.get('#root_item_0_currency').select('SNT');
|
||||||
|
cy.get('#root_item_0_unit_price').type('1915');
|
||||||
|
|
||||||
|
cy.get('#root_item > div:nth-child(3) > p > button').click();
|
||||||
|
|
||||||
|
// item 1
|
||||||
|
cy.get('#root_item_1_sub_category').select('lic_and_sub');
|
||||||
|
cy.get('#root_item_1_item_name')
|
||||||
|
.clear()
|
||||||
|
.type(
|
||||||
|
'A software license is a document that provides legally binding guidelines for the use and distri END.'
|
||||||
|
);
|
||||||
|
cy.get('#root_item_1_qty').clear().type('1');
|
||||||
|
cy.get('#root_item_1_currency_type').select('Fiat');
|
||||||
|
cy.get('#root_item_1_currency').select('AED');
|
||||||
|
cy.get('#root_item_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(
|
||||||
|
'test 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.get('button')
|
||||||
|
.contains(/^Return to Home$/)
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.contains('Started by me', { timeout: 60000 });
|
||||||
|
cy.logout();
|
||||||
|
cy.wait(2000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
// Software and License - With Files
|
// Software and License - With Files
|
||||||
describe('Initiate a Request - With Files', () => {
|
describe('Initiate a Request - With Files', () => {
|
||||||
Cypress._.times(1, () => {
|
Cypress._.times(1, () => {
|
||||||
|
|
Loading…
Reference in New Issue