summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/support/steps
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2018-08-29 17:01:32 +0300
committerIttay Stern <ittay.stern@att.com>2019-02-18 18:35:30 +0200
commit6f900cc45d7dd7f97430812b86b5c1d1693c8ae3 (patch)
tree936005c364dc5a7264d6304d4777c3d83494db22 /vid-webpack-master/cypress/support/steps
parent67d99f816cc583643c35193197594cf78d8ce60a (diff)
merge from ecomp a88f0072 - Modern UI
Issue-ID: VID-378 Change-Id: Ibcb23dd27f550cf32ce2fe0239f0f496ae014ff6 Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/cypress/support/steps')
-rw-r--r--vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardComponentInfo.steps.ts22
-rw-r--r--vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardModel.steps.ts17
-rw-r--r--vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardTree.steps.ts27
-rw-r--r--vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts33
-rw-r--r--vid-webpack-master/cypress/support/steps/fill.network.step.ts19
-rw-r--r--vid-webpack-master/cypress/support/steps/fill.service.popup.step.ts25
-rw-r--r--vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts24
-rw-r--r--vid-webpack-master/cypress/support/steps/fill.vnf.popup.step.ts30
-rw-r--r--vid-webpack-master/cypress/support/steps/general/clickOutside.step.ts14
-rw-r--r--vid-webpack-master/cypress/support/steps/general/compareDeepObjects.step.ts32
-rw-r--r--vid-webpack-master/cypress/support/steps/genericForm/checkPopover.step.ts14
-rw-r--r--vid-webpack-master/cypress/support/steps/genericForm/genericFormAction.steps.ts12
-rw-r--r--vid-webpack-master/cypress/support/steps/login.step.ts1
-rw-r--r--vid-webpack-master/cypress/support/steps/menu.step.ts19
-rw-r--r--vid-webpack-master/cypress/support/steps/openInstanceAuditInfoModal.step.ts18
15 files changed, 306 insertions, 1 deletions
diff --git a/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardComponentInfo.steps.ts b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardComponentInfo.steps.ts
new file mode 100644
index 000000000..2033f060c
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardComponentInfo.steps.ts
@@ -0,0 +1,22 @@
+declare namespace Cypress {
+ interface Chainable {
+ assertComponentInfoTitleLabelsAndValues: typeof assertComponentInfoTitleLabelsAndValues
+ }
+}
+
+
+
+function assertComponentInfoTitleLabelsAndValues(expectedTitle: string, labelsAndValues: string[][]) : void{
+ cy.getElementByDataTestsId('component-info-section-title').should('have.text', expectedTitle);
+ labelsAndValues.forEach((tuple: string[], index: number, array: string[][]) => {
+ let label = tuple[0];
+ let value = tuple[1];
+ cy.getElementByDataTestsId('model-item-label-' + label).should('have.text', label);
+ cy.getElementByDataTestsId('model-item-value-' + label).should('have.text', value);
+ });
+}
+
+
+
+
+Cypress.Commands.add('assertComponentInfoTitleLabelsAndValues', assertComponentInfoTitleLabelsAndValues);
diff --git a/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardModel.steps.ts b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardModel.steps.ts
new file mode 100644
index 000000000..b2b48b268
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardModel.steps.ts
@@ -0,0 +1,17 @@
+declare namespace Cypress {
+ interface Chainable {
+ drawingBoardPressAddButtonByElementName: typeof drawingBoardPressAddButtonByElementName,
+ drawingBoardNumberOfExistingElementsShouldContains: typeof drawingBoardNumberOfExistingElementsShouldContains
+ }
+}
+
+function drawingBoardPressAddButtonByElementName(elementName : string) : Chainable<any> {
+ return cy.getElementByDataTestsId(elementName + '-add-btn');
+}
+
+function drawingBoardNumberOfExistingElementsShouldContains(expectedElements : number) : void {
+ cy.getElementByDataTestsId('numberButton').contains(expectedElements);
+}
+
+Cypress.Commands.add('drawingBoardPressAddButtonByElementName', drawingBoardPressAddButtonByElementName);
+Cypress.Commands.add('drawingBoardNumberOfExistingElementsShouldContains', drawingBoardNumberOfExistingElementsShouldContains);
diff --git a/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardTree.steps.ts b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardTree.steps.ts
new file mode 100644
index 000000000..0150b44aa
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardTree.steps.ts
@@ -0,0 +1,27 @@
+declare namespace Cypress {
+ interface Chainable {
+ drawingBoardTreeOpenContextMenuByElementDataTestId: typeof drawingBoardTreeOpenContextMenuByElementDataTestId,
+ drawingBoardTreeClickOnContextMenuOptionByName: typeof drawingBoardTreeClickOnContextMenuOptionByName
+ }
+}
+
+function drawingBoardTreeOpenContextMenuByElementDataTestId(dataTestId : string, index ?: number) : Chainable<any> {
+ return cy.getElementByDataTestsId(dataTestId + "-menu-btn").eq(index != null ? index : 0).click({force: true});
+}
+
+function drawingBoardTreeClickOnContextMenuOptionByName(optionName : string) : Chainable<any> {
+ switch (optionName) {
+ case 'Duplicate':
+ return cy.getElementByDataTestsId('context-menu-duplicate').click({force : true});
+ case 'Remove':
+ return cy.getElementByDataTestsId('context-menu-remove').click({force : true});
+ case 'Edit':
+ return cy.getElementByDataTestsId('context-menu-edit').click({force : true});
+ default:
+ return cy.getElementByDataTestsId('context-menu-duplicate').click({force : true});
+ }
+}
+
+
+Cypress.Commands.add('drawingBoardTreeOpenContextMenuByElementDataTestId', drawingBoardTreeOpenContextMenuByElementDataTestId);
+Cypress.Commands.add('drawingBoardTreeClickOnContextMenuOptionByName', drawingBoardTreeClickOnContextMenuOptionByName);
diff --git a/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts b/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts
new file mode 100644
index 000000000..5444971b7
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts
@@ -0,0 +1,33 @@
+declare namespace Cypress {
+ interface Chainable {
+ updateServiceShouldNotOverrideChild: typeof updateServiceShouldNotOverrideChild
+ openServiceContextMenu: typeof openServiceContextMenu
+ }
+}
+
+function updateServiceShouldNotOverrideChild() : void {
+ cy.getElementByDataTestsId('drawing-board-tree').find('.node-content-wrapper').then((elements)=>{
+ let numberOfExistingElements = elements.length;
+ cy.openServiceContextMenu().then(() =>{
+ cy.getElementByDataTestsId('context-menu-header-edit-item').click({force : true}).then(()=>{
+ cy.genericFormSubmitForm().then(()=>{
+ cy.getElementByDataTestsId('drawing-board-tree').find('.node-content-wrapper').then((afterUpdateServiceElements)=>{
+ chai.expect(numberOfExistingElements).equal(afterUpdateServiceElements.length);
+ });
+ });
+ });
+ });
+ });
+
+}
+
+
+function openServiceContextMenu() : Chainable<any> {
+ return cy.getElementByDataTestsId('openMenuBtn').click({force: true});
+}
+
+
+
+
+Cypress.Commands.add('updateServiceShouldNotOverrideChild', updateServiceShouldNotOverrideChild);
+Cypress.Commands.add('openServiceContextMenu', openServiceContextMenu);
diff --git a/vid-webpack-master/cypress/support/steps/fill.network.step.ts b/vid-webpack-master/cypress/support/steps/fill.network.step.ts
new file mode 100644
index 000000000..c981ac4b2
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/fill.network.step.ts
@@ -0,0 +1,19 @@
+// add new command to the existing Cypress interface
+declare namespace Cypress {
+ interface Chainable {
+ fillNetworkPopup: typeof fillNetworkPopup,
+ }
+}
+
+function fillNetworkPopup(): 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');
+ return cy.getElementByDataTestsId('form-set').click({force : true}).then((done)=>{
+ return done;
+ });
+}
+
+Cypress.Commands.add('fillNetworkPopup', fillNetworkPopup);
diff --git a/vid-webpack-master/cypress/support/steps/fill.service.popup.step.ts b/vid-webpack-master/cypress/support/steps/fill.service.popup.step.ts
new file mode 100644
index 000000000..4595d89fc
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/fill.service.popup.step.ts
@@ -0,0 +1,25 @@
+
+declare namespace Cypress {
+ interface Chainable {
+ fillServicePopup: typeof FillServicePopup
+ }
+}
+
+function FillServicePopup(): Chainable<any> {
+ cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true');
+ cy.selectDropdownOptionByText('subscriberName', 'SILVIA ROBBINS');
+ cy.selectDropdownOptionByText('serviceType', 'TYLER SILVIA');
+ cy.selectDropdownOptionByText('productFamily', 'TYLER SILVIA');
+ cy.selectDropdownOptionByText('lcpRegion', 'hvf6');
+ cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testalexandria');
+ cy.selectDropdownOptionByText('aic_zone', 'NFTJSSSS-NFT1');
+ cy.selectDropdownOptionByText('project', 'WATKINS');
+ cy.selectDropdownOptionByText('owningEntity', 'aaa1');
+ cy.selectDropdownOptionByText('rollback', 'Rollback');
+ return cy.getElementByDataTestsId('form-set').click({force : true}).then((done)=>{
+ return done;
+ });
+
+}
+
+Cypress.Commands.add('fillServicePopup', FillServicePopup);
diff --git a/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts b/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts
new file mode 100644
index 000000000..d2977832d
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts
@@ -0,0 +1,24 @@
+declare namespace Cypress {
+ interface Chainable {
+ fillVFModulePopup: typeof FillVFModulePopup
+ }
+}
+
+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});
+ cy.getElementByDataTestsId('lcpRegion').last().select(lcpRegion);
+ cy.getElementByDataTestsId('tenant').last().select(tenant);
+ cy.getElementByDataTestsId('lcpRegion').last().select(lcpRegion);
+ cy.getElementByDataTestsId('rollback').last().select(String(rollback));
+ if (sdncPreLoad) {
+ cy.getElementByDataTestsId('sdncPreLoad').last().check();
+ }
+ return cy.getElementByDataTestsId('form-set').last().click({force: true}).then((done) => {
+ return done;
+ });
+
+}
+
+Cypress.Commands.add('fillVFModulePopup', FillVFModulePopup);
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
new file mode 100644
index 000000000..a5319b80f
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/fill.vnf.popup.step.ts
@@ -0,0 +1,30 @@
+// add new command to the existing Cypress interface
+
+
+declare namespace Cypress {
+ interface Chainable {
+ fillVnfPopup: typeof FillVnfPopup,
+ duplicateVnf: typeof DuplicateVnf,
+ }
+}
+function FillVnfPopup(): 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');
+ return cy.getElementByDataTestsId('form-set').click({force : true}).then((done)=>{
+ return done;
+ });
+}
+function DuplicateVnf( vnfNode: string, amountBefore: number): Chainable<any> {
+ return cy.getElementByDataTestsId(vnfNode).should('have.length', amountBefore)
+ .getElementByDataTestsId(vnfNode+"-menu-btn").click({force:true})
+ .getElementByDataTestsId('context-menu-duplicate').click({force : true})
+ .getTagElementContainsText('button','Duplicate').click({force:true})
+ .getElementByDataTestsId(vnfNode).should('have.length', amountBefore+1).then((done)=>{
+ return done;
+ });
+}
+Cypress.Commands.add('fillVnfPopup', FillVnfPopup);
+Cypress.Commands.add('duplicateVnf', DuplicateVnf);
diff --git a/vid-webpack-master/cypress/support/steps/general/clickOutside.step.ts b/vid-webpack-master/cypress/support/steps/general/clickOutside.step.ts
new file mode 100644
index 000000000..e3323a125
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/general/clickOutside.step.ts
@@ -0,0 +1,14 @@
+declare namespace Cypress {
+ interface Chainable {
+ clickOutside: typeof clickOutside,
+ }
+}
+
+function clickOutside(testByIdClickElement : string, testBeforeClickOutside : Function, testAfterClickOutside : Function) {
+ testBeforeClickOutside();
+ cy.getElementByDataTestsId(testByIdClickElement).click({force: true}).then(()=>{
+ testAfterClickOutside();
+ });
+}
+
+Cypress.Commands.add('clickOutside', clickOutside);
diff --git a/vid-webpack-master/cypress/support/steps/general/compareDeepObjects.step.ts b/vid-webpack-master/cypress/support/steps/general/compareDeepObjects.step.ts
new file mode 100644
index 000000000..ee5e95a3a
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/general/compareDeepObjects.step.ts
@@ -0,0 +1,32 @@
+const { _ } = Cypress;
+
+declare namespace Cypress {
+ interface Chainable {
+ deepCompare: typeof deepCompare,
+ }
+}
+
+function deepCompare(actual : any, expected : any) {
+ if(actual !== null && expected !== null){
+ let diff : any[] = [];
+ Cypress._.mergeWith(actual, expected, function (objectValue, sourceValue, key, object, source) {
+ if ( !(_.isEqual(objectValue, sourceValue)) && (Object(objectValue) !== objectValue)) {
+ diff.push("key: " +key + ", expected: " + sourceValue + ", actual: " + objectValue);
+ }
+ });
+
+ Cypress._.mergeWith(expected, actual, function (objectValue, sourceValue, key, object, source) {
+ if ( !(_.isEqual(objectValue, sourceValue)) && (Object(objectValue) !== objectValue)) {
+ diff.push("key: " +key + ", expected: " + sourceValue + ", actual: " + objectValue);
+ }
+ });
+
+ if(diff.length > 0){
+ console.error("diff", diff);
+ cy.log("The object are not equals", diff);
+ expect(actual).equals(expected);
+ }
+ }
+}
+
+Cypress.Commands.add('deepCompare', deepCompare);
diff --git a/vid-webpack-master/cypress/support/steps/genericForm/checkPopover.step.ts b/vid-webpack-master/cypress/support/steps/genericForm/checkPopover.step.ts
new file mode 100644
index 000000000..085410ece
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/genericForm/checkPopover.step.ts
@@ -0,0 +1,14 @@
+declare namespace Cypress {
+ interface Chainable {
+ checkPopoverContentOnMouseEvent: typeof checkPopoverContentOnMouseEvent
+ }
+}
+
+function checkPopoverContentOnMouseEvent(dataTestId: string, klass: string, mouseEvent: string, index: number) : Chainable<any> {
+ index = index || 0;
+ let element = cy.getElementByDataTestsId(dataTestId).eq(index);
+ element.trigger(mouseEvent).click().get(klass);
+ return element;
+}
+
+Cypress.Commands.add('checkPopoverContentOnMouseEvent', checkPopoverContentOnMouseEvent);
diff --git a/vid-webpack-master/cypress/support/steps/genericForm/genericFormAction.steps.ts b/vid-webpack-master/cypress/support/steps/genericForm/genericFormAction.steps.ts
new file mode 100644
index 000000000..9786369cf
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/genericForm/genericFormAction.steps.ts
@@ -0,0 +1,12 @@
+declare namespace Cypress {
+ interface Chainable {
+ genericFormSubmitForm: typeof genericFormSubmitForm
+ }
+}
+
+function genericFormSubmitForm() : Chainable<any> {
+ return cy.getElementByDataTestsId('form-set').click({force: true});
+}
+
+
+Cypress.Commands.add('genericFormSubmitForm', genericFormSubmitForm);
diff --git a/vid-webpack-master/cypress/support/steps/login.step.ts b/vid-webpack-master/cypress/support/steps/login.step.ts
index f35e6e6b8..a7ed0752e 100644
--- a/vid-webpack-master/cypress/support/steps/login.step.ts
+++ b/vid-webpack-master/cypress/support/steps/login.step.ts
@@ -32,7 +32,6 @@ function login(): void {
currentLoginCookies = res;
});
}
-
}
function openIframe(iframeUrl : string): void {
diff --git a/vid-webpack-master/cypress/support/steps/menu.step.ts b/vid-webpack-master/cypress/support/steps/menu.step.ts
new file mode 100644
index 000000000..a0bfdb6b3
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/menu.step.ts
@@ -0,0 +1,19 @@
+declare namespace Cypress {
+ interface Chainable {
+ assertMenuItemsForNode: typeof assertMenuItemsForNode
+ }
+}
+ function assertMenuItemsForNode(enabledActions: string[], nodeName: string, index: number = 0) : Chainable<any> {
+ let node = cy.getElementByDataTestsId(nodeName).eq(+index);
+ node.trigger('mouseover').click().then(()=> {
+
+ //waiting to the menu to appear to catch options that shall not exist but actually exist
+ cy.get('.ngx-contextmenu').should('exist').then(()=> {
+ for (let option of ['duplicate', 'showAuditInfo', 'addGroupMember', 'delete', 'undoDelete', 'remove', ...enabledActions]) {
+ cy.getElementByDataTestsId(`context-menu-${option}`).should(enabledActions.some(s => s === option) ? 'exist' : 'not.exist');
+ }});
+ });
+ return node;
+}
+
+Cypress.Commands.add('assertMenuItemsForNode', assertMenuItemsForNode);
diff --git a/vid-webpack-master/cypress/support/steps/openInstanceAuditInfoModal.step.ts b/vid-webpack-master/cypress/support/steps/openInstanceAuditInfoModal.step.ts
new file mode 100644
index 000000000..7fc50c111
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/openInstanceAuditInfoModal.step.ts
@@ -0,0 +1,18 @@
+declare namespace Cypress {
+ interface Chainable {
+ openInstanceAuditInfoModal: typeof openInstanceAuditInfoModal,
+ }
+}
+
+function openInstanceAuditInfoModal(iconTextId: string): void {
+ cy.getElementByDataTestsId(iconTextId).click({force: true})
+ .getElementByDataTestsId('context-menu-showAuditInfo').click({force : true})
+ .getElementByDataTestsId('audit-info-title').contains('Instantiation Information');
+ cy.get('.table-title').contains('MSO status');
+ cy.get('#cancelButton').click({force: true})
+
+}
+
+
+Cypress.Commands.add('openInstanceAuditInfoModal', openInstanceAuditInfoModal);
+