From d03be99cba81d17bfb8681c18acf212eec9549ea Mon Sep 17 00:00:00 2001 From: KrupaNagabhushan Date: Fri, 10 Feb 2023 18:41:01 +0000 Subject: Provide input name when declaring service property as input Issue-ID: SDC-4385 Signed-off-by: KrupaNagabhushan Change-Id: I2b71e04b97ba69195380d2aa29d9d98a3bd5e981 --- .../tests/execute/sanity/ServiceTemplateDesignUiTests.java | 10 +++++----- .../ci/tests/pages/ResourcePropertiesAssignmentInputTab.java | 4 ++-- .../ci/tests/pages/ResourcePropertiesAssignmentPage.java | 4 ++-- .../ci/tests/pages/ResourcePropertiesAssignmentTab.java | 12 +++++++++++- 4 files changed, 20 insertions(+), 10 deletions(-) (limited to 'integration-tests') diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java index 7409588970..6652ada806 100644 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java @@ -485,9 +485,9 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest { private void declareInputToBaseService(ResourcePropertiesAssignmentPage propertiesAssignmentPage, String propertyName) { propertiesAssignmentPage.selectProperty(propertyName); - propertiesAssignmentPage.clickOnDeclareInput(); + propertiesAssignmentPage.clickOnDeclareInput("inputName1"); propertiesAssignmentPage.clickInputTab(propertyName); - propertiesAssignmentPage.isInputPresent(vfResourceCreateData.getName() + "_" + propertyName); + propertiesAssignmentPage.isInputPresent("inputName1"); } private void declareInputToInstanceProperties(ResourcePropertiesAssignmentPage propertiesAssignmentPage, String propertyName) { @@ -495,9 +495,9 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest { propertiesAssignmentPage.loadCompositionTab(); propertiesAssignmentPage.loadComponentInstanceProperties(vfcs.get(0).getName().concat(" 0")); propertiesAssignmentPage.selectProperty(propertyName); - propertiesAssignmentPage.clickOnDeclareInput(); + propertiesAssignmentPage.clickOnDeclareInput("inputName2"); propertiesAssignmentPage.clickInputTab(propertyName); - propertiesAssignmentPage.isInputPresent(vfResourceCreateData.getName() + "_" + vfcs.get(0).getName()); + propertiesAssignmentPage.isInputPresent("inputName2"); } private CreateVfFlow createVF() { @@ -815,7 +815,7 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest { final Map inputsTosca = getMapEntry(topologyTemplateTosca, "inputs"); assertThat(String.format("'%s' should contain a inputs entry", toscaYaml), inputsTosca, notNullValue()); assertEquals(2, inputsTosca.keySet().stream() - .filter(s -> (s.contains("resourceSubtype") || s.contains("property1"))).count()); + .filter(s -> (s.contains("inputName"))).count()); final Map substitutionMapping = getMapEntry(topologyTemplateTosca, "substitution_mappings"); assertThat(String.format("'%s' should contain a substitution_mappings entry", toscaYaml), substitutionMapping, notNullValue()); diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentInputTab.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentInputTab.java index b83be254ef..937740bc53 100644 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentInputTab.java +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentInputTab.java @@ -136,7 +136,7 @@ public class ResourcePropertiesAssignmentInputTab extends AbstractPageObject { public boolean isInputPresent(final String inputName) { isInputPropertiesTableLoaded(); try { - waitForElementVisibility(By.xpath(XpathSelector.INPUT_CHECKBOX.formatXpath(inputName)), 5); + waitForElementVisibility(By.xpath(XpathSelector.INPUT_TABLE.formatXpath(inputName)), 5); } catch (final Exception ignored) { return false; } @@ -151,7 +151,7 @@ public class ResourcePropertiesAssignmentInputTab extends AbstractPageObject { private enum XpathSelector { INPUT_TAB("//*[contains(@data-tests-id, 'Inputs') and contains(@class, 'active')]"), PROPERTIES_TABLE("//div[contains(@class,'properties-table')]"), - INPUT_CHECKBOX("//checkbox[@data-tests-id='%s']"), + INPUT_TABLE("//*[contains(@class, 'property-name') and text()='%s']"), NO_DATA_MESSAGE("//div[contains(@class,'no-data') and text()='No data to display']"), PROPERTY_SAVE_BTN("//button[@data-tests-id='properties-save-button']"), PROPERTY_SAVE_MESSAGE("//div[contains(text(), 'Successfully saved')]"), diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentPage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentPage.java index cb4345c7cc..83d4c3fba3 100644 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentPage.java +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentPage.java @@ -138,8 +138,8 @@ public class ResourcePropertiesAssignmentPage extends ComponentPage { resourcePropertiesAssignmentTab.loadComponentInstanceProperties(instanceName); } - public void clickOnDeclareInput(){ - resourcePropertiesAssignmentTab.clickOnDeclareInput(); + public void clickOnDeclareInput(final String inputName){ + resourcePropertiesAssignmentTab.clickOnDeclareInput(inputName); } public void loadCompositionTab(){ diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentTab.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentTab.java index 81ce7ffec1..2b3d2e0b86 100644 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentTab.java +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourcePropertiesAssignmentTab.java @@ -344,8 +344,16 @@ public class ResourcePropertiesAssignmentTab extends AbstractPageObject { waitToBeClickable(By.xpath(ResourcePropertiesAssignmentTab.XpathSelector.INSTANCE_SPAN.getXpath(instanceName))).click(); } - public void clickOnDeclareInput(){ + public void clickOnDeclareInput(final String inputName){ waitToBeClickable(By.xpath(ResourcePropertiesAssignmentTab.XpathSelector.DECLARE_INPUT_BTN.getXpath())).click(); + declareInputWithSetInputName(inputName); + } + + private void declareInputWithSetInputName(final String inputName) { + final By setInputNameLocator = By.xpath(XpathSelector.SET_INPUT_NAME_FIELD.getXpath()); + final WebElement inputNameField = waitForElementVisibility(setInputNameLocator, 5); + inputNameField.sendKeys(inputName); + waitToBeClickable(By.xpath(XpathSelector.INPUT_NAME_SAVE_BTN.getXpath())).click(); } public void loadCompositionTab(){ @@ -364,6 +372,7 @@ public class ResourcePropertiesAssignmentTab extends AbstractPageObject { SOFTWARE_VERSION_PROPERTY_CHECKBOX("software_versions", "//checkbox[@data-tests-id='%s']"), SOFTWARE_VERSION_INPUT("value-prop-software_versions", "//input[starts-with(@data-tests-id,'%s')]"), PROPERTY_CHECKBOX("//checkbox[@data-tests-id='%s']"), + SET_INPUT_NAME_FIELD("//*[@id=\"myText\"]"), PROPERTY_SAVE_BTN("properties-save-button", "//button[@data-tests-id='%s']"), PROPERTY_ADD_RIGHT_COLUMN_DIV("right-column", "//div[@class='%s']"), PROPERTY_ADD_BTN("add-btn", "//div[contains(@class,'%s')]"), @@ -376,6 +385,7 @@ public class ResourcePropertiesAssignmentTab extends AbstractPageObject { PROPERTY_TYPES("//*[contains(@data-tests-id, 'propertyType')]"), PROPERTY_NAMES("//*[contains(@data-tests-id, 'propertyName')]"), DECLARE_INPUT_BTN("declare-button declare-input", "//button[@data-tests-id='%s']"), + INPUT_NAME_SAVE_BTN("//button[@data-tests-id='Save']"), COMPOSITION_TAB("Composition", "//div[contains(@class,'tab') and contains(text(), '%s')]"), INSTANCE_SPAN("//span[@data-tests-id='%s']"); -- cgit 1.2.3-korg