diff options
Diffstat (limited to 'ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationPage.java')
-rw-r--r-- | ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationPage.java | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationPage.java index ae01e9c207..12b5251e81 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationPage.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/VspValidationPage.java @@ -17,15 +17,15 @@ package org.openecomp.sdc.ci.tests.pages; import com.aventstack.extentreports.Status; +import java.io.File; +import java.util.List; +import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; - -import java.util.List; - -import static org.testng.AssertJUnit.assertTrue; +import org.testng.Assert; public class VspValidationPage extends GeneralPageElements { @@ -53,25 +53,44 @@ public class VspValidationPage extends GeneralPageElements { clickOnElementUsingTestId(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_PROCEED_TO_RESULTS_BUTTON); } + public static void loadVSPFile(String path, String filename) { + List<WebElement> checkboxes = + GeneralUIUtils.findElementsByXpath("//div[@class='validation-input-wrapper']//input"); + boolean hasValue = CollectionUtils.isNotEmpty(checkboxes); + if (hasValue) { + WebElement browseWebElement = checkboxes.get(0); + browseWebElement.sendKeys(path + File.separator + filename); + GeneralUIUtils.ultimateWait(); + } else { + Assert.fail("Did not find File input field in the page for loading VSP test file"); + } + + } public static boolean checkNextButtonDisabled() throws Exception { return GeneralUIUtils.isElementDisabled(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_PROCEED_TO_INPUTS_BUTTON.getValue()); } public static void clickCertificationQueryAll() throws Exception { List<WebElement> checkboxes = GeneralUIUtils.findElementsByXpath("//div[@data-test-id='vsp-validation-certifications-query-checkbox-tree']//label//span[@class='rct-checkbox']"); - if (checkboxes.size() > 0) { + if (!checkboxes.isEmpty()) { checkboxes.get(0).click(); } else { - assertTrue("Checkbox Not Found", checkboxes.size() > 0); + Assert.fail("Did not find certification test checkbox in the page"); } } public static void clickComplianceChecksAll() throws Exception { - List<WebElement> checkboxes = GeneralUIUtils.findElementsByXpath("//div[@data-test-id='vsp-validation-compliance-checks-checkbox-tree']//label//span[@class='rct-checkbox']"); - if (checkboxes.size() > 0) { + List<WebElement> vnfComplianceCheckboxes = GeneralUIUtils.findElementsByXpath("//div[@data-test-id='vsp-validation-compliance-checks-checkbox-tree']//span[@class='rct-text' and .//label//text()='vnf-compliance']//button"); + if (!vnfComplianceCheckboxes.isEmpty()) { + vnfComplianceCheckboxes.get(vnfComplianceCheckboxes.size() - 1).click(); + } else { + Assert.fail("Did not find vnf-compliance test checkbox in the page"); + } + List<WebElement> checkboxes = GeneralUIUtils.findElementsByXpath("//div[@data-test-id='vsp-validation-compliance-checks-checkbox-tree']//label//span[@class='rct-title' and text()='csar-validate']"); + if (!checkboxes.isEmpty()) { checkboxes.get(checkboxes.size() - 1).click(); } else { - assertTrue("Checkbox Not Found", checkboxes.size() > 0); + Assert.fail("Did not find csar-validate test Checkbox in the page"); } } @@ -79,14 +98,14 @@ public class VspValidationPage extends GeneralPageElements { WebElement parentDiv = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_CERTIFICATION_CHECKBOX_TREE.getValue()); List<WebElement> checkboxTreeDivs = getChildElements(parentDiv); List<WebElement> orderedList = getChildElements(checkboxTreeDivs.get(0)); - return (orderedList.size() > 0); + return (!orderedList.isEmpty()); } public static boolean checkComplianceCheckExists() throws Exception { WebElement parentDiv = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.VspValidationPage.VSP_VALIDATION_PAGE_COMPLIANCE_CHECKBOX_TREE.getValue()); List<WebElement> checkboxTreeDivs = getChildElements(parentDiv); List<WebElement> orderedList = getChildElements(checkboxTreeDivs.get(0)); - return (orderedList.size() > 0); + return (!orderedList.isEmpty()); } public static boolean checkSelectedComplianceCheckExists() throws Exception { |