Related to issue 38888: Failing SS Build
authorMartin Taal <martin.taal@openbravo.com>
Sat, 01 Dec 2018 15:35:33 +0100
changeset 7927 7d7e8222f943
parent 7926 5adbc834bd0c
child 7928 6d89b465e0db
Related to issue 38888: Failing SS Build
When waiting for import entries to process request the system to do it for store1 and store2 testcases
src-test/org/openbravo/test/mobile/retail/mobilecore/javascript/MobileCoreAPI.java
src-test/org/openbravo/test/mobile/retail/mobilecore/javascript/SynchronizationMonitor.java
src-test/org/openbravo/test/mobile/retail/mobilecore/selenium/terminals/MobileCoreTerminalHelper.java
src-test/org/openbravo/test/mobile/retail/pack/database/WebPOSDatabaseHelper.java
--- a/src-test/org/openbravo/test/mobile/retail/mobilecore/javascript/MobileCoreAPI.java	Fri Nov 30 19:00:10 2018 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/mobilecore/javascript/MobileCoreAPI.java	Sat Dec 01 15:35:33 2018 +0100
@@ -305,6 +305,25 @@
     SeleniumHelper.executeScript(unHook);
   }
 
+  public static void requestProcessImportEntries() {
+    // only do this check for store or store2
+    if (!SequentialTestInfo.getServerType().equals(ServerType.STORE1)
+        &&
+        !SequentialTestInfo.getServerType().equals(ServerType.STORE2)) {
+      return;
+    }
+
+    String requestJS = "new enyo.Ajax({method: 'GET', handleAs: 'text', "
+        + "url: '../../org.openbravo.client.kernel?processId=C1A39F72074A4FAC8F354CF7CA1BF704"
+        + "&reportId=null&windowId=null"
+        + "&_action=org.openbravo.service.importprocess.ProcessImportEntriesProcessActionHandler"
+        + "&authenticationClient=' + OB.UTIL.localStorage.getItem('authenticationClient') + "
+        + "'&authenticationToken=' + OB.UTIL.localStorage.getItem('authenticationToken')}).go()";
+    SeleniumHelper.executeScript(requestJS);
+    // now give the system some time to process
+    OBUtils.pause(2000);
+  }
+
   public static void localStorageClear() {
     TestLogger.getLogger().info("Clearing the localStorage");
     SeleniumHelper.executeScript("OB.UTIL.localStorage.clear()");
--- a/src-test/org/openbravo/test/mobile/retail/mobilecore/javascript/SynchronizationMonitor.java	Fri Nov 30 19:00:10 2018 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/mobilecore/javascript/SynchronizationMonitor.java	Sat Dec 01 15:35:33 2018 +0100
@@ -154,6 +154,10 @@
         final ArrayList<Boolean> areEntriesProcessed = new ArrayList<Boolean>();
         areEntriesProcessed.add(false);
 
+        if (currentIteration > 2) {
+          MobileCoreAPI.requestProcessImportEntries();
+        }
+
         new DatabaseHelperSelect() {
           @Override
           protected void yieldResultSet(final ResultSet rs) throws SQLException {
--- a/src-test/org/openbravo/test/mobile/retail/mobilecore/selenium/terminals/MobileCoreTerminalHelper.java	Fri Nov 30 19:00:10 2018 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/mobilecore/selenium/terminals/MobileCoreTerminalHelper.java	Sat Dec 01 15:35:33 2018 +0100
@@ -124,7 +124,7 @@
 
   public MobileCoreTerminalHelper(final String path, final String terminal, final String username,
       final String password, final ServerType serverType) {
-    this(path, terminal, username, password, ServerType.SINGLESERVER, true, true);
+    this(path, terminal, username, password, serverType, true, true);
   }
 
   /**
--- a/src-test/org/openbravo/test/mobile/retail/pack/database/WebPOSDatabaseHelper.java	Fri Nov 30 19:00:10 2018 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/pack/database/WebPOSDatabaseHelper.java	Sat Dec 01 15:35:33 2018 +0100
@@ -51,6 +51,7 @@
 import org.openbravo.test.mobile.retail.mobilecore.database.DatabaseHelperStatement;
 import org.openbravo.test.mobile.retail.mobilecore.database.MobileCoreDatabaseHelper;
 import org.openbravo.test.mobile.retail.mobilecore.javascript.BackboneHelper;
+import org.openbravo.test.mobile.retail.mobilecore.javascript.MobileCoreAPI;
 import org.openbravo.test.mobile.retail.mobilecore.selenium.terminals.MobileCoreTerminalHelper;
 import org.openbravo.test.mobile.retail.pack.database.WebPOSDatabaseConstants.VBS_PAYMENTMETHOD;
 import org.openbravo.test.mobile.retail.pack.database.rows.CashupRow;
@@ -226,6 +227,7 @@
     while (countImportEntries("Initial", server) > 0) {
       OBUtils.pause(1000);
       cnt++;
+      MobileCoreAPI.requestProcessImportEntries();
       if (cnt > 10) {
         throw new IllegalStateException(
             "Waiting too long for initial import entries to get processed");