From b63178807f1897fa94945109e88e075b0c8cbfab Mon Sep 17 00:00:00 2001 From: Eylon Malin Date: Tue, 10 Dec 2019 09:30:48 +0200 Subject: fix and improve testClickPreviousInstantiationsInCreationDialog Issue-ID: VID-724 Signed-off-by: Eylon Malin Change-Id: I85d4d2735e89df09ef831de49cee819a4b03aa4a --- .../test/sections/InstantiationStatusPage.java | 32 ++++++++++------------ .../vid/automation/test/test/BrowseASDCTest.java | 31 +++++++++++++++------ 2 files changed, 37 insertions(+), 26 deletions(-) (limited to 'vid-automation/src') 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 e8b002cb1..4bd380841 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,5 +1,16 @@ package vid.automation.test.sections; +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; + +import java.nio.charset.Charset; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; +import java.util.stream.Collectors; import org.apache.http.NameValuePair; import org.apache.http.client.utils.URLEncodedUtils; import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; @@ -10,20 +21,9 @@ 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.Input; 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"; @@ -40,11 +40,9 @@ public abstract class InstantiationStatusPage extends VidBasePage { return wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//*[table]//tbody/tr"))).size(); } - public static void verifyUrlMatchInstantiationStatusWithFilterSearchParam(String serviceModelId) { - - Map paramsMap = extractQueryParamsFromCurrentURL("instantiationStatus?"); - assertEquals(paramsMap.get("filterText"), serviceModelId); - + public static void verifyInstantiationStatusFilterValue(String serviceModelId) { + final String filterValue = Input.getValueByTestId("instantiation-status-filter"); + assertEquals(filterValue, serviceModelId); } public static WebElement assertInstantiationStatusRow(String spanIdSelector, Map fieldsIdsAndExpected) { 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 03006ade7..f6b883ac1 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 @@ -14,6 +14,8 @@ import static vid.automation.test.infra.ModelInfo.aLaCarteForBrowseSdc; import static vid.automation.test.infra.ModelInfo.aLaCarteServiceCreationTest; import static vid.automation.test.infra.ModelInfo.instantiationTypeAlacarte_vidNotionsInstantiationUIByUUID; import static vid.automation.test.infra.ModelInfo.macroForBrowseSdc; +import static vid.automation.test.sections.VidBasePage.goOutFromIframe; +import static vid.automation.test.sections.VidBasePage.goToIframe; import com.google.common.collect.ImmutableList; import java.util.List; @@ -299,7 +301,10 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { @DataProvider public static Object[][] filterTexts() { - return new Object[][]{{serviceName},{modelInvariantId},{serviceUuid}}; + return new Object[][]{ + {serviceName}, + {modelInvariantId}, + {serviceUuid}}; } @Test(dataProvider = "filterTexts") @@ -335,14 +340,22 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { @Test @FeatureTogglingTest(FLAG_2004_TEMP_BUTTON_TO_INSTANTIATION_STATUS_FILTER) - private void testClickPreviousInstantiationsInCreationDialog() throws Exception { - - String serviceId = "2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"; - DeployModernUIMacroDialog deployMacroDialog = getDeployModernUIMacroDialog(serviceId); - deployMacroDialog.clickPreviousInstantiationButton(); - - InstantiationStatusPage.verifyUrlMatchInstantiationStatusWithFilterSearchParam(serviceId); - + public void testClickPreviousInstantiationsInCreationDialog() { + try { + String serviceId = "2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"; + DeployModernUIMacroDialog deployMacroDialog = getDeployModernUIMacroDialog(serviceId); + deployMacroDialog.clickPreviousInstantiationButton(); + + //exit form deploy dialog + goOutFromIframe(); + //go into Instantiation Status page + goToIframe(); + + InstantiationStatusPage.verifyInstantiationStatusFilterValue(serviceId); + } + finally { + goOutFromIframe(); + } } private BrowseASDCPage registerSimulatorAndGoToBrowseSDC() { -- cgit 1.2.3-korg