diff options
author | Eylon Malin <eylon.malin@intl.att.com> | 2019-12-31 19:19:21 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-12-31 19:19:21 +0000 |
commit | b5df65390b7adf5c4d11a3bcf987242cff589a9d (patch) | |
tree | 1dde59c37616f9efa1529a4f02e9c655f0a56079 /vid-automation/src | |
parent | a4b0a6094174e03611f1a3e5b1a6b34871d8cecd (diff) | |
parent | 040dada78389a2a2092ea13679c1bc2a13fef99b (diff) |
Merge "Wait for loader on each Selenium's ulitimateWait"
Diffstat (limited to 'vid-automation/src')
3 files changed, 37 insertions, 28 deletions
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java index bded65be8..97938c741 100644 --- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java +++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java @@ -9,7 +9,6 @@ public class EcompPortalUtilities { WebElement appImage = GeneralUIUtils.getClickableButtonBy(by, 3 * 60); appImage.click(); GeneralUIUtils.getDriver().switchTo().frame(1); - GeneralUIUtils.waitForBackLoader(); GeneralUIUtils.waitForAngular(); GeneralUIUtils.getWebElementByClassName("applicationWindow"); } 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 e834c15ac..c2c93e734 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 @@ -21,33 +21,45 @@ package org.onap.sdc.ci.tests.utilities; //import com.automation.common.report_portal_integration.annotations.Step; + +import static org.hamcrest.Matchers.is; + import com.aventstack.extentreports.Status; +import java.awt.Robot; +import java.awt.event.KeyEvent; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; import org.apache.commons.io.FileUtils; import org.junit.Assert; import org.onap.sdc.ci.tests.datatypes.DataTestIdEnum; import org.onap.sdc.ci.tests.datatypes.DataTestIdEnum.DashboardCardEnum; import org.onap.sdc.ci.tests.execute.setup.DriverFactory; import org.onap.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openqa.selenium.*; +import org.openqa.selenium.By; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.Keys; +import org.openqa.selenium.NoSuchElementException; +import org.openqa.selenium.OutputType; +import org.openqa.selenium.TakesScreenshot; +import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.support.ui.*; +import org.openqa.selenium.support.ui.ExpectedCondition; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.FluentWait; +import org.openqa.selenium.support.ui.Select; +import org.openqa.selenium.support.ui.WebDriverWait; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.awt.*; -import java.awt.event.KeyEvent; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.function.Supplier; - -import static org.hamcrest.Matchers.is; - public final class GeneralUIUtils { @@ -131,6 +143,13 @@ public final class GeneralUIUtils { return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))); } + public static WebElement getWebElementByTestID(String dataTestId, String text, int timeout) { + WebElement webElementByTestID = getWebElementByTestID(dataTestId, timeout); + + newWait(timeout).until(ExpectedConditions.textToBePresentInElement(webElementByTestID, text)); + return webElementByTestID; + } + public static boolean isWebElementExistByTestId(String dataTestId) { if(getDriver().findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']")).size() == 0) { return false; @@ -355,8 +374,7 @@ public final class GeneralUIUtils { } public static void waitForLoader(int timeOut) { - sleep(1); - waitForElementInVisibilityBy(By.className("tlv-loader"), timeOut); + newWait(timeOut).until(ExpectedConditions.invisibilityOfElementLocated(By.className("sdc-loader-background"))); } public static void findComponentAndClick(String resourceName) throws Exception { @@ -630,6 +648,7 @@ public final class GeneralUIUtils { } catch (TimeoutException | org.openqa.selenium.ScriptTimeoutException e) { logger.info("Ignoring TimeoutException while waiting for angular2: {}", e, e); } + waitForLoader(10); } public static Object getAllElementAttributes(WebElement element) { @@ -807,13 +826,4 @@ public final class GeneralUIUtils { ultimateWait(); } - public static void waitForBackLoader() { - waitForBackLoader(timeOut); - } - - public static void waitForBackLoader(int timeOut) { - sleep(1); - waitForElementInVisibilityBy(By.className("tlv-loader-back"), timeOut); - } - } diff --git a/vid-automation/src/main/java/vid/automation/test/sections/deploy/DeployModernUIBase.java b/vid-automation/src/main/java/vid/automation/test/sections/deploy/DeployModernUIBase.java index 747f4ebde..dd605ff7c 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/deploy/DeployModernUIBase.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/deploy/DeployModernUIBase.java @@ -19,7 +19,7 @@ public abstract class DeployModernUIBase extends DeployDialogBase { String dialogTitle = "Set a new service instance"; public void assertTitle(){ - WebElement modalTitle = GeneralUIUtils.getWebElementByTestID(Constants.CREATE_MODAL_TITLE_ID, 30); + WebElement modalTitle = GeneralUIUtils.getWebElementByTestID(Constants.CREATE_MODAL_TITLE_ID, dialogTitle, 30); assertThat(modalTitle.getText(), containsString(dialogTitle)); } |