summaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java/vid/automation/test/sections
diff options
context:
space:
mode:
Diffstat (limited to 'vid-automation/src/main/java/vid/automation/test/sections')
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/BrowseASDCPage.java32
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/ChangeManagementPage.java5
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/CreateConfigurationPage.java45
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/CreateNewInstancePage.java2
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialog.java39
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialogBase.java12
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialogOld.java42
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/DrawingBoardPage.java257
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/InstantiationStatusPage.java59
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/PreviousVersionDialog.java34
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/SearchExistingPage.java24
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/ServiceProxyPage.java92
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java44
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/VidBasePage.java188
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/ViewEditPage.java63
15 files changed, 919 insertions, 19 deletions
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/BrowseASDCPage.java b/vid-automation/src/main/java/vid/automation/test/sections/BrowseASDCPage.java
index f9a2e43a..53a67821 100644
--- a/vid-automation/src/main/java/vid/automation/test/sections/BrowseASDCPage.java
+++ b/vid-automation/src/main/java/vid/automation/test/sections/BrowseASDCPage.java
@@ -1,12 +1,44 @@
package vid.automation.test.sections;
+import org.junit.Assert;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
import vid.automation.test.Constants;
+import vid.automation.test.infra.Get;
+
+import java.util.List;
/**
* Created by itzikliderman on 13/06/2017.
*/
public class BrowseASDCPage extends VidBasePage {
+
public String generateInstanceName() {
return generateInstanceName(Constants.BrowseASDC.SERVICE_INSTANCE_NAME_PREFIX);
}
+
+ public VidBasePage clickPreviousVersionButton() {
+ GeneralUIUtils.clickOnElementByText(Constants.PREVIOUS_VERSION, 30);
+ return this;
+ }
+
+ public void assertPreviousVersionButtonNotExists(String expectedInvariantUUID){
+ boolean exists = Get.byTestId("PreviousVersion-" + expectedInvariantUUID).isDisplayed();
+ Assert.assertFalse(exists);
+ }
+
+ public void assertSearchFilterValue(String value){
+ String searchKey = this.getInputValue(Constants.BROWSE_SEARCH);
+ org.testng.Assert.assertEquals(searchKey, value);
+ }
+
+ public void fillFilterText(String text){
+ this.setInputText(Constants.BROWSE_SEARCH, text);
+ }
+
+ public int countCurrentRowsInTable(){
+ List<WebElement> rowsInTable = Get.byClass("alt-row");
+ return rowsInTable.size();
+ }
+
}
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/ChangeManagementPage.java b/vid-automation/src/main/java/vid/automation/test/sections/ChangeManagementPage.java
index bcf035c0..ca0b55b3 100644
--- a/vid-automation/src/main/java/vid/automation/test/sections/ChangeManagementPage.java
+++ b/vid-automation/src/main/java/vid/automation/test/sections/ChangeManagementPage.java
@@ -1,5 +1,6 @@
package vid.automation.test.sections;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import vid.automation.test.Constants;
import vid.automation.test.infra.Click;
@@ -12,4 +13,8 @@ public class ChangeManagementPage extends VidBasePage {
ChangeManagementPage.openChangeManagementPage();
Click.byId(Constants.ChangeManagement.headlineNewButtonId);
}
+ public static void clickOnRefreshButton(){
+ Click.byTestId("refresh-cm");
+ GeneralUIUtils.ultimateWait();
+ }
}
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/CreateConfigurationPage.java b/vid-automation/src/main/java/vid/automation/test/sections/CreateConfigurationPage.java
new file mode 100644
index 00000000..bb68d9b9
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/CreateConfigurationPage.java
@@ -0,0 +1,45 @@
+package vid.automation.test.sections;
+
+import org.junit.Assert;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+import vid.automation.test.Constants;
+import vid.automation.test.infra.SelectOption;
+
+public class CreateConfigurationPage extends VidBasePage {
+
+ public CreateConfigurationPage setInstanceName(String name) {
+ setInputText(Constants.ConfigurationCreation.INSTANCE_NAME_INPUT_TEST_ID, name);
+ return this;
+ }
+
+ public CreateConfigurationPage chooseRegion(String region){
+ SelectOption.byTestIdAndVisibleText(region, Constants.ConfigurationCreation.REGION_DROPDOWN_TEST_ID);
+ return this;
+ }
+
+ public CreateConfigurationPage chooseTenant(String tenant){
+ SelectOption.byTestIdAndVisibleText(tenant, Constants.ConfigurationCreation.TENANT_DROPDOWN_TEST_ID);
+ return this;
+ }
+
+ public CreateConfigurationPage clickNextButton() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.ConfigurationCreation.NEXT_BUTTON_TEST_ID, 60);
+ return this;
+ }
+
+ public CreateConfigurationPage clickBackButton() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.ConfigurationCreation.BACK_BUTTON_TEST_ID, 60);
+ return this;
+ }
+
+ public String getInstanceName() {
+ return getInputValue(Constants.ConfigurationCreation.INSTANCE_NAME_INPUT_TEST_ID);
+ }
+ public String getRegion() {
+ return getInputValue(Constants.ConfigurationCreation.REGION_DROPDOWN_TEST_ID);
+ }
+ public String getTenant() {
+ return SelectOption.getSelectedOption(Constants.ConfigurationCreation.TENANT_DROPDOWN_TEST_ID);
+ }
+}
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/CreateNewInstancePage.java b/vid-automation/src/main/java/vid/automation/test/sections/CreateNewInstancePage.java
index 2eef9b3a..d63b8a19 100644
--- a/vid-automation/src/main/java/vid/automation/test/sections/CreateNewInstancePage.java
+++ b/vid-automation/src/main/java/vid/automation/test/sections/CreateNewInstancePage.java
@@ -10,7 +10,7 @@ import vid.automation.test.model.Service;
public class CreateNewInstancePage extends VidBasePage {
public CreateNewInstancePage clickCloseButton() {
- GeneralUIUtils.clickOnElementByTestId(Constants.BrowseASDC.MSO_COMMIT_DIALOG_CLOSE_BUTTON, 30);
+ GeneralUIUtils.clickOnElementByTestId(Constants.MSO_COMMIT_DIALOG_CLOSE_BUTTON, 30);
return this;
}
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialog.java b/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialog.java
new file mode 100644
index 00000000..ae757333
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialog.java
@@ -0,0 +1,39 @@
+package vid.automation.test.sections;
+
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+import vid.automation.test.Constants;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsString;
+
+public class DeployMacroDialog extends DeployMacroDialogBase {
+ String dialogTitle = Constants.BrowseASDC.CREATE_SERVICE_INSTANCE_MACRO_MODAL;
+ @Override
+ public void assertTitle(){
+
+ WebElement modalTitle = GeneralUIUtils.getWebElementByTestID(Constants.CREATE_MODAL_TITLE_ID, 30);
+ assertThat(modalTitle.getText().toLowerCase(), containsString(dialogTitle));
+ }
+ @Override
+ public void closeDialog(){
+ GeneralUIUtils.ultimateWait();
+ clickCancelButtonByTestID();
+ goOutFromIframe();
+ }
+
+ @Override
+ public void assertDialogExists() {
+ assertTitle();
+ }
+
+ @Override
+ public void clickOwningEntitySelect() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
+ }
+
+ @Override
+ public void clickProjectSelect() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.OwningEntity.PROJECT_SELECT_TEST_ID);
+ }
+}
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialogBase.java b/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialogBase.java
new file mode 100644
index 00000000..270f53e9
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialogBase.java
@@ -0,0 +1,12 @@
+package vid.automation.test.sections;
+
+public abstract class DeployMacroDialogBase extends VidBasePage {
+
+ public abstract void assertTitle();
+ public abstract void closeDialog();
+ public abstract void assertDialogExists();
+ public abstract void clickOwningEntitySelect();
+ public abstract void clickProjectSelect();
+
+
+}
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialogOld.java b/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialogOld.java
new file mode 100644
index 00000000..03285209
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialogOld.java
@@ -0,0 +1,42 @@
+package vid.automation.test.sections;
+
+import org.junit.Assert;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+import vid.automation.test.Constants;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsString;
+
+public class DeployMacroDialogOld extends DeployMacroDialogBase {
+ String dialogTitle = "macro";
+
+ @Override
+ public void assertTitle(){
+ WebElement modalTitle = GeneralUIUtils.getWebElementByTestID(Constants.CREATE_MODAL_TITLE_ID, 30);
+ assertThat(modalTitle.getText().toLowerCase(), containsString(dialogTitle));
+ }
+
+ @Override
+ public void closeDialog(){
+ GeneralUIUtils.ultimateWait();
+ clickCancelButtonByTestID();
+ }
+
+ @Override
+ public void assertDialogExists(){
+ boolean byText = GeneralUIUtils.findAndWaitByText(Constants.BrowseASDC.CREATE_SERVICE_INSTANCE, 15);
+ Assert.assertTrue(byText);
+ }
+
+ @Override
+ public void clickOwningEntitySelect(){
+ GeneralUIUtils.clickOnElementByTestId(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
+ }
+
+ @Override
+ public void clickProjectSelect(){
+ GeneralUIUtils.clickOnElementByTestId(Constants.OwningEntity.PROJECT_SELECT_TEST_ID);
+ }
+
+}
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/DrawingBoardPage.java b/vid-automation/src/main/java/vid/automation/test/sections/DrawingBoardPage.java
new file mode 100644
index 00000000..7cffd37b
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/DrawingBoardPage.java
@@ -0,0 +1,257 @@
+package vid.automation.test.sections;
+
+import com.google.common.collect.ImmutableList;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.NoSuchElementException;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import vid.automation.test.Constants;
+import vid.automation.test.infra.Click;
+import vid.automation.test.infra.Get;
+import vid.automation.test.infra.Wait;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.collection.IsEmptyCollection.empty;
+import static vid.automation.test.Constants.DrawingBoard.*;
+
+public class DrawingBoardPage extends VidBasePage {
+
+ public DrawingBoardPage(){
+ super();
+ }
+
+ public void expandTreeByClickingNode(String nodeName, String... children) {
+ checkNodesVisible(children, false);
+ clickNode(nodeName);
+ checkNodesVisible(children, true);
+ }
+
+ public void clickNode(String nodeName) {
+ Click.byTestId(Constants.DrawingBoard.NODE_PREFIX + nodeName);
+ }
+
+ public void expandFirstItemInTreeByExpanderIcon(String treeDataTestId, String... children) {
+ checkNodesVisible(children, false);
+ Click.byXpath("//tree-root[@data-tests-id='" + treeDataTestId + "']//span[@class='" + Constants.DrawingBoard.TOGGLE_CHILDREN + "']");
+ checkNodesVisible(children, true);
+ }
+
+ public void checkLeafNodeHasNoExpander(String nodeName){
+ WebElement webElement = Get.byXpath("//div[contains(@class, '" + Constants.DrawingBoard.TREE_NODE_LEAF + "') and .//div[@data-tests-id='" + Constants.DrawingBoard.NODE_PREFIX + nodeName + "']]");
+ Assert.assertNotNull(webElement, "There is an expander to node " + nodeName + " without children");
+ }
+
+ public void verifyNonCollapsableTreeByClickingNode(String nodeName, String... children) {
+ checkNodesVisible(children, true);
+ clickNode(nodeName);
+ checkNodesVisible(children, true);
+ }
+
+ public void collapseFirstItemInTreeByCollapseIcon(String treeDataTestId, String... children) {
+ checkNodesVisible(children, true);
+ Click.byXpath("//tree-root[@data-tests-id='" + treeDataTestId + "']//span[@class='" + Constants.DrawingBoard.TOGGLE_CHILDREN + "']");
+ checkNodesVisible(children, false);
+ }
+
+ public void RefreshPage(){
+ GeneralUIUtils.getDriver().navigate().refresh();
+ }
+
+ public void assertInitalTextOfTree(String treeDataTestId, String[] initialElements) {
+ WebElement webElement = Get.byTestId(treeDataTestId);
+ String expected = String.join("\n", initialElements);
+ Wait.byText(expected);
+ Assert.assertEquals(webElement.getText(), expected);
+ }
+
+ public void checkAddButton(String[] rootElements){
+ String previousAddButton = null;
+ for (String root : rootElements) {
+ String currentButton = Constants.DrawingBoard.NODE_PREFIX + root + Constants.DrawingBoard.ADD_BUTTON;
+ checkThatButtonNotExist(currentButton);
+ GeneralUIUtils.hoverOnAreaByTestId(Constants.DrawingBoard.NODE_PREFIX + root);
+ checkThatButtonExist(currentButton);
+ if (previousAddButton != null) {
+ checkThatButtonNotExist(previousAddButton);
+ }
+ Click.byTestId(currentButton);
+ previousAddButton = currentButton;
+ }
+ }
+
+ public void clickAddButtonByNodeName(String treeNodeId) {
+ String nodeElement = "node-"+ treeNodeId;
+ String addButtonTestId = Constants.DrawingBoard.NODE_PREFIX + treeNodeId + Constants.DrawingBoard.ADD_BUTTON;
+ GeneralUIUtils.hoverOnAreaByTestId(nodeElement);
+ GeneralUIUtils.hoverOnAreaByTestId(addButtonTestId);
+ Click.byTestId(addButtonTestId);
+ }
+
+ private void checkThatButtonNotExist(String dataTestId){
+// Assert.assertFalse(GeneralUIUtils.isElementVisibleByTestId(dataTestId),"button " + dataTestId + " should not exist");
+ }
+
+ private void checkThatButtonExist(String dataTestId){
+// Assert.assertTrue(GeneralUIUtils.isElementVisibleByTestId(dataTestId), "button " + dataTestId + " should exist");
+ }
+
+ private void checkThatPseudoElementNotExist(String dataTestId) {
+ assertPseudoElementDisplayProp(dataTestId, "none");
+ }
+
+ private void assertPseudoElementDisplayProp(String dataTestId, String expectedCssDisplayProp){
+ final JavascriptExecutor javascriptExecutor = (JavascriptExecutor) GeneralUIUtils.getDriver();
+ final Object cssDisplayProp = javascriptExecutor.executeScript("" +
+ "return window.getComputedStyle(" +
+ " document.querySelector('[data-tests-id=\""+dataTestId+"\"]'),':before'" +
+ ").getPropertyValue('display')"
+ );
+ assertThat("button " + dataTestId + " should exist", cssDisplayProp, is(expectedCssDisplayProp));
+ }
+
+ private void checkThatPseudoElementExist(String dataTestId) {
+ assertPseudoElementDisplayProp(dataTestId, "inline-block");
+ }
+
+ public void checkThatContextMenuExist(String contextMenu){
+ Assert.assertTrue(GeneralUIUtils.isWebElementExistByTestId(contextMenu), "context menu should appear");
+ }
+
+ public void checkThatContextMenuNotExist(String contextMenu){
+ Assert.assertFalse(GeneralUIUtils.isWebElementExistByTestId(contextMenu), "context menu should not appear");
+ }
+
+ public void checkNodesVisible(String[] children, boolean shouldExist) {
+ checkElements(ImmutableList.copyOf(children),
+ childName -> GeneralUIUtils.isWebElementExistByTestId(Constants.DrawingBoard.NODE_PREFIX + childName) ? "exists" : "absent",
+ shouldExist ? "exists" : "absent", "visibility");
+ }
+
+ public void checkNodesHighlighted(String[] children) {
+ checkElements(ImmutableList.copyOf(children),
+ childName -> {
+ final WebElement webElement = Get.byTestId(Constants.DrawingBoard.NODE_PREFIX + childName);
+ final String color = webElement.getCssValue("color");
+ return color;
+ },
+ HIGHLIGHTED_COLOR, "highlightning");
+ }
+
+ public void checkNodesVisibleAndMatchIsHighlighted(String searchString, String... children) {
+ checkElements(ImmutableList.copyOf(children),
+ childName -> {
+ final WebElement webElement = Get.byTestId(Constants.DrawingBoard.NODE_PREFIX + childName);
+ String visible = webElement.isDisplayed() ? "visible" : "hidden";
+ String highlightedText;
+ String bgColor;
+ try {
+ final WebElement highlighted = webElement.findElement(By.cssSelector(".highlight"));
+ highlightedText = highlighted.getText();
+ bgColor = highlighted.getCssValue("background-color");
+ } catch (NoSuchElementException e) {
+ highlightedText = "";
+ bgColor = "none";
+ }
+ return String.join("", visible, " and '", highlightedText, "' in ", bgColor);
+ },
+ "visible and '" + searchString + "' in rgb(157, 217, 239)", "match highlightning");
+ }
+
+ private void checkElements(Collection<String> elements, Function<String, String> predicate, String expected, final String description) {
+ final Map<String, String> expectedMap = elements.stream().collect(Collectors.toMap(
+ childName -> childName,
+ child -> expected
+ ));
+ final Map<String, String> actual = elements.stream().collect(Collectors.toMap(
+ childName -> childName,
+ predicate
+ ));
+
+ assertThat("There was an error in " + description + " of elements", actual, equalTo(expectedMap));
+ }
+
+ public void navigateToServicePlanningPage() {
+ navigateTo("/vid/app/ui/#/servicePlanning");
+ }
+
+ public void navigateToEmptyServicePlanningPage() {
+ navigateTo("/vid/app/ui/#/servicePlanningEmpty");
+ }
+
+ public void checkContextMenu(String node){
+ String contextMenuButton = Constants.DrawingBoard.NODE_PREFIX + node + Constants.DrawingBoard.CONTEXT_MENU_BUTTON;
+ final String contextMenu = Constants.DrawingBoard.CONTEXT_MENU_ITEM;
+
+ checkThatPseudoElementNotExist(contextMenuButton);
+ checkThatContextMenuNotExist(contextMenu);
+
+ GeneralUIUtils.hoverOnAreaByTestId(Constants.DrawingBoard.NODE_PREFIX + node);
+ checkThatPseudoElementExist(contextMenuButton);
+ Click.byTestId(contextMenuButton);
+
+ checkThatContextMenuExist(contextMenu);
+ }
+
+ public void checkSearch(){
+ String searchElement = Constants.DrawingBoard.SEARCH_LEFT_TREE;// TODO - should add that it is on the left tree and should create the id of the search element???
+ Assert.assertTrue(GeneralUIUtils.isWebElementExistByTestId(searchElement), "search " + searchElement + " should exist");
+ }
+
+ public void showTooltipByHoverAboveAlertIcon(String element){
+ assertThat("tooltip should not appear before click",
+ GeneralUIUtils.getDriver().findElements(By.xpath("//*[contains(@class, '" + "tooltip-inner" + "')]")),
+ is(empty())
+ );
+
+ GeneralUIUtils.hoverOnAreaByTestId(Constants.DrawingBoard.NODE_PREFIX + element + Constants.DrawingBoard.ALERT_ICON);
+
+ final WebElement webElement = GeneralUIUtils.getWebElementByContainsClassName("tooltip-inner");
+ assertThat(webElement.getText(), is("Missing required information. Please open and fill in the details."));
+ }
+
+ public void clickDeployButton(){
+ GeneralUIUtils.ultimateWait();
+
+ try {
+ GeneralUIUtils.clickOnElementByTestId(DEPLOY_BUTTON);
+ } catch (org.openqa.selenium.WebDriverException e) {
+ // "deploy" replaces the iframe, so "TypeError: can't access dead object" exception is eventually thrown
+ if (!e.getMessage().startsWith("TypeError: can't access dead object")) {
+ throw e;
+ }
+ }
+
+ }
+
+ public void checkDeployButtonDisabled(){
+ Assert.assertFalse(Get.byTestId(DEPLOY_BUTTON).isEnabled(),"Deploy button is enabled and should be disabled");
+ }
+
+ public void checkExistsAndEnabled(String dataTestId){
+ Assert.assertFalse(GeneralUIUtils.isElementDisabled(dataTestId),"Element " + dataTestId + " should exist and be enabled");
+ }
+
+ public void checkServiceInstanceName(String expectedServiceName){
+ Assert.assertEquals(SERVICE_INSTANCE_VALUE, Get.byTestId(SERVICE_INSTANCE_TEST_ID).getText());
+ Assert.assertEquals(Get.byTestId(SERVICE_NAME).getText(),expectedServiceName);
+ }
+
+ public void checkServiceStatus() {
+ Assert.assertEquals(Get.byTestId(SERVICE_STATUS).getText(),STATUS_TEXT);
+ }
+
+ public void checkQuantityNumberIsCorrect(int expectedQuantity) {
+ Assert.assertEquals(Get.byTestId(QUANTITY_LABEL_TEST_ID).getText(), (String.valueOf(QUANTITY_LABEL_VALUE)));
+ Assert.assertEquals(Get.byTestId(SERVICE_QUANTITY).getText(), (String.valueOf(expectedQuantity)));
+ }
+
+}
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/InstantiationStatusPage.java b/vid-automation/src/main/java/vid/automation/test/sections/InstantiationStatusPage.java
new file mode 100644
index 00000000..e5dd1bb3
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/InstantiationStatusPage.java
@@ -0,0 +1,59 @@
+package vid.automation.test.sections;
+
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import vid.automation.test.infra.Get;
+
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public abstract class InstantiationStatusPage extends VidBasePage {
+
+ public static final String refreshButtonId = "refresh-btn";
+
+ public static String getWebTrTdSpanElementByParentID(WebElement tr, String id, int timeout) {
+ return tr.findElements(By.xpath(".//*[@id='" + id + "']//span")).get(0).getText();
+ }
+
+ public static int getNumberOfTableRows(int timeout){
+ WebDriverWait wait = waitUntilDriverIsReady(timeout);
+ return wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//*[table]//tbody/tr"))).size();
+ }
+
+ public static WebElement assertInstantiationStatusRow(String spanIdSelector, Map<String, String> fieldsIdsAndExpected) {
+ try {
+ WebElement newTrRow = getInstantiationStatusRow(spanIdSelector);
+ final Map<String, String> fieldIdAndActual = fieldsIdsAndExpected.entrySet().stream()
+ .collect(Collectors.toMap(
+ kv -> kv.getKey(),
+ kv -> getWebTrTdSpanElementByParentID(newTrRow, kv.getKey(), 1)
+ ));
+
+ assertThat("failed comparing spanIdSelector " + spanIdSelector, fieldIdAndActual, is(fieldsIdsAndExpected));
+
+ return newTrRow;
+ } catch (Exception e) {
+ throw new RuntimeException("error while assertInstantiationStatusRow with: String spanIdSelector=" +
+ spanIdSelector + ", fieldsIdsAndExpected=" + fieldsIdsAndExpected, e);
+ }
+ }
+
+ public static WebElement getInstantiationStatusRow(String spanIdSelector) {
+ GeneralUIUtils.ultimateWait();
+ return Get.byXpath("//*[@id='" + spanIdSelector + "']/parent::*/parent::*/parent::*", 0);
+ }
+
+ public static void clickRefreshButton() {
+ WebDriverWait wait = waitUntilDriverIsReady(0);
+ wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='"+ refreshButtonId + "']"))).click();
+ GeneralUIUtils.ultimateWait();
+ }
+
+
+}
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/PreviousVersionDialog.java b/vid-automation/src/main/java/vid/automation/test/sections/PreviousVersionDialog.java
new file mode 100644
index 00000000..d5f39d95
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/PreviousVersionDialog.java
@@ -0,0 +1,34 @@
+package vid.automation.test.sections;
+
+import org.junit.Assert;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.remote.RemoteWebElement;
+import vid.automation.test.infra.Get;
+
+public class PreviousVersionDialog extends VidBasePage{
+
+ public void assertPreviousVersionButtonExists(String expectedInvariantUUID){
+
+ WebElement viewPreviousButtonWebElement = GeneralUIUtils.getWebElementByTestID("Invariant-" + expectedInvariantUUID);
+ Assert.assertEquals(expectedInvariantUUID, viewPreviousButtonWebElement.getText());
+ }
+
+ public void assertVersionRow(String expectedInvariantId, String expectedmodelVersionId, String expectedVersionId , String testId){
+
+ WebElement invariantUUIDTableCell = GeneralUIUtils.getWebElementByTestID(testId + expectedmodelVersionId);
+ String modelVersionId = ((RemoteWebElement) invariantUUIDTableCell).findElementsByTagName("td").get(1).getText();
+ String invariantId = ((RemoteWebElement) invariantUUIDTableCell).findElementsByTagName("td").get(2).getText();
+ String versionId = ((RemoteWebElement) invariantUUIDTableCell).findElementsByTagName("td").get(4).getText();
+ Assert.assertEquals(expectedmodelVersionId, modelVersionId);
+ Assert.assertEquals(expectedInvariantId, invariantId);
+ Assert.assertEquals(expectedVersionId, versionId);
+ }
+
+ public void assertHighestVersionNotExists( String expectedmodelVersionId){
+
+ Assert.assertNull(Get.byTestId("Previous-version-pop-up-uuid-" + expectedmodelVersionId));
+
+ }
+ }
+
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/SearchExistingPage.java b/vid-automation/src/main/java/vid/automation/test/sections/SearchExistingPage.java
index 5fc4894e..edfcd0e5 100644
--- a/vid-automation/src/main/java/vid/automation/test/sections/SearchExistingPage.java
+++ b/vid-automation/src/main/java/vid/automation/test/sections/SearchExistingPage.java
@@ -4,6 +4,10 @@ import org.junit.Assert;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openqa.selenium.WebElement;
import vid.automation.test.Constants;
+import vid.automation.test.infra.Click;
+import vid.automation.test.infra.Wait;
+
+import static org.testng.Assert.assertTrue;
/**
@@ -12,6 +16,8 @@ import vid.automation.test.Constants;
public class SearchExistingPage extends VidBasePage {
+ public static final String PROJECT_NAME = "Project Name";
+
public SearchExistingPage() {}
public void selectSearchById(){
@@ -40,6 +46,7 @@ public class SearchExistingPage extends VidBasePage {
private void startSearchByInstanceIdentifier(String text) {
WebElement textInputWebElement = GeneralUIUtils.getWebElementByTestID(Constants.EditExistingInstance.SEARCH_FOR_EXISTING_INSTANCES_INPUT, 30);
Assert.assertTrue(textInputWebElement != null);
+ textInputWebElement.clear();
textInputWebElement.sendKeys(text);
clickSubmitButton();
}
@@ -49,6 +56,23 @@ public class SearchExistingPage extends VidBasePage {
startSearchByInstanceIdentifier(name);
}
+ public void searchByProject(String projectName) {
+ assertTrue(Wait.waitByClassAndText("fn-ebz-text-label", PROJECT_NAME, 1), "Failed to find label "+PROJECT_NAME); //Test bug VID-495468
+ selectValueDDL(Constants.EditExistingInstance.SELECT_PROJECT_ID, projectName);
+ }
+
+ public void searchByOwningEntity(String oeName) {
+ selectValueDDL(Constants.EditExistingInstance.SELECT_OWNING_ENTITY_ID, oeName);
+ }
+
+ private void selectValueDDL(String ddlId, String value) {
+ Click.byId(ddlId);
+ GeneralUIUtils.ultimateWait();
+ Click.byText(value);
+ //click again on the element that will not cover the submit button
+ Click.byId(ddlId);
+ }
+
public void checkForEditButtons() {
boolean isDeleteVisible = GeneralUIUtils.waitForElementInVisibilityByTestId(Constants.EditExistingInstance.DELETE_VNF_BTN, 30);
Assert.assertFalse(isDeleteVisible);
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/ServiceProxyPage.java b/vid-automation/src/main/java/vid/automation/test/sections/ServiceProxyPage.java
new file mode 100644
index 00000000..a4787029
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/ServiceProxyPage.java
@@ -0,0 +1,92 @@
+package vid.automation.test.sections;
+
+import org.junit.Assert;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+import vid.automation.test.Constants;
+import vid.automation.test.infra.SelectOption;
+
+import static org.hamcrest.core.Is.is;
+
+public class ServiceProxyPage extends VidBasePage {
+
+ public ServiceProxyPage chooseSource(String source){
+ SelectOption.byTestIdAndVisibleText(source, Constants.ConfigurationCreation.SOURCE_DROPDOWN_TEST_ID);
+ return this;
+ }
+ public ServiceProxyPage chooseSourceServiceType(String sourceServiceType){
+ SelectOption.byTestIdAndVisibleText(sourceServiceType, "sourceServiceType");
+ GeneralUIUtils.ultimateWait();
+ return this;
+ }
+ public ServiceProxyPage chooseCollectorServiceType(String collectorServiceType){
+ SelectOption.byTestIdAndVisibleText(collectorServiceType, "collectorServiceType");
+ GeneralUIUtils.ultimateWait();
+ return this;
+ }
+ public ServiceProxyPage chooseCollector(String collector){
+ GeneralUIUtils.ultimateWait();
+ SelectOption.byTestIdAndVisibleText(collector, Constants.ConfigurationCreation.COLLECTOR_DROPDOWN_TEST_ID);
+ return this;
+ }
+ public ServiceProxyPage clickCreateButton() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.ConfigurationCreation.CREATE_BUTTON_TEST_ID, 60);
+ return this;
+ }
+
+ public ServiceProxyPage clickDeleteConfigurationButton() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.DELETE_CONFIGURATION_BUTTON, 60);
+ return this;
+ }
+
+ public ServiceProxyPage assertDeleteConfigurationButtonExists(boolean shouldExist){
+
+ if (shouldExist) {
+ WebElement selectedV = GeneralUIUtils.getWebElementByTestID(Constants.DELETE_CONFIGURATION_BUTTON, 3);
+ Assert.assertThat(selectedV != null, is(shouldExist));
+ Assert.assertThat(selectedV.isDisplayed(), is(shouldExist));
+ } else {
+ boolean webElementExistByTestId = GeneralUIUtils.isWebElementExistByTestId(Constants.DELETE_CONFIGURATION_BUTTON);
+ Assert.assertThat(webElementExistByTestId, is(shouldExist));
+ }
+ return this;
+ }
+
+ public void assertSourceModelName(String sourceName){
+ String displayedSourceName= getTextByTestID(Constants.ConfigurationCreation.SOURCE_INSTANCE_NAME_TEST_ID);
+ Assert.assertEquals("The displayed source name is not correct", sourceName+" i", displayedSourceName);
+ }
+
+ public void assertCollectorModelName(String collectorName) {
+ String displayedCollectorName = getTextByTestID(Constants.ConfigurationCreation.COLLECTOR_INSTANCE_NAME_TEST_ID);
+ Assert.assertEquals("The displayed collector name is not correct", collectorName+"i", displayedCollectorName);
+ }
+
+ public void assertNoResultRequirementsDropDown(String msgTestId, String resourceType){
+ String noResultText = GeneralUIUtils.getWebElementByTestID(msgTestId, 60).getText();
+ Assert.assertEquals("The error message no instance in DropDown is not match","No "+resourceType+" instances found.",noResultText);
+ }
+ public ServiceProxyPage clickInfoButton(String infoButtonTestId) {
+ GeneralUIUtils.clickOnElementByTestId(infoButtonTestId, 90);
+ return this;
+ }
+
+
+ public ServiceProxyPage assertSelectedInstanceIcon(String SelectedIconTestId){
+ WebElement selectedV = GeneralUIUtils.getWebElementByTestID(SelectedIconTestId, 90);
+ Assert.assertTrue(selectedV != null);
+ String selectedVClass = selectedV.getAttribute("class");
+ Assert.assertTrue(selectedVClass.contains("valid-large"));
+ return this;
+ }
+
+ public ServiceProxyPage clickActivateDeactivateButton() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.ACTIVATE_DEACTIVATE_BUTTON, 60);
+ return this;
+ }
+
+ public ServiceProxyPage clickEnableDisableButton(){
+ GeneralUIUtils.clickOnElementByTestId(Constants.ENABLE_DISABLE_BUTTON, 60);
+ return this;
+ }
+}
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java b/vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java
index 8745001d..0ba49f2d 100644
--- a/vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java
+++ b/vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java
@@ -2,6 +2,8 @@ package vid.automation.test.sections;
import org.junit.Assert;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.ElementClickInterceptedException;
+import org.openqa.selenium.UnhandledAlertException;
import vid.automation.test.Constants;
public class SideMenu {
@@ -21,10 +23,50 @@ public class SideMenu {
navigateToPage(Constants.SideMenu.TEST_ENVIRONMENTS);
}
+ public static void navigateToMacroInstantiationStatus() {
+ navigateToPage("Macro Instantiation Status");
+ new VidBasePage().goToIframe();
+ }
+
private static void navigateToPage(String PageName) {
+
boolean findAndWaitByText = GeneralUIUtils.findAndWaitByText(PageName, 30);
+
+ if (!findAndWaitByText) {
+ doEvenIfAlertIsShown(SideMenu::navigateToWelcomePage);
+ findAndWaitByText = GeneralUIUtils.findAndWaitByText(PageName, 10);
+ }
+
Assert.assertTrue(findAndWaitByText);
- GeneralUIUtils.clickOnElementByText(PageName, 150);
+ doEvenIfAlertIsShown(() -> {
+ try {
+ GeneralUIUtils.clickOnElementByText(PageName, 50);
+ } catch (ElementClickInterceptedException e) {
+ navigateToWelcomePage();
+ GeneralUIUtils.clickOnElementByText(PageName, 100);
+ }
+ });
GeneralUIUtils.ultimateWait();
}
+
+ public static void navigateToWelcomePage() {
+ doEvenIfAlertIsShown(() -> {
+ VidBasePage base = new VidBasePage();
+ base.navigateTo("welcome.htm");
+ });
+ }
+
+ private static void doEvenIfAlertIsShown(Runnable runnable) {
+ try {
+ runnable.run();
+ } catch (UnhandledAlertException e) {
+ // an alert popup was shown; dismiss it if it's still there
+ try {
+ GeneralUIUtils.getDriver().switchTo().alert().dismiss();
+ } catch (org.openqa.selenium.NoAlertPresentException e2) {
+ // YOLO
+ }
+ runnable.run();
+ }
+ }
}
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/VidBasePage.java b/vid-automation/src/main/java/vid/automation/test/sections/VidBasePage.java
index 6e0367ed..69aee494 100644
--- a/vid-automation/src/main/java/vid/automation/test/sections/VidBasePage.java
+++ b/vid-automation/src/main/java/vid/automation/test/sections/VidBasePage.java
@@ -1,16 +1,27 @@
package vid.automation.test.sections;
+import com.aventstack.extentreports.Status;
import org.junit.Assert;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
import vid.automation.test.Constants;
-import vid.automation.test.infra.Click;
-import vid.automation.test.infra.SelectOption;
-import vid.automation.test.infra.Wait;
+import vid.automation.test.infra.*;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
+import java.util.List;
+import java.util.function.Function;
+
+import static org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils.getDriver;
public class VidBasePage {
@@ -19,9 +30,16 @@ public class VidBasePage {
return this;
}
- public void generateAndSetInstanceName(String prefix) {
+
+ public VidBasePage setLegacyRegion(String name) {
+ setInputText(Constants.ViewEdit.LEGACY_REGION_INPUT_TESTS_ID, name);
+ return this;
+ }
+
+ public String generateAndSetInstanceName(String prefix) {
String instanceName = generateInstanceName(prefix);
setInstanceName(instanceName);
+ return instanceName;
}
public VidBasePage setInputText(String inputTestsId, String text) {
@@ -30,6 +48,12 @@ public class VidBasePage {
return this;
}
+ public String getInputValue(String inputTestsId) {
+ WebElement instanceNameInput = GeneralUIUtils.getInputElement(inputTestsId);
+ String value =instanceNameInput.getAttribute("value");
+ return value;
+ }
+
public String generateInstanceName(String prefix) {
SimpleDateFormat sdf = new SimpleDateFormat(Constants.BrowseASDC.DATE_FORMAT);
Date now = Calendar.getInstance().getTime();
@@ -40,11 +64,27 @@ public class VidBasePage {
SelectOption.byTestIdAndVisibleText(serviceType, Constants.SERVICE_TYPE_SELECT_TESTS_ID);
return this;
}
+ public VidBasePage selectFromDropdownByTestId(String itemTestId, String dropdownButtonTestId) {
+ GeneralUIUtils.clickOnElementByTestId(dropdownButtonTestId, 60);
+ Assert.assertTrue(String.format(Constants.ViewEdit.OPTION_IN_DROPDOWN_NOT_EXISTS,itemTestId, dropdownButtonTestId),GeneralUIUtils.getWebElementByTestID(itemTestId) != null );
+ GeneralUIUtils.clickOnElementByTestId(itemTestId, 60);
+ return this;
+ }
+ public VidBasePage noOptionDropdownByTestId( String dropdownButtonTestId) {
+ List<WebElement> selectList= SelectOption.getList(dropdownButtonTestId);
+ Assert.assertTrue("The Select Input "+ dropdownButtonTestId+" should be empty",selectList.size()==1);
+ return this;
+ }
public static void selectSubscriberById(String subscriberId) {
SelectOption.byValue(subscriberId, Constants.SUBSCRIBER_NAME_SELECT_TESTS_ID);
}
+ public VidBasePage selectSubscriberByName(String subscriberName) {
+ SelectOption.byTestIdAndVisibleText(subscriberName, Constants.SUBSCRIBER_NAME_SELECT_TESTS_ID);
+ return this;
+ }
+
public VidBasePage selectProductFamily(String productFamily) {
SelectOption.byValue(productFamily, Constants.ViewEdit.PRODUCT_FAMILY_SELECT_TESTS_ID);
return this;
@@ -56,20 +96,42 @@ public class VidBasePage {
}
public VidBasePage clickDeployServiceButtonByServiceUUID(String serviceUUID) {
- setInputText(Constants.BROWSE_SEARCH, serviceUUID);
+ Input.replaceText(serviceUUID, Constants.BROWSE_SEARCH);
String elementTestId = Constants.DEPLOY_BUTTON_TESTS_ID_PREFIX + serviceUUID;
GeneralUIUtils.clickOnElementByTestId(elementTestId, 30);
GeneralUIUtils.ultimateWait();
+
+ screenshotDeployDialog(serviceUUID);
+
return this;
}
+ public void screenshotDeployDialog(String serviceUUID) {
+ try {
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.ultimateWait(); // better screenshot
+ String screenshotName = "deployService-" + serviceUUID;
+ ExtentTestActions.addScreenshot(Status.INFO, screenshotName, screenshotName);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+
public VidBasePage clickEditViewByInstanceId(String instanceId) {
String elementTestId = Constants.VIEW_EDIT_TEST_ID_PREFIX + instanceId;
GeneralUIUtils.clickOnElementByTestId(elementTestId, 100);
- GeneralUIUtils.ultimateWait();
+
return this;
}
+ public Boolean checkEditOrViewExistsByInstanceId(String instanceId) {
+ String elementTestId = Constants.VIEW_EDIT_TEST_ID_PREFIX + instanceId;
+ return Exists.byTestId(elementTestId);
+ }
+
+
+
public VidBasePage clickSubmitButton() {
GeneralUIUtils.clickOnElementByText(Constants.SUBMIT_BUTTON_TEXT, 30);
return this;
@@ -80,17 +142,37 @@ public class VidBasePage {
return this;
}
+ public VidBasePage clickCancelButtonByTestID() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.CANCEL_BUTTON_TEST_ID, 30);
+ return this;
+ }
+
public VidBasePage clickConfirmButton() {
GeneralUIUtils.clickOnElementByTestId(Constants.CONFIRM_BUTTON_TESTS_ID, 30);
return this;
}
+ public VidBasePage clickConfirmButtonInResumeDelete() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.CONFIRM_RESUME_DELETE_TESTS_ID);
+ return this;
+ }
+
+ public VidBasePage clickCommitCloseButton() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.COMMIT_CLOSE_BUTTON_ID, 30);
+ return this;
+ }
+
public VidBasePage clickCloseButton() {
- GeneralUIUtils.clickOnElementByText(Constants.CLOSE_BUTTON_TEXT, 30);
+ return clickCloseButton(30);
+ }
+
+ public VidBasePage clickCloseButton(int customTimeout) {
+ GeneralUIUtils.clickOnElementByText(Constants.CLOSE_BUTTON_TEXT, customTimeout);
return this;
}
+
public VidBasePage selectLcpRegion(String lcpRegion) {
SelectOption.byValue(lcpRegion, Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID);
return this;
@@ -106,27 +188,107 @@ public class VidBasePage {
return this;
}
+ public VidBasePage selectRollbackOption(boolean rollback) {
+ SelectOption.byValue(String.valueOf(rollback) , Constants.ViewEdit.ROLLBACK_TEST_ID);
+ return this;
+ }
+
+ public VidBasePage selectPlatform(String platform) {
+ SelectOption.byValue(platform, Constants.OwningEntity.PLATFORM_SELECT_TEST_ID);
+ return this;
+ }
+
+ public VidBasePage selectLineOfBusiness(String lob) {
+ SelectOption.byValue(lob, Constants.OwningEntity.LOB_SELECT_TEST_ID);
+ return this;
+ }
+
public void assertButtonState(String dataTestId, boolean shouldBeEnabled) {
+ assertButtonStateInternal(dataTestId, shouldBeEnabled,
+ (dataTestIdInner) -> GeneralUIUtils.getWebElementByTestID(dataTestIdInner, 60));
+ }
+
+ public void assertButtonStateEvenIfButtonNotVisible(String dataTestId, boolean shouldBeEnabled) {
+ // getInputElement is quite similar to getWebElementByTestID, but doesn't use
+ // the visibility predicate, so button is reachable bhind the grayed-out panel
+ assertButtonStateInternal(dataTestId, shouldBeEnabled,
+ (dataTestIdInner) -> GeneralUIUtils.getInputElement(dataTestIdInner));
+ }
+
+ protected void assertButtonStateInternal(String dataTestId, boolean shouldBeEnabled, Function<String,WebElement> strategy) {
GeneralUIUtils.ultimateWait();
- WebElement webElement = GeneralUIUtils.getWebElementByTestID(dataTestId, 60);
- boolean enabledElement= webElement.getAttribute("disabled")==null?true:false;
+ boolean enabledElement= strategy.apply(dataTestId).getAttribute("disabled") == null;
if(shouldBeEnabled) {
- Assert.assertTrue(String.format(Constants.ViewEdit.ENABLE_ERROR_MESSAGE,dataTestId), enabledElement);
+ Assert.assertTrue(String.format(Constants.ViewEdit.DISABLE_ERROR_MESSAGE,dataTestId), enabledElement);
}else{
- Assert.assertFalse(String.format(Constants.ViewEdit.DISABLE_ERROR_MESSAGE,dataTestId),enabledElement);
+ Assert.assertFalse(String.format(Constants.ViewEdit.ENABLE_ERROR_MESSAGE,dataTestId),enabledElement);
}
}
public VidBasePage assertMsoRequestModal(String statusMsg) {
- boolean waitForTextResult = Wait.waitByClassAndText("status", statusMsg, 60);
+ boolean waitForTextResult = Wait.waitByClassAndText("status", statusMsg, 20);
Assert.assertTrue(statusMsg + " message didn't appear on time", waitForTextResult);
return this;
}
public VidBasePage refreshPage() {
- GeneralUIUtils.getDriver().navigate().refresh();
+ getDriver().navigate().refresh();
return this;
}
+ public String navigateTo(String path) {
+ String envUrl = System.getProperty("ENV_URL");
+ URI uri;
+ try {
+ uri = new URI(envUrl);
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ String target = uri.resolve(path).toString();
+
+ getDriver().navigate().to(target);
+ GeneralUIUtils.ultimateWait();
+
+ return target;
+ }
+
+ public String getTextByTestID(String testId){
+ WebElement webElement= GeneralUIUtils.getWebElementByTestID(testId);
+ return webElement.getText();
+ }
+
+ public void checkAndCloseAlert(String expectedText) {
+ String alertText= Get.alertText();
+ Assert.assertEquals(expectedText, alertText);
+ Click.acceptAlert();
+ }
+ public void goToIframe() {
+ final long start = System.currentTimeMillis();
+ goOutFromIframe();
+ GeneralUIUtils.ultimateWait();
+ System.out.println("ultimateWait waited " + (System.currentTimeMillis() - start));
+ final WebDriver iframeReady = new WebDriverWait(getDriver(), 10).until(
+ ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.tagName("iframe"))
+ );
+ Assert.assertNotNull("failed going into iframe", iframeReady);
+
+ final long start2 = System.currentTimeMillis();
+ GeneralUIUtils.ultimateWait();
+ System.out.println("ultimateWait waited " + (System.currentTimeMillis() - start2));
+ }
+
+ public void goOutFromIframe(){
+ getDriver().switchTo().defaultContent();
+ }
+
+
+
+
+
+ public static WebDriverWait waitUntilDriverIsReady(int time) {
+ return new WebDriverWait(getDriver(), (long)time);
+ }
+
+
}
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/ViewEditPage.java b/vid-automation/src/main/java/vid/automation/test/sections/ViewEditPage.java
index 5f532d22..633feb83 100644
--- a/vid-automation/src/main/java/vid/automation/test/sections/ViewEditPage.java
+++ b/vid-automation/src/main/java/vid/automation/test/sections/ViewEditPage.java
@@ -8,6 +8,11 @@ import vid.automation.test.Constants;
import vid.automation.test.infra.Get;
import vid.automation.test.infra.SelectOption;
import vid.automation.test.infra.Wait;
+import org.hamcrest.core.Is;
+
+import static org.hamcrest.core.Is.is;
+
+import java.util.List;
/**
* Created by itzikliderman on 13/06/2017.
@@ -19,6 +24,29 @@ public class ViewEditPage extends VidBasePage {
return this;
}
+ public ViewEditPage selectVfModuleToAdd(String vfModuleName) {
+ selectFromDropdownByTestId(Constants.ViewEdit.VF_MODULE_OPTION_TEST_ID_PREFIX + vfModuleName,
+ Constants.ViewEdit.ADD_VF_MODULE_BUTTON_TEST_ID);
+ return this;
+ }
+
+ public ViewEditPage clickResumeButton(String instanceName) {
+ //instanceName = "my_vfModule";
+ String instanceId = Constants.ViewEdit.VF_MODULE_RESUME_ID_PREFIX + instanceName;
+ checkIfExistResumeButton(instanceName,true);
+ GeneralUIUtils.clickOnElementByTestId(instanceId);
+ return this;
+ }
+
+
+ public ViewEditPage checkIfExistResumeButton(String instanceName, Boolean expected) {
+ //instanceName = "my_vfModule";
+ String instanceId = Constants.ViewEdit.VF_MODULE_RESUME_ID_PREFIX + instanceName;
+ WebElement resumeButton = GeneralUIUtils.getWebElementByTestID(instanceId, 30);
+ Assert.assertThat(resumeButton != null, is(expected));
+ return this;
+ }
+
public ViewEditPage selectVolumeGroupToAdd(String volumeGroupName) {
selectFromDropdownByTestId(Constants.ViewEdit.VOLUME_GROUP_OPTION_TEST_ID_PREFIX + volumeGroupName,
Constants.ViewEdit.ADD_VOLUME_GROUP_BUTTON_TEST_ID);
@@ -31,10 +59,9 @@ public class ViewEditPage extends VidBasePage {
return this;
}
- public ViewEditPage selectFromDropdownByTestId(String itemTestId, String dropdownButtonTestId) {
- GeneralUIUtils.clickOnElementByTestId(dropdownButtonTestId, 60);
- Assert.assertTrue(String.format(Constants.ViewEdit.OPTION_IN_DROPDOWN_NOT_EXISTS,dropdownButtonTestId,"Add network instance"),GeneralUIUtils.getWebElementByTestID(itemTestId) != null );
- GeneralUIUtils.clickOnElementByTestId(itemTestId, 60);
+ public ViewEditPage selectNetworkToAdd(String networkName) {
+ selectFromDropdownByTestId(Constants.ViewEdit.NETWORK_OPTION_TEST_ID_PREFIX + networkName,
+ Constants.ViewEdit.ADD_NETWORK_BUTTON_TEST_ID);
return this;
}
@@ -55,6 +82,7 @@ public class ViewEditPage extends VidBasePage {
public ViewEditPage selectTenant(String tenant){
SelectOption.byValue(tenant, Constants.ViewEdit.TENANT_SELECT_TESTS_ID);
+ // GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.TENANT_SELECT_TESTS_ID, 60);
return this;
}
@@ -63,6 +91,17 @@ public class ViewEditPage extends VidBasePage {
return this;
}
+ public VidBasePage clickInfoButton() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.INFOSERVICEBUTTON, 30);
+ return this;
+ }
+
+ public VidBasePage clickDeleteButton() {
+ GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.DELETESERVICEBUTTON, 3);
+ return this;
+ }
+
+
public WebElement getPnf(String pnfName) {
WebElement pnfElement = Get.byClassAndText("tree-node", "PNF: " + pnfName);
Assert.assertNotNull("Pnf "+ pnfName +" not found under service instance", pnfElement);
@@ -81,4 +120,20 @@ public class ViewEditPage extends VidBasePage {
GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.DEACTIVATE_BUTTON_TEST_ID, 30);
return this;
}
+
+ public ViewEditPage selectLineOfBusiness(String lineOfBusiness) {
+ try {
+ SelectOption.selectFirstTwoOptionsFromMultiselectById(Constants.ViewEdit.LINE_OF_BUSINESS_SELECT_TESTS_ID);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ return this;
+ }
+ //TODO multi SelectOption.byValue(lineOfBusiness, Constants.ViewEdit.LINE_OF_BUSINESS_SELECT_TESTS_ID);
+ return this;
+ }
+
+ public ViewEditPage selectPlatform(String platform) {
+ SelectOption.byValue(platform, Constants.OwningEntity.PLATFORM_SELECT_TEST_ID);
+ return this;
+ }
}