From ceb5ab575aa49f4d082fe1e52cc1a3f8ff3ffd24 Mon Sep 17 00:00:00 2001 From: Yuli Shlosberg Date: Tue, 28 Jan 2020 15:41:44 +0200 Subject: fix ui-ci tests Issue-ID: SDC-2730 Signed-off-by: Yuli Shlosberg Change-Id: I45500daf397a523d450b30836dda188573de04a3 --- .../org/openecomp/sdc/ci/tests/pages/ResourceLeftSideMenu.java | 2 +- .../java/org/openecomp/sdc/ci/tests/pages/TopNavComponent.java | 3 ++- .../java/org/openecomp/sdc/ci/tests/pages/VspCommitModal.java | 2 ++ .../sdc/ci/tests/pages/VspRepositoryModalComponent.java | 10 +++++----- .../org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java | 2 +- .../openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java | 5 ----- 6 files changed, 11 insertions(+), 13 deletions(-) (limited to 'ui-ci/src/main/java/org/openecomp') diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftSideMenu.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftSideMenu.java index fd2f06a9b7..ab080fe046 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftSideMenu.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftSideMenu.java @@ -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; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TopNavComponent.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TopNavComponent.java index acac74fbd2..e1ca924184 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TopNavComponent.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TopNavComponent.java @@ -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; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspCommitModal.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspCommitModal.java index 48082f959f..27b0070f7c 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspCommitModal.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspCommitModal.java @@ -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(); } diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspRepositoryModalComponent.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspRepositoryModalComponent.java index f610074a55..e6bc40f450 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspRepositoryModalComponent.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspRepositoryModalComponent.java @@ -72,7 +72,7 @@ public class VspRepositoryModalComponent extends AbstractPageObject { final List 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; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java index 57112dc594..a021054b0e 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java @@ -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;"; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java index 6bc08ec81e..020c41607a 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java @@ -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()); } } -- cgit 1.2.3-korg