diff options
Diffstat (limited to 'vid-webpack-master/cypress/support/steps')
4 files changed, 59 insertions, 9 deletions
diff --git a/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts b/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts index d2977832d..b87e773f9 100644 --- a/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts +++ b/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts @@ -1,10 +1,12 @@ declare namespace Cypress { interface Chainable { - fillVFModulePopup: typeof FillVFModulePopup + fillVFModulePopup: typeof fillVFModulePopup; + addALaCarteVfModule: typeof addALaCarteVfModule; + addMacroVfModule: typeof addMacroVfModule; } } -function FillVFModulePopup(vnfName: string, vfModuleName: string, instanceName: string, lcpRegion: string, tenant: string, rollback: boolean, sdncPreLoad: boolean): Chainable<any> { +function fillVFModulePopup(vnfName: string, vfModuleName: string, instanceName: string, lcpRegion: string, tenant: string, rollback: boolean, sdncPreLoad: boolean): Chainable<any> { cy.getElementByDataTestsId('node-' + vnfName).click({force: true}); cy.getElementByDataTestsId('node-' + vfModuleName + '-add-btn').click({force: true}); cy.getElementByDataTestsId('instanceName').last().type(instanceName, {force: true}); @@ -21,4 +23,40 @@ function FillVFModulePopup(vnfName: string, vfModuleName: string, instanceName: } -Cypress.Commands.add('fillVFModulePopup', FillVFModulePopup); +function addMacroVfModule(vnfName: string, vfModuleName: string, instanceName: string): Chainable<any> { + return cy.getElementByDataTestsId('node-' + vnfName).click({force: true}).then(() => { + cy.getElementByDataTestsId('node-' + vfModuleName + '-add-btn').click({force: true}).then(() => { + cy.getElementByDataTestsId('instanceName').clear().type(instanceName, {force: true}).then(() => { + cy.getElementByDataTestsId('form-set').click({force: true}); + }) + }) + }); +} + +function addALaCarteVfModule(vnfName: string, vfModuleName: string, instanceName: string, lcpRegion: string, legacyRegion: string, + tenant: string, rollback: boolean, sdncPreLoad: boolean, deleteVgName: boolean): Chainable<any> { + return cy.getElementByDataTestsId('node-' + vnfName).click({force: true}).then(() => { + cy.getElementByDataTestsId('node-' + vfModuleName + '-add-btn').click({force: true}).then(() => { + cy.getElementByDataTestsId('instanceName').clear().type(instanceName, {force: true}).then(() => { + if (deleteVgName) { + cy.getElementByDataTestsId('volumeGroupName').clear(); + } + }).then(() => { + cy.selectDropdownOptionByText('lcpRegion', lcpRegion); + if (legacyRegion) { + cy.typeToInput("lcpRegionText", legacyRegion); + } + cy.selectDropdownOptionByText('tenant', tenant); + cy.selectDropdownOptionByText('rollback', String(rollback)); + if (sdncPreLoad) { + cy.getElementByDataTestsId('sdncPreLoad').check(); + } + cy.getElementByDataTestsId('form-set').click({force: true}); + }); + }); + }); +} + +Cypress.Commands.add('fillVFModulePopup', fillVFModulePopup); +Cypress.Commands.add('addALaCarteVfModule', addALaCarteVfModule); +Cypress.Commands.add('addMacroVfModule', addMacroVfModule); diff --git a/vid-webpack-master/cypress/support/steps/fill.vnf.popup.step.ts b/vid-webpack-master/cypress/support/steps/fill.vnf.popup.step.ts index a5319b80f..3e91f7719 100644 --- a/vid-webpack-master/cypress/support/steps/fill.vnf.popup.step.ts +++ b/vid-webpack-master/cypress/support/steps/fill.vnf.popup.step.ts @@ -7,12 +7,14 @@ declare namespace Cypress { duplicateVnf: typeof DuplicateVnf, } } -function FillVnfPopup(): Chainable<any> { +function FillVnfPopup(changePlatformValue?: boolean): Chainable<any> { cy.selectDropdownOptionByText('productFamily', 'Emanuel'); cy.selectDropdownOptionByText('lcpRegion', 'hvf6'); cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-STTest2'); cy.selectDropdownOptionByText('lineOfBusiness', 'zzz1'); - cy.selectDropdownOptionByText('platform', 'xxx1'); + if(changePlatformValue === true){ + cy.selectPlatformValue('xxx1') + } return cy.getElementByDataTestsId('form-set').click({force : true}).then((done)=>{ return done; }); diff --git a/vid-webpack-master/cypress/support/steps/genericForm/genericFormAction.steps.ts b/vid-webpack-master/cypress/support/steps/genericForm/genericFormAction.steps.ts index 9786369cf..00a945711 100644 --- a/vid-webpack-master/cypress/support/steps/genericForm/genericFormAction.steps.ts +++ b/vid-webpack-master/cypress/support/steps/genericForm/genericFormAction.steps.ts @@ -1,12 +1,22 @@ declare namespace Cypress { interface Chainable { genericFormSubmitForm: typeof genericFormSubmitForm + selectPlatformValue: typeof selectPlatformValue } } -function genericFormSubmitForm() : Chainable<any> { - return cy.getElementByDataTestsId('form-set').click({force: true}); + +function selectPlatformValue(selectOption: string) { + cy.getElementByDataTestsId("multi-selectPlatform").get('.c-btn').click({force: true}); + cy.getElementByDataTestsId(`multi-selectPlatform-${selectOption}`).click(); + cy.getElementByDataTestsId("multi-selectPlatform").get('.c-btn').click({force: true}); +} + + +function genericFormSubmitForm(): Chainable<any> { + return cy.getElementByDataTestsId('form-set').click({force: true}); } Cypress.Commands.add('genericFormSubmitForm', genericFormSubmitForm); +Cypress.Commands.add('selectPlatformValue', selectPlatformValue); diff --git a/vid-webpack-master/cypress/support/steps/login.step.ts b/vid-webpack-master/cypress/support/steps/login.step.ts index a7ed0752e..99c80bcb7 100644 --- a/vid-webpack-master/cypress/support/steps/login.step.ts +++ b/vid-webpack-master/cypress/support/steps/login.step.ts @@ -34,8 +34,8 @@ function login(): void { } } -function openIframe(iframeUrl : string): void { - cy.visit(iframeUrl); +function openIframe(iframeUrl : string): Chainable<Window> { + return cy.visit(iframeUrl); } Cypress.Commands.add('login', login); |