Related to issue 28933. Verifies issue 29410: Added the 'I29410_LoginFailDoesNotResetIsloggingin' test (I y II)
authorRafa Alonso <rafael.alonso@openbravo.com>
Wed, 25 Mar 2015 17:40:47 +0100
changeset 4113 fcdbe670ff9a
parent 4112 25b3f715ffa2
child 4114 001f214c9264
Related to issue 28933. Verifies issue 29410: Added the 'I29410_LoginFailDoesNotResetIsloggingin' test (I y II)
src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/loginout/I29410_LoginFailDoesNotResetIsloggingin.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/loginout/I29410_LoginFailDoesNotResetIsloggingin.java	Wed Mar 25 17:40:47 2015 +0100
@@ -0,0 +1,99 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo S.L.U.
+ * All portions are Copyright (C) 2015 Openbravo S.L.U.
+ * All Rights Reserved.
+ * Contributor(s):
+ ************************************************************************
+ *
+ * @author RAL
+ *
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.loginout;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.junit.After;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized.Parameters;
+import org.openbravo.test.mobile.common.selenium.SeleniumHelper;
+import org.openbravo.test.mobile.common.selenium.javascript.TestId;
+import org.openbravo.test.mobile.common.selenium.terminals.WebPOSTerminalHelper;
+import org.openbravo.test.mobile.common.selenium.testhelpers.RetryRunnerParameterized;
+
+/**
+ * Test the error displayed when wrong credentials are entered in the login page.
+ */
+@RunWith(RetryRunnerParameterized.class)
+public class I29410_LoginFailDoesNotResetIsloggingin extends WebPOSTerminalHelper {
+
+  /**
+   * Test parameters.
+   *
+   * @return collection of string arrays with data for the test.
+   */
+  @Parameters(name = "({index}) username: {0}, password: {1}")
+  public static Collection<String[]> getTestParameters() {
+    final ArrayList<String[]> parameters = new ArrayList<String[]>();
+    parameters.add(new String[] { "Vallblanca", "abc" });
+    return parameters;
+  }
+
+  public I29410_LoginFailDoesNotResetIsloggingin(final String username, final String password) {
+    super(false, username, password);
+  }
+
+  @Override
+  protected void postLogInActions() {
+    // do nothing because the test is expected to fail at log in
+  }
+
+  @Override
+  public void afterSuccessfulTest_VerifyTerminalIsLeftAsTestStarted() {
+    // do nothing because the test is expected to fail at log in
+  }
+
+  @Override
+  protected void afterTest_Verifications() {
+    // do nothing because the test is expected to fail at log in
+  }
+
+  /**
+   * Test the error displayed when wrong credentials are entered in the login page.
+   */
+  @Test
+  public void test() {
+    verify(TestId.LABEL_POPUP_CONFIRMATION_TITLE,
+        "Invalid user name or password.\nPlease try again.");
+    tap(TestId.BUTTON_POPUP_CONFIRMATION_OK);
+    verifyLoginPage();
+
+    final boolean valueOfIsLogginIn = (Boolean) SeleniumHelper
+        .executeScriptWithReturn("OB.MobileApp.model.attributes.isLoggingIn");
+    assertThat("OB.MobileApp.model.attributes.isLoggingIn should have been reset",
+        valueOfIsLogginIn, equalTo(false));
+  }
+
+  @Override
+  @After
+  public void after() {
+    // do nothing
+  }
+
+}