Related to issue 38888: Failing SS Build
authorMartin Taal <martin.taal@openbravo.com>
Sat, 17 Nov 2018 10:57:57 +0100
changeset 7880 fb58b6649fec
parent 7877 2a2eb584607d
child 7881 88e2916a023b
Related to issue 38888: Failing SS Build
Wait for offline really happening before clicking scrim, also force offline in normal mode
src-test/org/openbravo/test/mobile/retail/multiserver/MultiserverOfflineUtils.java
src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSCentralOfflineTerminalHelper.java
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/MultiserverOfflineUtils.java	Fri Nov 16 15:20:20 2018 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/MultiserverOfflineUtils.java	Sat Nov 17 10:57:57 2018 +0100
@@ -58,7 +58,7 @@
 
     TestLogger.getLogger().info("Apache is running in central");
     TestLogger.getLogger().info("Transitioning to online");
-    waitForTransitioningOnline();
+    waitForOnline();
     checkStatus("ON");
     TestLogger.getLogger().info("ONLINE MODE ENABLED");
   }
@@ -76,11 +76,11 @@
     TestLogger.getLogger().info("Apache is stopped in central");
   }
 
-  public static void waitForTransitioningOffline() {
+  public static void waitForOffline() {
     waitForStatus("OFF");
   }
 
-  public static void waitForTransitioningOnline() {
+  public static void waitForOnline() {
     waitForStatus("ON");
   }
 
--- a/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSCentralOfflineTerminalHelper.java	Fri Nov 16 15:20:20 2018 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/multiserver/selenium/terminals/WebPOSCentralOfflineTerminalHelper.java	Sat Nov 17 10:57:57 2018 +0100
@@ -30,6 +30,7 @@
 import org.openbravo.test.mobile.retail.mobilecore.selenium.TestIdConstructor;
 import org.openbravo.test.mobile.retail.multiserver.MultiserverOfflineUtils;
 import org.openbravo.test.mobile.retail.multiserver.selenium.TestIdMultiserver;
+import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack;
 
 public class WebPOSCentralOfflineTerminalHelper extends WebPOSStore1TerminalHelper {
 
@@ -52,36 +53,46 @@
     TestLogger.getLogger().info("Force transitioning to offline");
 
     // switch between modes that forces request
+    // works for high volume mode, but not for normal mode
     tap(TestIdMultiserver.BUTTON_SCAN);
     tap(TestIdMultiserver.BUTTON_SEARCH);
 
+    // wait some time to give the store time to go offline
+    OBUtils.pause(5000);
+    if (isScrimShowing()) {
+      handleOffline();
+      return;
+    }
+
+    // not offline happens to be robust execute search,
+    // this works in high volume mode when queries are done on the server
+    // on normal mode we need to create a layaway to force offline
+    write(TestIdMultiserver.FIELD_SEARCH_TEXT,
+        TestIdMultiserver.BUTTON_SEARCHPRODUCT_ADHESIVEBODYWARNMERS.getRowName());
+    tap(TestIdPack.BUTTON_SEARCH_EXECUTE);
+
     // wait a little
     OBUtils.pause(5000);
     if (isScrimShowing()) {
-      tapTransitionToOffline();
-      MultiserverOfflineUtils.checkStatus("OFF");
-      TestLogger.getLogger().info("OFFLINE MODE ENABLED");
+      handleOffline();
       return;
     }
 
-    // enter search text, possibly not needed
-    write(TestIdMultiserver.FIELD_SEARCH_TEXT,
-        TestIdMultiserver.BUTTON_SEARCHPRODUCT_ADHESIVEBODYWARNMERS.getRowName());
+    // create a layaway to force offline
+    tap(TestIdPack.BUTTON_SEARCH);
+    write(TestIdPack.FIELD_SEARCH_TEXT, TestIdPack.BUTTON_SEARCHPRODUCT_ALPINESKIING.getRowName());
+    tap(TestIdPack.BUTTON_SEARCH_EXECUTE);
+    tap(TestIdPack.BUTTON_SEARCHPRODUCT_ALPINESKIING);
+    tap(TestIdPack.BUTTON_MENU);
+    tap(TestIdPack.BUTTON_MENU_LAYAWAYTHISRECEIPT);
+    tap(TestIdPack.BUTTON_LAYAWAY);
 
-    // wait a little
-    OBUtils.pause(5000);
-    if (isScrimShowing()) {
-      tapTransitionToOffline();
-      MultiserverOfflineUtils.checkStatus("OFF");
-      TestLogger.getLogger().info("OFFLINE MODE ENABLED");
-      return;
-    }
+    handleOffline();
+  }
 
-    // nothing triggered... now do a real long wait
-    MultiserverOfflineUtils.waitForTransitioningOffline();
-
+  protected void handleOffline() {
+    MultiserverOfflineUtils.waitForOffline();
     tapTransitionToOffline();
-
     MultiserverOfflineUtils.checkStatus("OFF");
     TestLogger.getLogger().info("OFFLINE MODE ENABLED");
   }