Related to issue 39597: Generate new scrims for webPOS to avoid the use of
authorJorge Garcia <jorge.garcia@openbravo.com>
Mon, 25 Feb 2019 12:28:55 +0100
changeset 8248 6fd3851e57dd
parent 8247 7df5f5f13306
child 8249 fa361dc75e2b
child 8288 f7b3862ae8f0
Related to issue 39597: Generate new scrims for webPOS to avoid the use of
enyo' scrim

Extend automated test scrim logic to cover all cases.

Deactivate enyo.$.scrim2 check, it is used in WebPOS menu to block the UI
and there is a lot of test keeping the menu opened at the end of the test.
src-test/org/openbravo/test/mobile/retail/pack/selenium/terminals/WebPOSTerminalHelper.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/terminals/WebPOSTerminalHelper.java	Sat Feb 23 21:00:44 2019 -0500
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/terminals/WebPOSTerminalHelper.java	Mon Feb 25 12:28:55 2019 +0100
@@ -146,7 +146,7 @@
 
   @Override
   public void afterSuccessfulTest_VerifyTerminalIsLeftAsTestStarted() {
-    verifyScrimIsHidden();
+    verifyAllScrimsAreHidden();
     verifyIsPosTerminalWindow();
     verifyOrderListIsEmpty();
     verifyOrderIsReset();
@@ -184,6 +184,60 @@
     assertThat("The test is finished but scrim is still shown", isScrimShown, equalTo(false));
   }
 
+  // private void verifyScrim2IsHidden() {
+  // logger.debug("Verifying that the scrim2 is hidden");
+  // final Boolean isScrim2Shown = (Boolean) SeleniumHelper
+  // .executeScriptWithReturn("enyo.$.scrim2.showing");
+  //
+  // assertThat("The test is finished but scrim2 is still shown", isScrim2Shown, equalTo(false));
+  // }
+
+  private void verifyTransparentScrimIsHidden() {
+    logger.debug("Verifying that the transparent scrim is hidden");
+    final Boolean isTransparentScrimShown = (Boolean) SeleniumHelper
+        .executeScriptWithReturn("OB.MobileApp.view.$.transparentScrim.showing");
+
+    assertThat("The test is finished but transparent scrim is still shown", isTransparentScrimShown,
+        equalTo(false));
+  }
+
+  private void verifyOpaqueScrimIsHidden() {
+    logger.debug("Verifying that the opaque scrim is hidden");
+    final Boolean isOpaqueScrimShown = (Boolean) SeleniumHelper
+        .executeScriptWithReturn("OB.MobileApp.view.$.opaqueScrim.showing");
+
+    assertThat("The test is finished but opaque scrim is still shown", isOpaqueScrimShown,
+        equalTo(false));
+  }
+
+  private void verifyProcessingScrimIsHidden() {
+    logger.debug("Verifying that the processing scrim is hidden");
+    final Boolean isProcessingScrimShown = (Boolean) SeleniumHelper
+        .executeScriptWithReturn("OB.MobileApp.view.$.processingContainer.showing");
+
+    assertThat("The test is finished but processing scrim is still shown", isProcessingScrimShown,
+        equalTo(false));
+  }
+
+  private void verifyLoadingScrimIsHidden() {
+    logger.debug("Verifying that the loading scrim is hidden");
+    final Boolean isLoadingScrimShown = (Boolean) SeleniumHelper
+        .executeScriptWithReturn("OB.MobileApp.view.$.containerLoading.showing");
+
+    assertThat("The test is finished but loading scrim is still shown", isLoadingScrimShown,
+        equalTo(false));
+  }
+
+  private void verifyAllScrimsAreHidden() {
+    verifyScrimIsHidden();
+    // Deactivate for the moment, because WebPOS menu uses scrim2 to block the UI
+    // verifyScrim2IsHidden();
+    verifyTransparentScrimIsHidden();
+    verifyOpaqueScrimIsHidden();
+    verifyProcessingScrimIsHidden();
+    verifyLoadingScrimIsHidden();
+  }
+
   private void verifyIsPosTerminalWindow() {
     logger.debug("Verifying that the application is in the pos window");
     final ApplicationWindow currentWindow = MobileCoreAPI.getCurrentWindow();