From a5445100050e49e83f73424198d73cd72d672a4d Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Sun, 4 Mar 2018 14:53:33 +0200 Subject: Sync Integ to Master Change-Id: I71e3acc26fa612127756ac04073a522b9cc6cd74 Issue-ID: SDC-977 Signed-off-by: Gitelman, Tal (tg851x) --- .../sdc/ci/tests/pages/CompositionPage.java | 37 ++++++++-- .../sdc/ci/tests/pages/DeploymentArtifactPage.java | 9 ++- .../ci/tests/pages/PropertiesAssignmentPage.java | 83 +++++++++++++++++++--- 3 files changed, 110 insertions(+), 19 deletions(-) (limited to 'ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages') diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java index 264971e2d9..e9789ca850 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java @@ -20,8 +20,7 @@ package org.openecomp.sdc.ci.tests.pages; -import java.util.List; - +import com.aventstack.extentreports.Status; import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; @@ -32,8 +31,9 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.Select; +import org.testng.AssertJUnit; -import com.aventstack.extentreports.Status; +import java.util.List; public class CompositionPage extends GeneralPageElements { @@ -92,6 +92,10 @@ public class CompositionPage extends GeneralPageElements { } public static void changeComponentVersion(CanvasManager canvasManager, CanvasElement element, String version) { + changeComponentVersion(canvasManager,element,version,false); + } + + public static void changeComponentVersion(CanvasManager canvasManager, CanvasElement element, String version, boolean isValidate) { try{ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Changing component version to %s", version)); canvasManager.clickOnCanvaElement(element); @@ -105,6 +109,16 @@ public class CompositionPage extends GeneralPageElements { selectlist.selectByValue(version); GeneralUIUtils.ultimateWait(); GeneralUIUtils.clickSomewhereOnPage(); + + // Validate Selection + if(isValidate) + { + GeneralUIUtils.ultimateWait(); + canvasManager.clickOnCanvaElement(element); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating component version changed to %s", version)); + String actualSelectedValue = GeneralUIUtils.getWebElementBy(By.xpath(String.format("//select[@data-tests-id='%s']//option[@selected='selected']",DataTestIdEnum.CompositionScreenEnum.CHANGE_VERSION.getValue()))).getText(); + AssertJUnit.assertTrue(actualSelectedValue.equals(version)); + } } catch(Exception e){ throw e; @@ -117,7 +131,7 @@ public class CompositionPage extends GeneralPageElements { } public static String getSelectedInstanceName(){ - return GeneralUIUtils.getWebElementByTestID("selectedCompTitle").getText(); + return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionRightPanel.COMPONENT_TITLE.getValue()).getText(); } public static void showInformationArtifactTab() throws Exception { @@ -188,6 +202,21 @@ public class CompositionPage extends GeneralPageElements { return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue() +fileName); } + public static void setSingleProperty(String propertyDataTestID, String propertyValue) + { + WebElement findElement = GeneralUIUtils.getWebElementByTestID(propertyDataTestID); + findElement.click(); + PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(propertyValue); + PropertiesPage.getPropertyPopup().clickSave(); + GeneralUIUtils.ultimateWait(); + findElement = GeneralUIUtils.getWebElementByTestID("value_" + propertyDataTestID); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating property %s is set", propertyValue)); + AssertJUnit.assertTrue(findElement.getText().equals(propertyValue)); + GeneralUIUtils.ultimateWait(); + } + + + diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java index cc6f9b7c89..4230769692 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java @@ -20,10 +20,7 @@ package org.openecomp.sdc.ci.tests.pages; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - +import com.aventstack.extentreports.Status; import org.apache.commons.lang.WordUtils; import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; @@ -37,7 +34,9 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.testng.collections.Lists; -import com.aventstack.extentreports.Status; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; public class DeploymentArtifactPage extends GeneralPageElements { diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesAssignmentPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesAssignmentPage.java index cdf68da0dd..1dd67b1036 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesAssignmentPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesAssignmentPage.java @@ -1,6 +1,8 @@ package org.openecomp.sdc.ci.tests.pages; +import java.util.List; + import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.PropertiesAssignmentScreen; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; @@ -41,7 +43,7 @@ public class PropertiesAssignmentPage { } public static void findSearchBoxAndClick(String resourceName) throws Exception { - SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + resourceName + " in homepage"); + SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + resourceName + " in Properties"); WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesAssignmentScreen.SEARCH_BOX.getValue()); try{ searchTextbox.clear(); @@ -55,7 +57,7 @@ public class PropertiesAssignmentPage { try{ - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component from home screen", resourceName)); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component in Properties", resourceName)); GeneralUIUtils.clickOnElementByTestId(resourceName); GeneralUIUtils.ultimateWait(); GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()); @@ -84,15 +86,11 @@ public class PropertiesAssignmentPage { GeneralUIUtils.ultimateWait(); } - public static void clickOnFilterAll() { - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on property %s ")); - GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_CHECKBOX_ALL.getValue()); - GeneralUIUtils.ultimateWait(); - } + public static void clickOnComponentInComposition(String resourceName) throws Exception{ try{ - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component from properties composition", resourceName)); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component on Properties screen", resourceName)); GeneralUIUtils.clickOnElementByTestId(resourceName); GeneralUIUtils.ultimateWait(); GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()); @@ -104,7 +102,7 @@ public class PropertiesAssignmentPage { } public static void findInput(String componentName, String resourceName) throws Exception { - SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + componentName + "_" + resourceName + " in homepage"); + SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + componentName + "_" + resourceName + " on Inputs screen"); WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesAssignmentScreen.SEARCH_BOX.getValue()); String searchPattern = componentName + "_" + resourceName; try{ @@ -120,7 +118,7 @@ public class PropertiesAssignmentPage { } public static void findProperty(String resourceName) throws Exception { - SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + resourceName + " in homepage"); + SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + resourceName + " property on Properties screen"); WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesAssignmentScreen.SEARCH_BOX.getValue()); try{ @@ -146,4 +144,69 @@ public class PropertiesAssignmentPage { } + //Filter Actions + public static void clickOnFilterButton() { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Filter button ")); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_BUTTON.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnFilterAllCheckbox() { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Filter All Checkbox ")); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_CHECKBOX_ALL.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnFilterCPCheckbox() { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Filter CP Checkbox ")); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_CHECKBOX_CP.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnFilterVfcCheckbox() { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Filter VFC Checkbox ")); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_CHECKBOX_VFC.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnFilterVlCheckbox() { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Filter VL Checkbox ")); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_CHECKBOX_VL.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnFilterApplyButton(){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Filter Apply Button")); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_APPLY_BUTTON.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnFilterCloseButton(){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Filter Close Button")); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_CLOSE_BUTTON.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnFilterClearAllButton(){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Filter Clear All Button")); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.CLEAR_FILTER_BUTTON.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void findFilterBoxAndClick(String resourceName) throws Exception { + SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + resourceName + " property in Properties table"); + WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesAssignmentScreen.FILTER_BOX.getValue()); + try{ + searchTextbox.clear(); + searchTextbox.sendKeys(resourceName); + GeneralUIUtils.ultimateWait(); + } + catch(Exception e){ + SetupCDTest.getExtendTest().log(Status.INFO, "Can't interact with search bar"); + e.printStackTrace(); + } + + } + + } -- cgit 1.2.3-korg