fix ui-ci tests 53/100853/2
authorYuli Shlosberg <ys9693@att.com>
Tue, 28 Jan 2020 13:41:44 +0000 (15:41 +0200)
committerOfir Sonsino <ofir.sonsino@intl.att.com>
Tue, 28 Jan 2020 14:48:15 +0000 (14:48 +0000)
Issue-ID: SDC-2730
Signed-off-by: Yuli Shlosberg <ys9693@att.com>
Change-Id: I45500daf397a523d450b30836dda188573de04a3

catalog-ui/src/app/ng2/components/modals/onboarding-modal/onboarding-modal.component.html
catalog-ui/src/app/ng2/services/onboarding.service.ts
catalog-ui/src/app/utils/component-factory.ts
ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftSideMenu.java
ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TopNavComponent.java
ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspCommitModal.java
ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspRepositoryModalComponent.java
ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java
ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java

index 6ba1f42..49ed984 100644 (file)
@@ -1,4 +1,4 @@
-<div class="onboarding-modal">
+<div data-tests-id="importVspTable" class="onboarding-modal">
     <div class="search-wrapper">
         <span class="sub-title-wrapper">
             <svg-icon class="info-button" 
index 0ec4875..51a7fc4 100644 (file)
@@ -116,7 +116,7 @@ export class OnboardingService {
         newMetadata.description = csar.description;
         newMetadata.selectedCategory = selectedCategory && selectedSubCategory ? selectedCategory.name + "_#_" + selectedSubCategory.name : '';
         newMetadata.filterTerm = newMetadata.name +  ' '  + newMetadata.description + ' ' + newMetadata.vendorName + ' ' + newMetadata.csarVersion;
-        newMetadata.resourceType = "VF";
+        newMetadata.resourceType = csar.resourceType;
         newMetadata.componentType = ComponentType.RESOURCE;
         newMetadata.tags = [];
         newMetadata.icon = DEFAULT_ICON;
index 889f6fb..d4e282f 100644 (file)
@@ -142,7 +142,7 @@ export class ComponentFactory {
         return newResource;
     };
 
-    public createEmptyComponent = (componentType:string):Component => {
+    public createEmptyComponent = (componentType:string, resourceType?:string):Component => {
         let newComponent:Component;
 
         switch (componentType) {
@@ -161,6 +161,9 @@ export class ComponentFactory {
             case ResourceType.CVFC:
             case ResourceType.CONFIGURATION:
                 newComponent = new Resource(this.ResourceService, this.$q);
+                if (resourceType){
+                    (<Resource> newComponent).resourceType = resourceType;
+                }
                 break;
         }
         newComponent.componentType = componentType;
index fd2f06a..ab080fe 100644 (file)
@@ -69,7 +69,7 @@ public class ResourceLeftSideMenu extends AbstractPageObject {
      */
     public enum XpathSelector {
         MAIN_DIV("w-sdc-left-sidebar", "//div[@class='%s']"),
-        PROPERTIES_ASSIGNMENT_MENU("Properties AssignmentLeftSideMenu", "//div[@data-tests-id='%s']/button");
+        PROPERTIES_ASSIGNMENT_MENU("Properties AssignmentLeftSideMenu", "//*[@data-tests-id='%s']");
 
         private final String id;
         private final String xpathFormat;
index acac74f..e1ca924 100644 (file)
@@ -86,6 +86,7 @@ public class TopNavComponent extends AbstractPageObject {
      */
     public VspRepositoryModalComponent clickOnRepositoryIcon() {
         wrappingElement.findElement(By.xpath(REPOSITORY_ICON.getXpath())).click();
+
         return new VspRepositoryModalComponent(webDriver);
     }
 
@@ -123,7 +124,7 @@ public class TopNavComponent extends AbstractPageObject {
         SUB_MENU_BUTTON_HOME("sub-menu-button-home", "//*[@data-tests-id='%s']"),
         ARROW_DROPDOWN("triangle-dropdown", "//li[contains(@class, '%s')]"),
         MAIN_MENU_ONBOARD_BTN("main-menu-button-onboard", "//a[@data-tests-id='%s']"),
-        REPOSITORY_ICON("repository-icon", "//div[@data-tests-id='%s']");
+        REPOSITORY_ICON("repository-icon", "//*[@data-tests-id='%s']");
 
         private final String id;
         private final String xpathFormat;
index 48082f9..27b0070 100644 (file)
@@ -19,6 +19,7 @@
 
 package org.openecomp.sdc.ci.tests.pages;
 
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
 import org.openqa.selenium.By;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
@@ -64,6 +65,7 @@ public class VspCommitModal extends AbstractPageObject {
     public void submit() {
         final WebElement commitAndSubmitBtn = wrappingElement.findElement(By.xpath(COMMIT_AND_SUBMIT_BTN.getXpath()));
         commitAndSubmitBtn.click();
+        GeneralUIUtils.ultimateWait();
         confirmSuccess();
     }
 
index f610074..e6bc40f 100644 (file)
@@ -72,7 +72,7 @@ public class VspRepositoryModalComponent extends AbstractPageObject {
         final List<WebElement> vspResultList =
             findSubElements(wrappingElement, By.className(RESULTS_CONTAINER_DIV.getId()));
         vspResultList.get(listPosition).click();
-        findSubElement(wrappingElement, By.xpath(IMPORT_VSP_BTN.getXpath())).click();
+        GeneralUIUtils.clickOnElementByTestId(IMPORT_VSP_BTN.getId());
         return new ResourceCreatePage(webDriver, new LoaderHelper(), new NotificationHelper());
     }
 
@@ -101,10 +101,10 @@ public class VspRepositoryModalComponent extends AbstractPageObject {
      * Enum that contains identifiers and xpath expressions to elements related to the enclosing page object.
      */
     public enum XpathSelector {
-        MODAL_DIV("modalOnboarding", "//div[@modal='%s']"),
-        SEARCH_TXT("onboarding-search", "//input[@data-tests-id='%s']"),
-        IMPORT_VSP_BTN("import-csar", "//span[@data-tests-id='%s']"),
-        RESULTS_CONTAINER_DIV("flex-container", "//div[contains(@class,'%s']");
+        MODAL_DIV("importVspTable", "//*[@data-tests-id='%s']"),
+        SEARCH_TXT("onboarding-search-input", "//input[@data-tests-id='%s']"),
+        IMPORT_VSP_BTN("import-csar", "//*[@data-tests-id='%s']"),
+        RESULTS_CONTAINER_DIV("datatable-body-cell-label", "//datatable-body[contains(@class,'%s']");
 
         private final String id;
         private final String xpathFormat;
index 57112dc..a021054 100644 (file)
@@ -63,7 +63,7 @@ public final class GeneralUIUtils {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(GeneralUIUtils.class);
 
-    private static final String TEST_ID_XPATH = "//*[@data-tests-id='%s']";
+    private static final String TEST_ID_XPATH = "//*[@data-test-id='%1$s' or @data-tests-id='%1$s']";
     private static final String TEST_ID_CHILD_XPATH = "//*[@data-tests-id='%s']//*";
     private static final String TEST_ID_ATTRIBUTE_NAME = "data-tests-id";
     private static final String COLOR_YELLOW_BORDER_4PX_SOLID_YELLOW = "color: yellow; border: 4px solid yellow;";
index 6bc08ec..020c416 100644 (file)
@@ -166,8 +166,6 @@ public class OnboardingUiUtils {
         DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.getVspId());
         File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir();
 
-        ExtentTestActions.log(Status.INFO, String.format("Searching for onboarded %s", vnfFile));
-        HomePage.showVspRepository();
         ExtentTestActions.log(Status.INFO, String.format("Going to import %s", vnfFile.substring(0, vnfFile.indexOf("."))));
         importVSP(createVendorSoftwareProduct);
 
@@ -205,9 +203,6 @@ public class OnboardingUiUtils {
                 artifactName = deploymentArtifact.getFileName().trim();
             }
 
-            if (heatEnvFilesFromCSAR.contains(artifactName + ".env")) {
-                artifactVersion = "2";
-            }
             ArtifactUIUtils.validateArtifactNameVersionType(artifactName, artifactVersion, deploymentArtifact.getType());
         }
     }