View Javadoc
1   /**
2    * Copyright 2005-2015 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package edu.sampleu;
17  
18  import org.junit.Test;
19  import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
20  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21  import org.kuali.rice.testtools.selenium.WebDriverUtils;
22  
23  /**
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   */
26  public class LoginInvalidUserAft extends WebDriverLegacyITBase {
27  
28      @Override
29      protected String getBookmarkUrl() {
30          return AutomatedFunctionalTestUtils.PORTAL;
31      }
32  
33      @Override
34      protected void navigate() throws Exception {
35          // no-op should not need to navigate for invalid login test
36      }
37  
38      @Override
39      public void testSetUp()  {
40          System.setProperty(WebDriverUtils.REMOTE_AUTOLOGIN_PROPERTY, "false"); // turn off auto login so we can test invalid login
41          super.testSetUp();
42      }
43  
44      @Test
45      public void testAdStarUserNameBookmark() throws InterruptedException {
46          try {
47              System.setProperty(WebDriverUtils.REMOTE_AUTOLOGIN_PROPERTY, "true");
48              login(driver, "ad*", this);
49              fail("Expected Invalid Login exception with user " + AutomatedFunctionalTestUtils.DTS_TWO);
50          } catch (AssertionError e) {
51              waitForElementVisibleById("Rice-LoginButton", "ad* should not be a valid login");
52              passed();
53          }
54      }
55  
56      /**
57       * Invalid user name test
58       * @throws InterruptedException
59       */
60      @Test
61      public void testInvalidUserNameBookmark() throws InterruptedException {
62          try {
63              System.setProperty(WebDriverUtils.REMOTE_AUTOLOGIN_PROPERTY, "true");
64              login(driver, AutomatedFunctionalTestUtils.DTS_TWO, this);
65              fail("Expected Invalid Login exception with user " + AutomatedFunctionalTestUtils.DTS_TWO);
66          } catch (AssertionError e) {
67              assertTrue(e.getMessage().contains("Invalid"));
68              passed();
69          }
70      }
71  }