diff options
Diffstat (limited to 'vid-automation/src')
6 files changed, 47 insertions, 11 deletions
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java index b10636bf1..e834c15ac 100644 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java +++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java @@ -475,6 +475,18 @@ public final class GeneralUIUtils { return element; } + public static boolean isOptionSelectedInMultiSelect(String dataTestId, String option) { + GeneralUIUtils.ultimateWait(); + List<WebElement> selectedElements = getDriver().findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']//span[@class='c-label']")); + + + for (WebElement selectedElement : selectedElements) { + if (selectedElement.getText().equals(option)) { + return true; + } + } + return false; + } public static WebElement getSelectedElementFromDropDown(String dataTestId){ GeneralUIUtils.ultimateWait();; WebElement selectedElement = new Select (getDriver().findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))).getFirstSelectedOption(); diff --git a/vid-automation/src/main/java/vid/automation/test/Constants.java b/vid-automation/src/main/java/vid/automation/test/Constants.java index 66b8a9d25..7256f0a2e 100644 --- a/vid-automation/src/main/java/vid/automation/test/Constants.java +++ b/vid-automation/src/main/java/vid/automation/test/Constants.java @@ -506,6 +506,7 @@ public class Constants { public static final String PROJECT_SELECT_TEST_ID = "project"; public static final String OWNING_ENTITY_SELECT_TEST_ID = "owningEntity"; public static final String PLATFORM_SELECT_TEST_ID = "platform"; + public static final String PLATFORM_MULTI_SELECT_TEST_ID = "multi-selectPlatform"; public static final String LOB_SELECT_TEST_ID = "lineOfBusiness"; } diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Get.java b/vid-automation/src/main/java/vid/automation/test/infra/Get.java index 9bcad7b64..1e0c94844 100644 --- a/vid-automation/src/main/java/vid/automation/test/infra/Get.java +++ b/vid-automation/src/main/java/vid/automation/test/infra/Get.java @@ -97,6 +97,9 @@ public class Get { return GeneralUIUtils.getSelectedElementFromDropDown(dataTestId).getText(); } + public static Boolean isOptionSelectedInMultiSelect(String dataTestId, String option) { + return GeneralUIUtils.isOptionSelectedInMultiSelect(dataTestId, option); + } public static List<WebElement> byClass(String className) { return GeneralUIUtils.getWebElementsListByContainsClassName(className); diff --git a/vid-automation/src/main/java/vid/automation/test/infra/SelectOption.java b/vid-automation/src/main/java/vid/automation/test/infra/SelectOption.java index cd766c5bf..096ff47d9 100644 --- a/vid-automation/src/main/java/vid/automation/test/infra/SelectOption.java +++ b/vid-automation/src/main/java/vid/automation/test/infra/SelectOption.java @@ -67,14 +67,29 @@ public class SelectOption { } public static void selectOptionsFromMultiselectById(String multiSelectId, List<String> options) { - Click.byId(multiSelectId); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - throw new RuntimeException(e); + WebElement multiselectComponent = Get.byXpath("//*[@data-tests-id='" + multiSelectId +"']//div[contains(@class, 'c-btn')]"); + if(multiselectComponent != null){ + multiselectComponent.click(); + try { + Thread.sleep(1000); + for(String option:options) { + String multiSelectOptionPath = "//label[@data-tests-id='" + multiSelectId + "-" + option + "']"; + WebElement multiSelelctOption = Get.byXpath(multiSelectOptionPath); + if(multiSelelctOption != null){ + multiSelelctOption.click(); + } + } + multiselectComponent.click(); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } } - for(String option:options) { - Click.byClassAndVisibleText(Constants.MULTI_SELECT_UNSELECTED_CLASS, option); + } + + public static void selectFirstOptionsFromMultiselect(String multiSelectId){ + WebElement multiSelectOption = Get.byXpath("//*[@data-tests-id='" + multiSelectId +"']//label[contains(@class, 'multiSelectOption')]"); + if(multiSelectOption != null){ + SelectOption.selectOptionsFromMultiselectById(multiSelectId, ImmutableList.of(multiSelectOption.getText())); } } } diff --git a/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java b/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java index a9378e6df..1bbf0e3fb 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java @@ -419,8 +419,7 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { browseASDCPage.clickConfirmButton(); GeneralUIUtils.findAndWaitByText("Missing data", 5); - - Click.onFirstSelectOptionById(Constants.OwningEntity.PLATFORM_SELECT_TEST_ID); + SelectOption.selectFirstTwoOptionsFromMultiselectById("multi-selectPlatform"); viewEditPage.clickConfirmButton(); assertSuccessfulVNFCreation(); diff --git a/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java b/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java index 2a7c59f01..5a9dc2c01 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java @@ -1185,7 +1185,11 @@ public class NewServiceInstanceTest extends CreateInstanceDialogBaseTest { assertSetButtonDisabled(VNF_SET_BUTTON_TEST_ID); - browseASDCPage.selectPlatform("platform"); + if(isNetwork){ + browseASDCPage.selectPlatform("platform"); + }else { + SelectOption.selectOptionsFromMultiselectById("multi-selectPlatform", ImmutableList.of("platform")); + } browseASDCPage.selectLineOfBusiness("ONAP"); assertSetButtonEnabled(VNF_SET_BUTTON_TEST_ID); @@ -1214,7 +1218,9 @@ public class NewServiceInstanceTest extends CreateInstanceDialogBaseTest { assertThat(Get.selectedOptionText(Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID), startsWith("AAIAIC25")); Assert.assertEquals(Get.selectedOptionText(Constants.ViewEdit.TENANT_SELECT_TESTS_ID), "USP-SIP-IC-24335-T-01"); Assert.assertEquals(Get.selectedOptionText(Constants.ViewEdit.LINE_OF_BUSINESS_SELECT_TESTS_ID), "ONAP"); - Assert.assertEquals(Get.selectedOptionText(Constants.OwningEntity.PLATFORM_SELECT_TEST_ID), "platform"); + + Assert.assertTrue(Get.isOptionSelectedInMultiSelect(Constants.OwningEntity.PLATFORM_MULTI_SELECT_TEST_ID, "platform")); + Click.byTestId(Constants.CANCEL_BUTTON_TEST_ID); GeneralUIUtils.ultimateWait(); } else { |