aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java
diff options
context:
space:
mode:
Diffstat (limited to 'vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java')
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java44
1 files changed, 43 insertions, 1 deletions
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java b/vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java
index 8745001dd..0ba49f2d8 100644
--- a/vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java
+++ b/vid-automation/src/main/java/vid/automation/test/sections/SideMenu.java
@@ -2,6 +2,8 @@ package vid.automation.test.sections;
import org.junit.Assert;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.ElementClickInterceptedException;
+import org.openqa.selenium.UnhandledAlertException;
import vid.automation.test.Constants;
public class SideMenu {
@@ -21,10 +23,50 @@ public class SideMenu {
navigateToPage(Constants.SideMenu.TEST_ENVIRONMENTS);
}
+ public static void navigateToMacroInstantiationStatus() {
+ navigateToPage("Macro Instantiation Status");
+ new VidBasePage().goToIframe();
+ }
+
private static void navigateToPage(String PageName) {
+
boolean findAndWaitByText = GeneralUIUtils.findAndWaitByText(PageName, 30);
+
+ if (!findAndWaitByText) {
+ doEvenIfAlertIsShown(SideMenu::navigateToWelcomePage);
+ findAndWaitByText = GeneralUIUtils.findAndWaitByText(PageName, 10);
+ }
+
Assert.assertTrue(findAndWaitByText);
- GeneralUIUtils.clickOnElementByText(PageName, 150);
+ doEvenIfAlertIsShown(() -> {
+ try {
+ GeneralUIUtils.clickOnElementByText(PageName, 50);
+ } catch (ElementClickInterceptedException e) {
+ navigateToWelcomePage();
+ GeneralUIUtils.clickOnElementByText(PageName, 100);
+ }
+ });
GeneralUIUtils.ultimateWait();
}
+
+ public static void navigateToWelcomePage() {
+ doEvenIfAlertIsShown(() -> {
+ VidBasePage base = new VidBasePage();
+ base.navigateTo("welcome.htm");
+ });
+ }
+
+ private static void doEvenIfAlertIsShown(Runnable runnable) {
+ try {
+ runnable.run();
+ } catch (UnhandledAlertException e) {
+ // an alert popup was shown; dismiss it if it's still there
+ try {
+ GeneralUIUtils.getDriver().switchTo().alert().dismiss();
+ } catch (org.openqa.selenium.NoAlertPresentException e2) {
+ // YOLO
+ }
+ runnable.run();
+ }
+ }
}