Related to issue 38888: Failing SS Build, handle source not cached message
authorMartin Taal <martin.taal@openbravo.com>
Wed, 30 Jan 2019 19:40:46 +0100
changeset 8161 fba6714fd9e7
parent 8125 ae12ce12dd11
child 8162 3a1b41b3bc5f
Related to issue 38888: Failing SS Build, handle source not cached message
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSCentralOfflineTerminalHelper.java
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSStore1TerminalHelper.java
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSCentralOfflineTerminalHelper.java	Wed Jan 30 06:51:03 2019 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSCentralOfflineTerminalHelper.java	Wed Jan 30 19:40:46 2019 +0100
@@ -43,7 +43,7 @@
   public final TestRule globalTimeout = new Timeout(OBConstants.TEST_TIMEOUT * 2 * 1000);
 
   @AfterClass
-  public static void afterTheClass() {
+  public static void afterTfheClass() {
     OBOfflineUtils.startApache();
     MultiserverOfflineUtils.goCentralOnline();
   }
@@ -128,12 +128,6 @@
     TestLogger.getLogger().info("OFFLINE MODE ENABLED");
   }
 
-  protected boolean isScrimShowing() {
-    final Boolean isScrimShown = (Boolean) SeleniumHelper
-        .executeScriptWithReturn("enyo.$.scrim.showing");
-    return isScrimShown;
-  }
-
   protected void tapTransitionToOffline() {
     final Boolean isScrimShown = (Boolean) SeleniumHelper
         .executeScriptWithReturn("enyo.$.scrim.showing");
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSStore1TerminalHelper.java	Wed Jan 30 06:51:03 2019 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSStore1TerminalHelper.java	Wed Jan 30 19:40:46 2019 +0100
@@ -21,9 +21,13 @@
 
 import org.junit.After;
 import org.junit.Before;
+import org.openbravo.test.mobile.core.selenium.SeleniumHelper;
+import org.openbravo.test.mobile.core.utils.OBUtils;
 import org.openbravo.test.mobile.retail.mobilecore.javascript.MobileCoreAPI;
 import org.openbravo.test.mobile.retail.mobilecore.javascript.SynchronizationMonitor;
+import org.openbravo.test.mobile.retail.mobilecore.selenium.TestIdConstructor;
 import org.openbravo.test.mobile.retail.multiserver.MultiserverUtils;
+import org.openbravo.test.mobile.retail.multiserver.selenium.TestIdMultiserver;
 import org.openbravo.test.mobile.retail.pack.database.ServerType;
 import org.openbravo.test.mobile.retail.pack.database.WebPOSDatabaseHelper;
 import org.openbravo.test.mobile.retail.pack.selenium.terminals.WebPOSTerminalHelper;
@@ -91,4 +95,26 @@
     return ServerType.STORE1;
   }
 
+  protected void postLogInActions() {
+    if (isScrimShowing()) {
+      TestIdConstructor dom = TestIdMultiserver.BUTTON_POPUP_OK;
+      dom.enyoNode().waitUntilIsReady();
+      final String idDom = dom.enyoNode().getIdDOM();
+      final String isHiddenScript = String
+          .format("document.getElementById('%s').style.display === 'none'", idDom);
+      if (!(Boolean) SeleniumHelper.executeScriptWithReturn(isHiddenScript)) {
+        // give the scrim time to show/build
+        OBUtils.pause(1000);
+        tap(dom);
+      }
+    }
+    super.postLogInActions();
+  }
+
+  protected boolean isScrimShowing() {
+    final Boolean isScrimShown = (Boolean) SeleniumHelper
+        .executeScriptWithReturn("enyo.$.scrim.showing");
+    return isScrimShown;
+  }
+
 }