summaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2020-01-02 12:00:56 +0200
committerIttay Stern <ittay.stern@att.com>2020-01-02 15:32:49 +0200
commit966a6edb60ac187253b8801733ffc7e52fc45392 (patch)
tree44477c45697c1ec1c8f0fdeff4465c473fd61bca /vid-automation/src/main/java
parentfa4d3e58748b5e35961f40bfec579ab8c14bae95 (diff)
Be more graceful for timeouts while Selenium
Issue-ID: VID-647 Change-Id: I0137af588d01b8cad7a9d26ac9789d1685ad0c02 Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-automation/src/main/java')
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java15
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/VidBasePage.java41
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/deploy/DeployModernUIBase.java1
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/InstantiationStatusTest.java27
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/VidBaseTestCase.java2
5 files changed, 56 insertions, 30 deletions
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 c2c93e734..dd632d201 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
@@ -642,13 +642,14 @@ public final class GeneralUIUtils {
public static void waitForAngular2(){
WebDriverWait wait = newWait(90);
wait.until(AdditionalConditions.pageLoadWait());
+ waitForLoader(60);
try {
- WebDriverWait briefWait = newWait(2);
+ WebDriverWait briefWait = newWait(3);
briefWait.until(AdditionalConditions.angular2HasFinishedProcessing());
} catch (TimeoutException | org.openqa.selenium.ScriptTimeoutException e) {
logger.info("Ignoring TimeoutException while waiting for angular2: {}", e, e);
+ waitForLoader(30);
}
- waitForLoader(10);
}
public static Object getAllElementAttributes(WebElement element) {
@@ -826,4 +827,14 @@ public final class GeneralUIUtils {
ultimateWait();
}
+ public static void acceptDeadObjectException(Runnable todo) {
+ try {
+ todo.run();
+ } catch (org.openqa.selenium.WebDriverException e) {
+ if (!e.getMessage().startsWith("TypeError: can't access dead object")) {
+ throw e;
+ }
+ }
+ }
+
}
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 43dd68f06..0312208c3 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,16 +1,10 @@
package vid.automation.test.sections;
-import com.aventstack.extentreports.Status;
-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.*;
-import org.openqa.selenium.support.ui.ExpectedConditions;
-import org.openqa.selenium.support.ui.WebDriverWait;
-import vid.automation.test.Constants;
-import vid.automation.test.Constants.ViewEdit;
-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;
@@ -19,12 +13,25 @@ import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.function.Function;
-
-import static java.util.stream.Collectors.toMap;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.onap.sdc.ci.tests.utilities.GeneralUIUtils.getDriver;
-import static org.testng.Assert.assertEquals;
+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.JavascriptExecutor;
+import org.openqa.selenium.TimeoutException;
+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.Constants.ViewEdit;
+import vid.automation.test.infra.Click;
+import vid.automation.test.infra.Exists;
+import vid.automation.test.infra.Features;
+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 {
@@ -276,6 +283,7 @@ public class VidBasePage {
}
String target = uri.resolve(path).toString();
+ goOutFromIframe();
getDriver().navigate().to(target);
GeneralUIUtils.ultimateWait();
@@ -308,6 +316,7 @@ public class VidBasePage {
}
public static void goOutFromIframe(){
+ GeneralUIUtils.acceptDeadObjectException(GeneralUIUtils::ultimateWait);
getDriver().switchTo().defaultContent();
}
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 dd605ff7c..acddc1b11 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
@@ -28,6 +28,7 @@ public abstract class DeployModernUIBase extends DeployDialogBase {
GeneralUIUtils.ultimateWait();
clickCancelButtonByTestID();
goOutFromIframe();
+ GeneralUIUtils.ultimateWait();
}
@Override
diff --git a/vid-automation/src/main/java/vid/automation/test/test/InstantiationStatusTest.java b/vid-automation/src/main/java/vid/automation/test/test/InstantiationStatusTest.java
index 4eb637a10..70fe620fa 100644
--- a/vid-automation/src/main/java/vid/automation/test/test/InstantiationStatusTest.java
+++ b/vid-automation/src/main/java/vid/automation/test/test/InstantiationStatusTest.java
@@ -1,34 +1,37 @@
package vid.automation.test.test;
+import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.SERVICE_NAME;
+import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.VNF_NAME;
+import static org.testng.Assert.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+import static vid.automation.test.Constants.DrawingBoard.DEPLOY_BUTTON;
+
import com.google.common.collect.ImmutableMap;
+import java.util.Collections;
import org.junit.Assert;
+import org.onap.sdc.ci.tests.datatypes.UserCredentials;
+import org.onap.sdc.ci.tests.utilities.GeneralUIUtils;
import org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames;
import org.onap.vid.api.AsyncInstantiationBase;
import org.onap.vid.api.CreateServiceWithFailedVnf;
import org.onap.vid.api.TestUtils;
-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 org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import vid.automation.test.Constants;
-import vid.automation.test.infra.*;
+import vid.automation.test.infra.Click;
+import vid.automation.test.infra.FeatureTogglingTest;
+import vid.automation.test.infra.Features;
+import vid.automation.test.infra.Get;
+import vid.automation.test.infra.Wait;
import vid.automation.test.sections.DrawingBoardPage;
import vid.automation.test.sections.InstantiationStatusPage;
import vid.automation.test.sections.SideMenu;
import vid.automation.test.sections.VidBasePage;
import vid.automation.test.services.AsyncJobsService;
-import java.util.Collections;
-
-import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.SERVICE_NAME;
-import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.VNF_NAME;
-import static org.testng.Assert.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import static vid.automation.test.Constants.DrawingBoard.DEPLOY_BUTTON;
-
public class InstantiationStatusTest extends VidBaseTestCase {
private final String serviceModelVersion = "5.1";
@@ -126,6 +129,8 @@ public class InstantiationStatusTest extends VidBaseTestCase {
}
private void checkFailedAuditInfoOnRetry(String instanceName, String requestId, String message) {
+ GeneralUIUtils.ultimateWait();
+
WebElement webElement = Get.byTestId("model-item-value-instance_name");
assertEquals(webElement.getText(), instanceName, "Instance Name must be equal");
diff --git a/vid-automation/src/main/java/vid/automation/test/test/VidBaseTestCase.java b/vid-automation/src/main/java/vid/automation/test/test/VidBaseTestCase.java
index 41ede9a3f..c2733f0fb 100644
--- a/vid-automation/src/main/java/vid/automation/test/test/VidBaseTestCase.java
+++ b/vid-automation/src/main/java/vid/automation/test/test/VidBaseTestCase.java
@@ -190,7 +190,7 @@ public class VidBaseTestCase extends SetupCDTest{
@BeforeSuite(alwaysRun = true)
public void setSmallDefaultTimeout() throws Exception {
- getDriver().manage().timeouts().implicitlyWait(250, TimeUnit.MILLISECONDS);
+ getDriver().manage().timeouts().implicitlyWait(500, TimeUnit.MILLISECONDS);
}
@Override