aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src
diff options
context:
space:
mode:
authorAlexey Sandler <alexey.sandler@intl.att.com>2019-12-05 17:04:45 +0200
committerYoav Schneiderman <yoav.schneiderman@intl.att.com>2019-12-08 14:20:44 +0200
commit77dd486269bb11f1e206114b87033a7dcc58c012 (patch)
tree8df5710c6f184a2f58837b48df94009f2db39248 /vid-automation/src
parentad530ef6478ed2c8d3d153738ed735130b4019e7 (diff)
Changing VNF platform to multiselect + cypress + API
Issue-ID: VID-724 Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com> Change-Id: Ie8c720974da3419e26ce7e8675622f75780581b9 Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com>
Diffstat (limited to 'vid-automation/src')
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java12
-rw-r--r--vid-automation/src/main/java/vid/automation/test/Constants.java1
-rw-r--r--vid-automation/src/main/java/vid/automation/test/infra/Get.java3
-rw-r--r--vid-automation/src/main/java/vid/automation/test/infra/SelectOption.java29
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java3
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java10
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 {