diff options
author | aribeiro <anderson.ribeiro@est.tech> | 2021-09-10 16:38:30 +0100 |
---|---|---|
committer | aribeiro <anderson.ribeiro@est.tech> | 2021-09-15 16:33:24 +0100 |
commit | a92af8bcddeee515907c5f3770982c9906fa64d3 (patch) | |
tree | ff04a4f3c7448d169a3591cddf3e77cd6bf312e5 /integration-tests/src/test | |
parent | 04c0e1a91f9f4851047e4efe290bed8ed229c358 (diff) |
Integration test for importing VFC with model
Issue-ID: SDC-3724
Signed-off-by: aribeiro <anderson.ribeiro@est.tech>
Change-Id: If978ab3630eaca9bb84e7f51fb24bf448f0e0587
Diffstat (limited to 'integration-tests/src/test')
5 files changed, 54 insertions, 7 deletions
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ModelName.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ModelName.java index d5df5df198..4504849ae5 100644 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ModelName.java +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ModelName.java @@ -30,7 +30,8 @@ import lombok.Getter; @AllArgsConstructor @Getter public enum ModelName { - ETSI_SOL001_v2_5_1("ETSI SOL001 v2.5.1"); + ETSI_SOL001_v2_5_1("ETSI SOL001 v2.5.1"), + DEFAULT_MODEL_NAME("SDC AID"); private String name; } diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ResourceCreateData.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ResourceCreateData.java index ea63ead4f4..5cfa1407e1 100644 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ResourceCreateData.java +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/ResourceCreateData.java @@ -30,6 +30,7 @@ import lombok.Data; public class ResourceCreateData { private String name; + private String model; private String category; private List<String> tagList; private String description; diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java index b3538e32d1..fa02b4440b 100644 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java @@ -37,6 +37,7 @@ import org.onap.sdc.backend.ci.tests.datatypes.enums.ComponentType; import org.onap.sdc.backend.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.onap.sdc.backend.ci.tests.utils.general.ElementFactory; import org.onap.sdc.frontend.ci.tests.datatypes.ComponentData; +import org.onap.sdc.frontend.ci.tests.datatypes.ModelName; import org.onap.sdc.frontend.ci.tests.datatypes.ResourceCreateData; import org.onap.sdc.frontend.ci.tests.exception.UnzipException; import org.onap.sdc.frontend.ci.tests.execute.setup.DriverFactory; @@ -74,6 +75,7 @@ public class ImportVfcUiTest extends SetupCDTest { private ResourceCreateData vfcCreateData; private ResourceCreateData vfCreateData; private ComponentInstance createdComponentInstance; + private final String vfcCategory = ResourceCategoryEnum.NETWORK_L4.getSubCategory(); @BeforeClass public void beforeClass() { @@ -87,7 +89,7 @@ public class ImportVfcUiTest extends SetupCDTest { homePage = new HomePage(webDriver); // TC - Import VFC with root namespace String fileName = "org.openecomp.resource.VFC-root.yml"; - CreateVfcFlow createVfcFlow = createVFC(fileName); + CreateVfcFlow createVfcFlow = createVFC(fileName, ModelName.DEFAULT_MODEL_NAME.getName(), vfcCategory); componentPage = createVfcFlow.getLandedPage().orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage")); componentPage.isLoaded(); @@ -101,7 +103,7 @@ public class ImportVfcUiTest extends SetupCDTest { // TC - Import hierarchy of VFCs fileName = "org.openecomp.resource.VFC-child.yml"; - createVfcFlow = createVFC(fileName); + createVfcFlow = createVFC(fileName, ModelName.DEFAULT_MODEL_NAME.getName(), vfcCategory); componentPage = createVfcFlow.getLandedPage().orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage")); componentPage.isLoaded(); @@ -133,6 +135,17 @@ public class ImportVfcUiTest extends SetupCDTest { } + @Test + public void importVfcWithModel() { + final String fileName = "VFC-For-Model.yaml"; + final CreateVfcFlow createVfcFlow = createVFC(fileName, ModelName.ETSI_SOL001_v2_5_1.getName(), vfcCategory); + final ComponentPage componentPage = createVfcFlow.getLandedPage() + .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return ResourceCreatePage")); + componentPage.isLoaded(); + componentPage.certifyComponent(); + componentPage.isLoaded(); + } + private ComponentPage manageAttributes(final ComponentPage componentPage) { final AttributesPage attributesPage = componentPage.goToAttributes(); attributesPage.isLoaded(); @@ -266,8 +279,8 @@ public class ImportVfcUiTest extends SetupCDTest { return downloadCsarArtifactFlow; } - private CreateVfcFlow createVFC(final String fileName) { - vfcCreateData = createVfcFormData(); + private CreateVfcFlow createVFC(final String fileName, final String model, final String category) { + vfcCreateData = createVfcFormData(model, category); final CreateVfcFlow createVfcFlow = new CreateVfcFlow(webDriver, vfcCreateData, filePath + fileName); createVfcFlow.run(homePage); return createVfcFlow; @@ -280,10 +293,11 @@ public class ImportVfcUiTest extends SetupCDTest { return createVfFlow; } - private ResourceCreateData createVfcFormData() { + private ResourceCreateData createVfcFormData(final String model, final String category) { final ResourceCreateData vfcCreateData = new ResourceCreateData(); vfcCreateData.setRandomName(ElementFactory.getResourcePrefix() + "-VFC"); - vfcCreateData.setCategory(ResourceCategoryEnum.NETWORK_L4.getSubCategory()); + vfcCreateData.setModel(model); + vfcCreateData.setCategory(category); vfcCreateData.setTagList(Arrays.asList(vfcCreateData.getName(), "importVFC")); vfcCreateData.setDescription("aDescription"); vfcCreateData.setVendorName("Ericsson"); diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceCreatePage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceCreatePage.java index 196c560429..48a01f77be 100644 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceCreatePage.java +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceCreatePage.java @@ -54,12 +54,14 @@ public class ResourceCreatePage extends ComponentPage { public void isLoaded() { super.isLoaded(); waitForElementVisibility(By.xpath(XpathSelector.NAME_INPUT.getXpath())); + waitForElementVisibility(By.xpath(XpathSelector.MODEL_SELECT.getXpath())); waitForElementVisibility(By.xpath(XpathSelector.CATEGORY_SELECT.getXpath())); waitForElementVisibility(By.xpath(XpathSelector.DESCRIPTION_TEXT_AREA.getXpath())); } public void fillForm(final ResourceCreateData resourceCreateData) { fillName(resourceCreateData.getName()); + setModel(resourceCreateData.getModel()); setCategory(resourceCreateData.getCategory()); defineTags(resourceCreateData.getTagList()); fillDescription(resourceCreateData.getDescription()); @@ -82,6 +84,13 @@ public class ResourceCreatePage extends ComponentPage { return findElement(XpathSelector.NAME_INPUT.getXpath()).getText(); } + private void setModel(final String model) { + if (model == null) { + return; + } + setSelectField(By.xpath(XpathSelector.MODEL_SELECT.getXpath()), model); + } + private void setCategory(final String category) { setSelectField(By.xpath(XpathSelector.CATEGORY_SELECT.getXpath()), category); } @@ -135,6 +144,7 @@ public class ResourceCreatePage extends ComponentPage { @AllArgsConstructor private enum XpathSelector { NAME_INPUT("name", "//input[@data-tests-id='%s']"), + MODEL_SELECT("selectModelName", "//select[@data-tests-id='%s']"), CATEGORY_SELECT("selectGeneralCategory", "//select[@data-tests-id='%s']"), TAGS("i-sdc-tag-input", "//input[@data-tests-id='%s']"), DESCRIPTION_TEXT_AREA("description", "//textarea[@data-tests-id='%s']"), diff --git a/integration-tests/src/test/resources/Files/VFCs/VFC-For-Model.yaml b/integration-tests/src/test/resources/Files/VFCs/VFC-For-Model.yaml new file mode 100644 index 0000000000..8fba3929eb --- /dev/null +++ b/integration-tests/src/test/resources/Files/VFCs/VFC-For-Model.yaml @@ -0,0 +1,21 @@ +tosca_definitions_version: tosca_simple_yaml_1_3 + +node_types: + org.openecomp.resource.MyVfcForModelCI: + derived_from: tosca.nodes.Root + properties: + resourceType: + type: string + resourceSubtype: + type: string + required: false + attributes: + attr_1: + type: string + default: 'Integration Test' + attr_2: + type: integer + default: 2021 + attr_3: + type: boolean + default: true |