Wait for loader on each Selenium's ulitimateWait 54/99954/1
authorIttay Stern <ittay.stern@att.com>
Tue, 31 Dec 2019 17:09:31 +0000 (19:09 +0200)
committerIttay Stern <ittay.stern@att.com>
Tue, 31 Dec 2019 17:10:59 +0000 (19:10 +0200)
Also upgrade selenium.version to latest: 3.141.59

Issue-ID: VID-647

Change-Id: I3a3f6ba876e864a4e20b1c7ab309a1dfc45d4277
Signed-off-by: Ittay Stern <ittay.stern@att.com>
vid-automation/pom.xml
vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java
vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java
vid-automation/src/main/java/vid/automation/test/sections/deploy/DeployModernUIBase.java

index 697e1a9..16a756c 100644 (file)
@@ -11,7 +11,7 @@
         <jackson.version>2.9.9</jackson.version>
         <jackson.databind.version>2.9.9.3</jackson.databind.version>
         <aspectj.version>1.8.10</aspectj.version>
-        <selenium.version>3.6.0</selenium.version>
+        <selenium.version>3.141.59</selenium.version>
         <log4j.version>2.12.0</log4j.version>
         <apachehttp.version>4.4.1</apachehttp.version>
 
index bded65b..97938c7 100644 (file)
@@ -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");
        }
index e834c15..c2c93e7 100644 (file)
 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);
-       }
-
 }
index 747f4eb..dd605ff 100644 (file)
@@ -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));
     }