diff options
Diffstat (limited to 'vid-automation/src/main/java/vid/automation/test/sections')
17 files changed, 220 insertions, 44 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 53a67821d..febbe6e83 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,7 +1,7 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import vid.automation.test.Constants; import vid.automation.test.infra.Get; 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 ca0b55b36..953219547 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,6 +1,6 @@ package vid.automation.test.sections; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import vid.automation.test.Constants; import vid.automation.test.infra.Click; 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 index bb68d9b9e..4b837a0ac 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/CreateConfigurationPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/CreateConfigurationPage.java @@ -1,7 +1,7 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import vid.automation.test.Constants; import vid.automation.test.infra.SelectOption; 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 d63b8a191..68e673b68 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 @@ -1,6 +1,6 @@ package vid.automation.test.sections; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import vid.automation.test.Constants; import vid.automation.test.model.Service; 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 index ae7573333..e7288ea79 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialog.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialog.java @@ -1,6 +1,6 @@ package vid.automation.test.sections; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import vid.automation.test.Constants; @@ -13,7 +13,7 @@ public class DeployMacroDialog extends DeployMacroDialogBase { public void assertTitle(){ WebElement modalTitle = GeneralUIUtils.getWebElementByTestID(Constants.CREATE_MODAL_TITLE_ID, 30); - assertThat(modalTitle.getText().toLowerCase(), containsString(dialogTitle)); + assertThat(modalTitle.getText(), containsString(dialogTitle)); } @Override public void closeDialog(){ 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 index 032852099..e0e391b4d 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialogOld.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/DeployMacroDialogOld.java @@ -1,7 +1,7 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import vid.automation.test.Constants; 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 index 7cffd37b9..acbb4d991 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/DrawingBoardPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/DrawingBoardPage.java @@ -1,7 +1,8 @@ package vid.automation.test.sections; import com.google.common.collect.ImmutableList; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import com.google.common.collect.Sets; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.NoSuchElementException; @@ -12,9 +13,9 @@ 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.*; import java.util.function.Function; +import java.util.function.Predicate; import java.util.stream.Collectors; import static org.hamcrest.CoreMatchers.equalTo; @@ -189,7 +190,7 @@ public class DrawingBoardPage extends VidBasePage { 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; + final String contextMenu = Constants.DrawingBoard.CONTEXT_MENU_EDIT; checkThatPseudoElementNotExist(contextMenuButton); checkThatContextMenuNotExist(contextMenu); @@ -254,4 +255,33 @@ public class DrawingBoardPage extends VidBasePage { Assert.assertEquals(Get.byTestId(SERVICE_QUANTITY).getText(), (String.valueOf(expectedQuantity))); } + public static class ServiceStatusChecker implements Predicate<Boolean> { + private String actualInstanceName; + private Set<String> expectedStatuses; + private Set<String> columnClassesSet; + + public ServiceStatusChecker(String actualInstanceName, Set<String> expectedStatuses) { + this.actualInstanceName = actualInstanceName; + this.expectedStatuses = expectedStatuses; + } + + @Override + public boolean test(Boolean noMeaning) { + InstantiationStatusPage.clickRefreshButton(); + final WebElement row = InstantiationStatusPage.getInstantiationStatusRow(actualInstanceName); + if (row == null) { + System.err.println("**********************" + actualInstanceName + "************************************************"); + columnClassesSet = Collections.singleton(actualInstanceName + " NOT FOUND"); + return false; // treat missing row as if test condition not fulfilled + } else { + columnClassesSet = new HashSet<>(Arrays.asList( + row.findElements(By.xpath(".//*[@id='" + "jobStatus" + "']")).get(0).getAttribute("class").split(" "))); + return !(Sets.intersection(expectedStatuses, columnClassesSet).isEmpty()); + } + } + + public Set<String> getColumnClassesSet() { + return columnClassesSet; + } + } } 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 index e5dd1bb39..1bb095fda 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/InstantiationStatusPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/InstantiationStatusPage.java @@ -1,22 +1,36 @@ package vid.automation.test.sections; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.apache.http.NameValuePair; +import org.apache.http.client.utils.URLEncodedUtils; +import org.onap.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.Constants; +import vid.automation.test.infra.Click; import vid.automation.test.infra.Get; +import vid.automation.test.infra.Wait; +import java.nio.charset.Charset; +import java.util.List; import java.util.Map; +import java.util.function.Consumer; import java.util.stream.Collectors; +import static java.util.stream.Collectors.toMap; +import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; +import static org.testng.Assert.assertEquals; public abstract class InstantiationStatusPage extends VidBasePage { public static final String refreshButtonId = "refresh-btn"; + private static final String NEW_VIEW_EDIT_RELATIVE_URL = "serviceModels.htm#/servicePlanning"; + + public static String getWebTrTdSpanElementByParentID(WebElement tr, String id, int timeout) { return tr.findElements(By.xpath(".//*[@id='" + id + "']//span")).get(0).getText(); } @@ -55,5 +69,78 @@ public abstract class InstantiationStatusPage extends VidBasePage { GeneralUIUtils.ultimateWait(); } + public static void checkMenuItem(String actualInstanceName, String contextMenuItem, boolean shouldBeEnabled, Consumer<String> doIfEnabled) { + Wait.waitFor(name -> { + if (null == getInstantiationStatusRow(name)) { + clickRefreshButton(); + return false; + } else { + return true; + } + }, actualInstanceName, 8, 1); + final WebElement row = getInstantiationStatusRow(actualInstanceName); + row.findElement(By.className("menu-div")).click(); + String clazz = Get.byXpath("//div[@data-tests-id='" + contextMenuItem + "']/ancestor::li").getAttribute("class"); + assertThat("item " + contextMenuItem + " of " + actualInstanceName + + " should be " + (shouldBeEnabled ? "enabled" : "disabled"), !clazz.equals("disabled"), is(shouldBeEnabled)); + if (shouldBeEnabled) { + doIfEnabled.accept(contextMenuItem); + } else { + // dismiss menu + Get.byTestId("instantiation-status-title").click(); + } + } + public void showTooltipByHoverAboveStatusIcon(String elementTestId){ + WebElement selectedElement = GeneralUIUtils.getWebElementByTestID(elementTestId, 30); + } + + public static void openDrawingBoardForRetry(String serviceInstanceName) { + InstantiationStatusPage.checkMenuItem(serviceInstanceName, Constants.InstantiationStatus.CONTEXT_MENU_RETRY, true, contextMenuRetry -> { + Click.byTestId(contextMenuRetry); + VidBasePage.goOutFromIframe(); + verifyUrlPrefixMatchNewViewEdit("RETRY_EDIT"); + }); + } + + public static void verifyOpenNewViewEdit(String serviceInstanceName, String serviceInstanceId, String serviceModelId, String serviceType, String subscriberId, String mode) { + InstantiationStatusPage.checkMenuItem(serviceInstanceName, Constants.InstantiationStatus.CONTEXT_MENU_HEADER_OPEN_ITEM, true, contextMenuOpen -> { + Click.byTestId(contextMenuOpen); + VidBasePage.goOutFromIframe(); + verifyUrlMatchNewViewEdit(serviceInstanceId, serviceModelId, serviceType, subscriberId, mode); + SideMenu.navigateToMacroInstantiationStatus(); + }); + } + + public static void verifyOpenNewViewEdit(String serviceInstanceName, boolean openShouldBeEnabled, String expectedMode) { + InstantiationStatusPage.checkMenuItem(serviceInstanceName, Constants.InstantiationStatus.CONTEXT_MENU_HEADER_OPEN_ITEM, openShouldBeEnabled, contextMenuOpen -> { + Click.byTestId(contextMenuOpen); + VidBasePage.goOutFromIframe(); + verifyUrlPrefixMatchNewViewEdit(expectedMode); + SideMenu.navigateToMacroInstantiationStatus(); + }); + } + + public static void verifyUrlMatchNewViewEdit(String serviceInstanceId, String serviceModelId, String serviceType, String subscriberId, String expectedMode) { + verifyUrlPrefixMatchNewViewEdit(expectedMode); + Map<String, String> paramsMap = extractQueryParamsFromCurrentURL(NEW_VIEW_EDIT_RELATIVE_URL + "/" + expectedMode + "?"); + //assertEquals(paramsMap.get("mode"), expectedMode); + assertEquals(paramsMap.get("serviceInstanceId"), serviceInstanceId); + assertEquals(paramsMap.get("serviceModelId"), serviceModelId); + assertEquals(paramsMap.get("serviceType"), serviceType); + assertEquals(paramsMap.get("subscriberId"), subscriberId); + } + + protected static Map<String, String> extractQueryParamsFromCurrentURL(String relativePath) { + String currentUrl = GeneralUIUtils.getDriver().getCurrentUrl(); + //unfortunately parse(final URI uri, final String charset) can't handle with the #/ part of the uri + String urlSuffix = currentUrl.substring(currentUrl.indexOf(relativePath)+relativePath.length()); + List<NameValuePair> params = URLEncodedUtils.parse(urlSuffix, Charset.forName("UTF-8")); + return params.stream().collect(toMap(NameValuePair::getName, NameValuePair::getValue)); + } + + public static void verifyUrlPrefixMatchNewViewEdit(String expectedMode) { + String currentUrl = GeneralUIUtils.getDriver().getCurrentUrl(); + assertThat(currentUrl, containsString(NEW_VIEW_EDIT_RELATIVE_URL + "/" + expectedMode)); + } } diff --git a/vid-automation/src/main/java/vid/automation/test/sections/LoginExternalPage.java b/vid-automation/src/main/java/vid/automation/test/sections/LoginExternalPage.java index c1053d2a5..7a13e4d1b 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/LoginExternalPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/LoginExternalPage.java @@ -1,7 +1,7 @@ package vid.automation.test.sections; -import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.datatypes.UserCredentials; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import static org.junit.Assert.*; diff --git a/vid-automation/src/main/java/vid/automation/test/sections/PnfSearchAssociationPage.java b/vid-automation/src/main/java/vid/automation/test/sections/PnfSearchAssociationPage.java index 3f8061a78..2efb9f3c8 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/PnfSearchAssociationPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/PnfSearchAssociationPage.java @@ -1,7 +1,7 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import vid.automation.test.Constants; 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 index d5f39d959..cfbf025a6 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/PreviousVersionDialog.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/PreviousVersionDialog.java @@ -1,7 +1,7 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.RemoteWebElement; import vid.automation.test.infra.Get; 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 edfcd0e56..aa9675b76 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 @@ -1,7 +1,7 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import vid.automation.test.Constants; import vid.automation.test.infra.Click; 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 index a47870290..82f45ce7f 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/ServiceProxyPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/ServiceProxyPage.java @@ -1,7 +1,7 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.WebElement; import vid.automation.test.Constants; import vid.automation.test.infra.SelectOption; @@ -24,6 +24,11 @@ public class ServiceProxyPage extends VidBasePage { GeneralUIUtils.ultimateWait(); return this; } + public void assertCollectorServiceType(String collectorServiceType) { + String displayedCollectorServiceType = SelectOption.getSelectedOption("collectorServiceType"); + Assert.assertEquals("The displayed collector service type is incorrect", collectorServiceType, displayedCollectorServiceType); + } + public ServiceProxyPage chooseCollector(String collector){ GeneralUIUtils.ultimateWait(); SelectOption.byTestIdAndVisibleText(collector, Constants.ConfigurationCreation.COLLECTOR_DROPDOWN_TEST_ID); 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 0ba49f2d8..dc3de78dd 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 @@ -1,12 +1,16 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.ElementClickInterceptedException; import org.openqa.selenium.UnhandledAlertException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import vid.automation.test.Constants; public class SideMenu { + static final Logger logger = LoggerFactory.getLogger(SideMenu.class); + public static void navigateToBrowseASDCPage() { navigateToPage(Constants.SideMenu.BROWSE_ASDC_SERVICE_MODELS); } @@ -24,7 +28,7 @@ public class SideMenu { } public static void navigateToMacroInstantiationStatus() { - navigateToPage("Macro Instantiation Status"); + navigateToPage("Instantiation Status"); new VidBasePage().goToIframe(); } @@ -47,6 +51,7 @@ public class SideMenu { } }); GeneralUIUtils.ultimateWait(); + logger.info("navigated to {}", PageName); } public static void navigateToWelcomePage() { diff --git a/vid-automation/src/main/java/vid/automation/test/sections/TestEnvironmentPage.java b/vid-automation/src/main/java/vid/automation/test/sections/TestEnvironmentPage.java index f63906323..71c6e0bd4 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/TestEnvironmentPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/TestEnvironmentPage.java @@ -1,6 +1,6 @@ package vid.automation.test.sections; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.testng.Assert; 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 69aee494a..f749df02b 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,17 +1,10 @@ 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.*; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.onap.sdc.ci.tests.utilities.GeneralUIUtils.getDriver; +import com.aventstack.extentreports.Status; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -20,11 +13,25 @@ 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; +import org.junit.Assert; +import org.onap.sdc.ci.tests.execute.setup.ExtentTestActions; +import org.onap.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.Exists; +import vid.automation.test.infra.Get; +import vid.automation.test.infra.Input; +import vid.automation.test.infra.SelectOption; +import vid.automation.test.infra.Wait; public class VidBasePage { + public VidBasePage setInstanceName(String name) { setInputText(Constants.INSTANCE_NAME_SELECT_TESTS_ID, name); return this; @@ -97,6 +104,7 @@ public class VidBasePage { public VidBasePage clickDeployServiceButtonByServiceUUID(String serviceUUID) { Input.replaceText(serviceUUID, Constants.BROWSE_SEARCH); + GeneralUIUtils.ultimateWait(); String elementTestId = Constants.DEPLOY_BUTTON_TESTS_ID_PREFIX + serviceUUID; GeneralUIUtils.clickOnElementByTestId(elementTestId, 30); GeneralUIUtils.ultimateWait(); @@ -158,6 +166,11 @@ public class VidBasePage { return this; } + public VidBasePage clickButtonByTestId(String testId) { + GeneralUIUtils.clickOnElementByTestId(testId); + return this; + } + public VidBasePage clickCommitCloseButton() { GeneralUIUtils.clickOnElementByTestId(Constants.COMMIT_CLOSE_BUTTON_ID, 30); return this; @@ -174,11 +187,13 @@ public class VidBasePage { public VidBasePage selectLcpRegion(String lcpRegion) { + GeneralUIUtils.ultimateWait(); SelectOption.byValue(lcpRegion, Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID); return this; } public VidBasePage selectTenant(String tenant) { + GeneralUIUtils.ultimateWait(); SelectOption.byValue(tenant, Constants.ViewEdit.TENANT_SELECT_TESTS_ID); return this; } @@ -263,12 +278,12 @@ public class VidBasePage { Assert.assertEquals(expectedText, alertText); Click.acceptAlert(); } - public void goToIframe() { + public static 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( + final WebDriver iframeReady = new WebDriverWait(getDriver(), 20).until( ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.tagName("iframe")) ); Assert.assertNotNull("failed going into iframe", iframeReady); @@ -278,12 +293,41 @@ public class VidBasePage { System.out.println("ultimateWait waited " + (System.currentTimeMillis() - start2)); } - public void goOutFromIframe(){ + public static void goOutFromIframe(){ getDriver().switchTo().defaultContent(); } + public void verifyOpenOldViewEdit(String serviceInstanceName, String serviceInstanceId, boolean openShouldBeEnabled, boolean checkPortMirroring, boolean checkAddVnf) { + InstantiationStatusPage.checkMenuItem(serviceInstanceName, Constants.InstantiationStatus.CONTEXT_MENU_HEADER_OPEN_ITEM, openShouldBeEnabled, contextMenuOpen -> { + Click.byTestId(contextMenuOpen); + VidBasePage.goOutFromIframe(); + GeneralUIUtils.ultimateWait(); + Wait.byText("View/Edit Service Instance"); + if (serviceInstanceId != null) { + Wait.byText(serviceInstanceId); + } + Wait.byText(serviceInstanceName); + + if (checkPortMirroring) { + Wait.byText("Add node instance"); + Wait.byText("i'm a port"); + } + + if (checkAddVnf) { + // Validate bug fix - we open old popup in view/edit + Click.byTestId("addVNFButton"); + Click.byTestId("addVNFOption-2017-488_PASQUALE-vPE 0"); + assertThat(Get.byTestId("create-modal-title").getText(), containsString("a la carte")); + Click.byTestId("cancelButton"); + //end of bug fix validation + } + + screenshotDeployDialog("view-edit-" + serviceInstanceName); + SideMenu.navigateToMacroInstantiationStatus(); + }); + } public static WebDriverWait waitUntilDriverIsReady(int 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 633feb83d..e10c872ee 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 @@ -1,19 +1,16 @@ package vid.automation.test.sections; import org.junit.Assert; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import vid.automation.test.Constants; +import vid.automation.test.infra.Features; 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. */ @@ -70,8 +67,12 @@ public class ViewEditPage extends VidBasePage { return this; } - public ViewEditPage selectLCPRegion(String lcpRegion){ - SelectOption.byValue(lcpRegion, Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID); + public ViewEditPage selectLcpRegion(String lcpRegion, String cloudOwner){ + selectLcpRegion(lcpRegion); + if (Features.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST.isActive()) { + String selectedOption = SelectOption.getSelectedOption(Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID); + Assert.assertEquals(lcpRegion + " (" + cloudOwner.toUpperCase() + ")", selectedOption); + } return this; } @@ -91,6 +92,10 @@ public class ViewEditPage extends VidBasePage { return this; } + public VidBasePage clickActivateFabricConfigurationButton() { + GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.ACTIVATE_FABRIC_CONFIGURATION_BUTTON_TEST_ID, 60); + return this; + } public VidBasePage clickInfoButton() { GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.INFOSERVICEBUTTON, 30); return this; |