blob: a5319b80f088266e6ee858201f67a439c2a967bc [file] [log] [blame]
Ittay Stern6f900cc2018-08-29 17:01:32 +03001// add new command to the existing Cypress interface
2
3
4declare namespace Cypress {
5 interface Chainable {
6 fillVnfPopup: typeof FillVnfPopup,
7 duplicateVnf: typeof DuplicateVnf,
8 }
9}
10function FillVnfPopup(): Chainable<any> {
11 cy.selectDropdownOptionByText('productFamily', 'Emanuel');
12 cy.selectDropdownOptionByText('lcpRegion', 'hvf6');
13 cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-STTest2');
14 cy.selectDropdownOptionByText('lineOfBusiness', 'zzz1');
15 cy.selectDropdownOptionByText('platform', 'xxx1');
16 return cy.getElementByDataTestsId('form-set').click({force : true}).then((done)=>{
17 return done;
18 });
19}
20function DuplicateVnf( vnfNode: string, amountBefore: number): Chainable<any> {
21 return cy.getElementByDataTestsId(vnfNode).should('have.length', amountBefore)
22 .getElementByDataTestsId(vnfNode+"-menu-btn").click({force:true})
23 .getElementByDataTestsId('context-menu-duplicate').click({force : true})
24 .getTagElementContainsText('button','Duplicate').click({force:true})
25 .getElementByDataTestsId(vnfNode).should('have.length', amountBefore+1).then((done)=>{
26 return done;
27 });
28}
29Cypress.Commands.add('fillVnfPopup', FillVnfPopup);
30Cypress.Commands.add('duplicateVnf', DuplicateVnf);