aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2019-12-31 19:09:31 +0200
committerIttay Stern <ittay.stern@att.com>2019-12-31 19:10:59 +0200
commit040dada78389a2a2092ea13679c1bc2a13fef99b (patch)
tree3789b18285fb2ca19e2aa3c1535e556aaef4159d /vid-automation
parent5a6827854508ed8e0cbfb0611cb5261b8564b0be (diff)
Wait for loader on each Selenium's ulitimateWait
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>
Diffstat (limited to 'vid-automation')
-rw-r--r--vid-automation/pom.xml2
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java1
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java62
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/deploy/DeployModernUIBase.java2
4 files changed, 38 insertions, 29 deletions
diff --git a/vid-automation/pom.xml b/vid-automation/pom.xml
index 697e1a910..16a756c3d 100644
--- a/vid-automation/pom.xml
+++ b/vid-automation/pom.xml
@@ -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>
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));
}