summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmichai Hemli <amichai.hemli@intl.att.com>2019-12-08 13:23:42 +0000
committerGerrit Code Review <gerrit@onap.org>2019-12-08 13:23:42 +0000
commit6d937099efa1cb30eb16470005c7e05c1f29f729 (patch)
tree05355028be9f8ef1c69e58fc639fb9c9a6cae923
parent408aad3b88e1eb11ec17243f2750ed0563262cb1 (diff)
parent77dd486269bb11f1e206114b87033a7dcc58c012 (diff)
Merge "Changing VNF platform to multiselect + cypress + API"
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java12
-rw-r--r--vid-automation/src/main/java/vid/automation/test/Constants.java1
-rw-r--r--vid-automation/src/main/java/vid/automation/test/infra/Get.java3
-rw-r--r--vid-automation/src/main/java/vid/automation/test/infra/SelectOption.java29
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java3
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java10
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts8
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts18
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/vnf.popup.e2e.ts2
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts5
-rw-r--r--vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json2
-rw-r--r--vid-webpack-master/cypress/support/steps/fill.vnf.popup.step.ts6
-rw-r--r--vid-webpack-master/cypress/support/steps/genericForm/genericFormAction.steps.ts19
-rw-r--r--vid-webpack-master/src/app/shared/components/formControls/component/multiselect/multiselect.formControl.component.ts6
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.spec.ts19
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts35
-rw-r--r--vid-webpack-master/src/app/shared/models/formControlModels/multiselectFormControl.model.ts2
17 files changed, 90 insertions, 90 deletions
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java
index b10636bf1..e834c15ac 100644
--- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java
+++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java
@@ -475,6 +475,18 @@ public final class GeneralUIUtils {
return element;
}
+ public static boolean isOptionSelectedInMultiSelect(String dataTestId, String option) {
+ GeneralUIUtils.ultimateWait();
+ List<WebElement> selectedElements = getDriver().findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']//span[@class='c-label']"));
+
+
+ for (WebElement selectedElement : selectedElements) {
+ if (selectedElement.getText().equals(option)) {
+ return true;
+ }
+ }
+ return false;
+ }
public static WebElement getSelectedElementFromDropDown(String dataTestId){
GeneralUIUtils.ultimateWait();;
WebElement selectedElement = new Select (getDriver().findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))).getFirstSelectedOption();
diff --git a/vid-automation/src/main/java/vid/automation/test/Constants.java b/vid-automation/src/main/java/vid/automation/test/Constants.java
index 66b8a9d25..7256f0a2e 100644
--- a/vid-automation/src/main/java/vid/automation/test/Constants.java
+++ b/vid-automation/src/main/java/vid/automation/test/Constants.java
@@ -506,6 +506,7 @@ public class Constants {
public static final String PROJECT_SELECT_TEST_ID = "project";
public static final String OWNING_ENTITY_SELECT_TEST_ID = "owningEntity";
public static final String PLATFORM_SELECT_TEST_ID = "platform";
+ public static final String PLATFORM_MULTI_SELECT_TEST_ID = "multi-selectPlatform";
public static final String LOB_SELECT_TEST_ID = "lineOfBusiness";
}
diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Get.java b/vid-automation/src/main/java/vid/automation/test/infra/Get.java
index 9bcad7b64..1e0c94844 100644
--- a/vid-automation/src/main/java/vid/automation/test/infra/Get.java
+++ b/vid-automation/src/main/java/vid/automation/test/infra/Get.java
@@ -97,6 +97,9 @@ public class Get {
return GeneralUIUtils.getSelectedElementFromDropDown(dataTestId).getText();
}
+ public static Boolean isOptionSelectedInMultiSelect(String dataTestId, String option) {
+ return GeneralUIUtils.isOptionSelectedInMultiSelect(dataTestId, option);
+ }
public static List<WebElement> byClass(String className) {
return GeneralUIUtils.getWebElementsListByContainsClassName(className);
diff --git a/vid-automation/src/main/java/vid/automation/test/infra/SelectOption.java b/vid-automation/src/main/java/vid/automation/test/infra/SelectOption.java
index cd766c5bf..096ff47d9 100644
--- a/vid-automation/src/main/java/vid/automation/test/infra/SelectOption.java
+++ b/vid-automation/src/main/java/vid/automation/test/infra/SelectOption.java
@@ -67,14 +67,29 @@ public class SelectOption {
}
public static void selectOptionsFromMultiselectById(String multiSelectId, List<String> options) {
- Click.byId(multiSelectId);
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
+ WebElement multiselectComponent = Get.byXpath("//*[@data-tests-id='" + multiSelectId +"']//div[contains(@class, 'c-btn')]");
+ if(multiselectComponent != null){
+ multiselectComponent.click();
+ try {
+ Thread.sleep(1000);
+ for(String option:options) {
+ String multiSelectOptionPath = "//label[@data-tests-id='" + multiSelectId + "-" + option + "']";
+ WebElement multiSelelctOption = Get.byXpath(multiSelectOptionPath);
+ if(multiSelelctOption != null){
+ multiSelelctOption.click();
+ }
+ }
+ multiselectComponent.click();
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
}
- for(String option:options) {
- Click.byClassAndVisibleText(Constants.MULTI_SELECT_UNSELECTED_CLASS, option);
+ }
+
+ public static void selectFirstOptionsFromMultiselect(String multiSelectId){
+ WebElement multiSelectOption = Get.byXpath("//*[@data-tests-id='" + multiSelectId +"']//label[contains(@class, 'multiSelectOption')]");
+ if(multiSelectOption != null){
+ SelectOption.selectOptionsFromMultiselectById(multiSelectId, ImmutableList.of(multiSelectOption.getText()));
}
}
}
diff --git a/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java b/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java
index a9378e6df..1bbf0e3fb 100644
--- a/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java
+++ b/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java
@@ -419,8 +419,7 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest {
browseASDCPage.clickConfirmButton();
GeneralUIUtils.findAndWaitByText("Missing data", 5);
-
- Click.onFirstSelectOptionById(Constants.OwningEntity.PLATFORM_SELECT_TEST_ID);
+ SelectOption.selectFirstTwoOptionsFromMultiselectById("multi-selectPlatform");
viewEditPage.clickConfirmButton();
assertSuccessfulVNFCreation();
diff --git a/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java b/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java
index 2a7c59f01..5a9dc2c01 100644
--- a/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java
+++ b/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java
@@ -1185,7 +1185,11 @@ public class NewServiceInstanceTest extends CreateInstanceDialogBaseTest {
assertSetButtonDisabled(VNF_SET_BUTTON_TEST_ID);
- browseASDCPage.selectPlatform("platform");
+ if(isNetwork){
+ browseASDCPage.selectPlatform("platform");
+ }else {
+ SelectOption.selectOptionsFromMultiselectById("multi-selectPlatform", ImmutableList.of("platform"));
+ }
browseASDCPage.selectLineOfBusiness("ONAP");
assertSetButtonEnabled(VNF_SET_BUTTON_TEST_ID);
@@ -1214,7 +1218,9 @@ public class NewServiceInstanceTest extends CreateInstanceDialogBaseTest {
assertThat(Get.selectedOptionText(Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID), startsWith("AAIAIC25"));
Assert.assertEquals(Get.selectedOptionText(Constants.ViewEdit.TENANT_SELECT_TESTS_ID), "USP-SIP-IC-24335-T-01");
Assert.assertEquals(Get.selectedOptionText(Constants.ViewEdit.LINE_OF_BUSINESS_SELECT_TESTS_ID), "ONAP");
- Assert.assertEquals(Get.selectedOptionText(Constants.OwningEntity.PLATFORM_SELECT_TEST_ID), "platform");
+
+ Assert.assertTrue(Get.isOptionSelectedInMultiSelect(Constants.OwningEntity.PLATFORM_MULTI_SELECT_TEST_ID, "platform"));
+
Click.byTestId(Constants.CANCEL_BUTTON_TEST_ID);
GeneralUIUtils.ultimateWait();
} else {
diff --git a/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts
index 14b4bdc14..1c91d02ca 100644
--- a/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts
@@ -137,7 +137,7 @@ describe('A la carte', function () {
cy.selectDropdownOptionByText('tenant', 'USP-SIP-IC-24335-T-01');
cy.selectDropdownOptionByText('lineOfBusiness', 'zzz1');
- cy.selelctPlatformValue(false, 'xxx1');
+ cy.selectPlatformValue('xxx1');
cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
@@ -145,7 +145,7 @@ describe('A la carte', function () {
cy.getElementByDataTestsId(vnfMenuBtnDataTestId).click({force: true}).then(() => {
cy.getElementByDataTestsId('context-menu-edit').click({force: true});
- cy.selelctPlatformValue(false, 'platform');
+ cy.selectPlatformValue('platform');
cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
cy.getReduxState().then((state) => {
@@ -196,7 +196,7 @@ describe('A la carte', function () {
cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
cy.getElementByDataTestsId("node-ExtVL 0-add-btn").click({force: true});
- cy.selelctPlatformValue(true, 'xxx1');
+ cy.selectDropdownOptionByText("platform", "xxx1");
cy.selectDropdownOptionByText("lcpRegion", "AAIAIC25");
cy.selectDropdownOptionByText("tenant", "USP-SIP-IC-24335-T-01");
cy.selectDropdownOptionByText("productFamily", "ERICA");
@@ -233,7 +233,7 @@ describe('A la carte', function () {
cy.selectDropdownOptionByText('lcpRegion', 'hvf6');
cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-STTest2');
cy.selectDropdownOptionByText('lineOfBusiness', 'zzz1');
- cy.selelctPlatformValue(true, 'xxx1');
+ cy.selectPlatformValue('xxx1');
cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
const vnfName = '2017-488_PASQUALE-vPE 0';
let vfModulesNames: Array<string> = [
diff --git a/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts
index db1c086c4..0049a427f 100644
--- a/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts
@@ -25,7 +25,7 @@ describe('Drawing board', function () {
cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').get('i').should('have.class', 'fa-plus-circle');
cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').click({force: true});
- cy.fillVnfPopup().then(() => {
+ cy.fillVnfPopup(true).then(() => {
cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').click({force: true});
cy.fillVnfPopup().then(() => {
cy.drawingBoardNumberOfExistingElementsShouldContains(2);
@@ -43,7 +43,7 @@ describe('Drawing board', function () {
cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').get('i').should('have.class', 'fa-plus-circle');
cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').click({force: true});
- cy.fillVnfPopup().then(() => {
+ cy.fillVnfPopup(true).then(() => {
cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').click({force: true});
cy.fillVnfPopup().then(() => {
cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').click({force: true});
@@ -61,7 +61,7 @@ describe('Drawing board', function () {
cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').get('i').should('have.class', 'fa-plus-circle')
.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').click({force: true});
- cy.fillVnfPopup().then(() => {
+ cy.fillVnfPopup(true).then(() => {
cy.drawingBoardTreeOpenContextMenuByElementDataTestId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0')
.drawingBoardTreeClickOnContextMenuOptionByName('Duplicate')
.get('.quantity-select option').should('have.length', 9)
@@ -325,7 +325,7 @@ describe('Drawing board', function () {
cy.selectDropdownOptionByText('lcpRegion', 'hvf6');
cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testalexandria');
cy.selectDropdownOptionByText('lineOfBusiness', 'ONAP');
- cy.selectDropdownOptionByText('platform', 'platform');
+ cy.selectPlatformValue('platform');
cy.genericFormSubmitForm();
cy.getElementByDataTestsId('node-afacccf6-397d-45d6-b5ae-94c39734b168-2017-388_PASQUALE-vPE 0').contains('<Automatically Assigned>');
@@ -345,8 +345,9 @@ describe('Drawing board', function () {
cy.selectDropdownOptionByText('productFamily', 'ERICA');
cy.selectDropdownOptionByText('lcpRegion', 'hvf6');
cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testalexandria');
- cy.selectDropdownOptionByText('lineOfBusiness', 'ONAP');
- cy.selectDropdownOptionByText('platform', 'platform');
+ cy.selectDropdownOptionByText('lineOfBusiness', 'ONAP')
+ cy.selectPlatformValue('platform');
+
cy.genericFormSubmitForm();
cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').contains(vnfModelName);
@@ -581,7 +582,8 @@ describe('Drawing board', function () {
"FLAG_NETWORK_TO_ASYNC_INSTANTIATION": false,
"FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS": true,
"FLAG_SERVICE_MODEL_CACHE": true,
- "FLAG_1906_COMPONENT_INFO" : false
+ "FLAG_1906_COMPONENT_INFO" : false,
+ "FLAG_2002_VNF_PLATFORM_MULTI_SELECT" : false,
},
"type": "[FLAGS] Update"
},
@@ -5600,9 +5602,11 @@ describe('Drawing board', function () {
"FLAG_SERVICE_MODEL_CACHE": true,
"FLAG_SHOW_ASSIGNMENTS": true,
"FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS": true,
+ "FLAG_DEFAULT_VNF": true,
"FLAG_A_LA_CARTE_AUDIT_INFO": true,
"FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST": true,
"FLAG_PRESENT_PROVIDER_NETWORKS_ASSOCIATIONS": true,
+ "FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE": false,
"FLAG_1902_NEW_VIEW_EDIT": false,
"FLAG_1810_IDENTIFY_SERVICE_FOR_NEW_UI": false,
"FLAG_1902_VNF_GROUPING": false,
diff --git a/vid-webpack-master/cypress/integration/iFrames/vnf.popup.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/vnf.popup.e2e.ts
index 5e85dce71..b1adff1e5 100644
--- a/vid-webpack-master/cypress/integration/iFrames/vnf.popup.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/vnf.popup.e2e.ts
@@ -81,7 +81,7 @@ describe('Vnf popup', function () {
cy.selectDropdownOptionByText('lcpRegion', 'hvf6');
cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-STTest2');
cy.selectDropdownOptionByText('lineOfBusiness', 'zzz1');
- cy.selectDropdownOptionByText('platform', 'xxx1');
+ cy.selectPlatformValue('xxx1');
})
});
diff --git a/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts
index a314424f3..d5b851ddc 100644
--- a/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts
@@ -52,10 +52,12 @@ describe('Delete vnf instance', function () {
res.instanceId = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
const vnf = res.vnfs['2017-488_PASQUALE-vPE 0'];
+
vnf.instanceId = "VNF_INSTANCE_ID";
vnf.vfModules['2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0']['2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot'].instanceId = "VF_MODULE_BASE_INSTANCE_ID";
vnf.vfModules['2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1']['2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1fshmc'].instanceId = "VF_MODULE_INSTANCE_ID";
+
jsonBuilderAndMock.basicJson(
res,
Cypress.config('baseUrl') + "/aai_get_service_instance_topology/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA/f8791436-8d55-4fde-b4d5-72dd2cf13cfb",
@@ -69,7 +71,7 @@ describe('Delete vnf instance', function () {
// add a vnf on update mode
cy.drawingBoardPressAddButtonByElementName('node-2017-388_PASQUALE-vPE 0').click({force: true});
cy.selectDropdownOptionByText('rollback', 'Rollback');
- cy.fillVnfPopup();
+ cy.fillVnfPopup(true);
// delete VNF
cy.drawingBoardTreeOpenContextMenuByElementDataTestId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0', 0)
@@ -83,6 +85,7 @@ describe('Delete vnf instance', function () {
cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json').then((expectedResult) => {
expectedResult.vnfs["2017-388_PASQUALE-vPE 0_1"].trackById = vnf.trackById;
+ expectedResult.vnfs["2017-388_PASQUALE-vPE 0_1"].platformName = 'platform,xxx1';
cy.deepCompare(expectedResult, xhr.request.body);
});
});
diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json
index 9afc1723f..c7412edfb 100644
--- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json
+++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json
@@ -17,7 +17,7 @@
"FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT": true,
"FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE": false,
"FLAG_1911_INSTANTIATION_ORDER_BUTTON_IN_ASYNC_ALACARTE": false,
- "FLAG_2002_VNF_PLATFORM_MULTI_SELECT" : false,
+ "FLAG_2002_VNF_PLATFORM_MULTI_SELECT" : true,
"FLAG_2002_VFM_UPGRADE_ADDITIONAL_OPTIONS": true,
"FLAG_2004_TEMP_BUTTON_TO_INSTANTIATION_STATUS_FILTER": true,
"FLAG_2004_INSTANTIATION_STATUS_FILTER": true,
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 41784daff..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,22 +1,15 @@
declare namespace Cypress {
interface Chainable {
genericFormSubmitForm: typeof genericFormSubmitForm
- selelctPlatformValue: typeof selelctPlatformValue
+ selectPlatformValue: typeof selectPlatformValue
}
}
-
-
-function selelctPlatformValue(isDropdown: boolean, selectOption: string){
- if (isDropdown) {
- cy.selectDropdownOptionByText('platform', selectOption);
- } else {
- cy.getElementByDataTestsId("multi-selectPlatform").get('.c-btn').click({force: true})
- .getElementByDataTestsId(`multi-selectPlatform-${selectOption}`).click()
- .getElementByDataTestsId("multi-selectPlatform").get('.c-btn').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});
}
@@ -26,4 +19,4 @@ function genericFormSubmitForm(): Chainable<any> {
Cypress.Commands.add('genericFormSubmitForm', genericFormSubmitForm);
-Cypress.Commands.add('selelctPlatformValue', selelctPlatformValue);
+Cypress.Commands.add('selectPlatformValue', selectPlatformValue);
diff --git a/vid-webpack-master/src/app/shared/components/formControls/component/multiselect/multiselect.formControl.component.ts b/vid-webpack-master/src/app/shared/components/formControls/component/multiselect/multiselect.formControl.component.ts
index 9b900dedf..26a55e9d2 100644
--- a/vid-webpack-master/src/app/shared/components/formControls/component/multiselect/multiselect.formControl.component.ts
+++ b/vid-webpack-master/src/app/shared/components/formControls/component/multiselect/multiselect.formControl.component.ts
@@ -19,8 +19,10 @@ export class MultiselectFormControlComponent implements OnChanges{
constructor(private _multiselectFormControlService : MultiselectFormControlService){
this.multiselectFormControlService = _multiselectFormControlService;
}
+
dropdownSettings = {
- singleSelection : false
+ singleSelection : false,
+ limitSelection : 1000
};
options : MultiSelectItem[];
@@ -36,10 +38,10 @@ export class MultiselectFormControlComponent implements OnChanges{
this.form.controls[this.data.controlName].setValue(this.selectedItems);
})
});
-
}
if (changes["data"] !== undefined && changes["data"].currentValue !== changes["data"].previousValue && changes["data"].firstChange) {
if (this.data.onInit) {
+ this.dropdownSettings.limitSelection = this.data.limitSelection;
this.data.onInit(this.data, this.form);
}
}
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.spec.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.spec.ts
index 9782f0ee3..28d49d51b 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.spec.ts
@@ -935,25 +935,8 @@ describe('VNF Control Generator', () => {
})().then(done).catch(done.fail));
-
- test('should call platform dropdown control', ()=>{
- spyOn(service, 'getPlatformDropdownControl');
-
- service.getPlatformControl(null, [], false);
-
- expect(service.getPlatformDropdownControl).toBeCalledWith(null, []);
- });
-
- test('should call platform multi select control', ()=>{
- spyOn(service, 'getPlatformMultiselectControl');
-
- service.getPlatformControl(null, [], true);
-
- expect(service.getPlatformMultiselectControl).toBeCalledWith(null, []);
- });
-
test('should generate platform multi select control', ()=>{
- const control = service.getPlatformMultiselectControl(null, []);
+ const control = service.getPlatformMultiselectControl(null, [],false);
expect(control.type).toEqual(FormControlType.MULTI_SELECT);
expect(control.controlName).toEqual('platformName');
expect(control.displayName).toEqual('Platform');
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts
index 55177aaac..ff0a525b5 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vnfGenerator/vnf.control.generator.ts
@@ -15,7 +15,6 @@ import {AppState} from "../../../../store/reducers";
import {FormGroup} from "@angular/forms";
import {DropdownFormControl} from "../../../../models/formControlModels/dropdownFormControl.model";
import {FormControlType} from "../../../../models/formControlModels/formControlTypes.enum";
-import {InputFormControl} from "../../../../models/formControlModels/inputFormControl.model";
import {Observable, of} from "rxjs";
import {SelectOption} from "../../../../models/selectOption";
import * as _ from 'lodash';
@@ -78,6 +77,7 @@ export class VnfControlGenerator {
const vnfInstance = this.getVnfInstance(serviceId, vnfStoreKey);
const vnfModel = new VNFModel(this.store.getState().service.serviceHierarchy[serviceId].vnfs[vnfName]);
let result: FormControlModel[] = [];
+ const flags = this.store.getState().global.flags;
if (!_.isNil(vnfModel)) {
result.push(this.getInstanceName(vnfInstance, serviceId, vnfName, vnfModel.isEcompGeneratedNaming));
@@ -85,7 +85,7 @@ export class VnfControlGenerator {
result.push(this.getLcpRegionControl(serviceId, vnfInstance, result));
result.push(this._basicControlGenerator.getLegacyRegion(vnfInstance));
result.push(this.getTenantControl(serviceId, vnfInstance, result));
- result.push(this.getPlatformControl(vnfInstance, result));
+ result.push(this.getPlatformMultiselectControl(vnfInstance, result, flags['FLAG_2002_VNF_PLATFORM_MULTI_SELECT']));
result.push(this.getLineOfBusinessControl(vnfInstance, result));
}
return result;
@@ -109,7 +109,7 @@ export class VnfControlGenerator {
result.push(this.getLcpRegionControl(serviceId, vnfInstance, result));
result.push(this._basicControlGenerator.getLegacyRegion(vnfInstance));
result.push(this.getTenantControl(serviceId, vnfInstance, result));
- result.push(this.getPlatformControl(vnfInstance, result, flags['FLAG_2002_VNF_PLATFORM_MULTI_SELECT']));
+ result.push(this.getPlatformMultiselectControl(vnfInstance, result, flags['FLAG_2002_VNF_PLATFORM_MULTI_SELECT']));
result.push(this.getLineOfBusinessControl(vnfInstance, result));
result.push(this.getRollbackOnFailureControl(vnfInstance, result));
}
@@ -144,25 +144,7 @@ export class VnfControlGenerator {
- getPlatformDropdownControl = (instance: any, controls: FormControlModel[]) : DropdownFormControl => {
- return new DropdownFormControl({
- type: FormControlType.DROPDOWN ,
- controlName: 'platformName',
- displayName: 'Platform',
- dataTestId: 'platform',
- selectedFieldName : null ,
- ngValue : null,
- placeHolder: 'Select Platform',
- isDisabled: false,
- name: "platform",
- value: instance ? instance.platformName : null,
- validations: [new ValidatorModel(ValidatorOptions.required, 'is required')],
- onInitSelectedField: ['platformList'],
- onInit: this._basicControlGenerator.getSubscribeInitResult.bind(null, this._aaiService.getCategoryParameters),
- });
- };
-
- getPlatformMultiselectControl = (instance: any, controls: FormControlModel[]) : MultiselectFormControl => {
+ getPlatformMultiselectControl = (instance: any, controls: FormControlModel[], isMultiSelected: boolean) : MultiselectFormControl => {
return new MultiselectFormControl({
type: FormControlType.MULTI_SELECT ,
controlName: 'platformName',
@@ -174,6 +156,7 @@ export class VnfControlGenerator {
isDisabled: false,
name: "platform",
value: instance ? instance.platformName : '',
+ limitSelection : isMultiSelected ? 1000 : 1,
validations: [new ValidatorModel(ValidatorOptions.required, 'is required')],
onInitSelectedField: ['platformList'],
onInit: this._basicControlGenerator.getSubscribeInitResult.bind(null, this._aaiService.getCategoryParameters),
@@ -189,14 +172,6 @@ export class VnfControlGenerator {
});
};
- getPlatformControl = (instance: any, controls: FormControlModel[], isMultiSelect?: boolean): MultiselectFormControl | DropdownFormControl => {
- const shouldGenerateDropdown = isMultiSelect === undefined || isMultiSelect === false;
- if(shouldGenerateDropdown){
- return this.getPlatformDropdownControl(instance, controls);
- }
- return this.getPlatformMultiselectControl(instance, controls);
- };
-
getTenantControl = (serviceId: string, instance: any, controls: FormControlModel[]): DropdownFormControl => {
const service = this.store.getState().service.serviceInstance[serviceId];
const globalCustomerId: string = service.globalSubscriberId;
diff --git a/vid-webpack-master/src/app/shared/models/formControlModels/multiselectFormControl.model.ts b/vid-webpack-master/src/app/shared/models/formControlModels/multiselectFormControl.model.ts
index 09fc1d250..f5db715ba 100644
--- a/vid-webpack-master/src/app/shared/models/formControlModels/multiselectFormControl.model.ts
+++ b/vid-webpack-master/src/app/shared/models/formControlModels/multiselectFormControl.model.ts
@@ -14,6 +14,7 @@ export class MultiselectFormControl extends FormControlModel{
settings: {};
onInitSelectedField?: string[];
convertOriginalDataToArray? : (values)=> void;
+ limitSelection?: number;
constructor(data) {
@@ -28,6 +29,7 @@ export class MultiselectFormControl extends FormControlModel{
this.settings = data.settings || {};
this.onInitSelectedField = data.onInitSelectedField ? data.onInitSelectedField : null;
this.convertOriginalDataToArray = data.convertOriginalDataToArray ? data.convertOriginalDataToArray : null
+ this.limitSelection = data.limitSelection ? data.limitSelection : 1000;
}
}