View Javadoc
1   /**
2    * Copyright 2005-2016 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 org.kuali.rice.krad.labs.lookups;
17  
18  import org.junit.Test;
19  import org.openqa.selenium.By;
20  
21  /**
22   * @author Kuali Rice Team (rice.collab@kuali.org)
23   */
24  public class LabsLookupMaskedFieldAft extends LabsLookupBase {
25  
26      /**
27       * /kr-krad/lookup?methodToCall=start&viewId=LabsLookup-MaskedFieldView
28       */
29      public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LabsLookup-MaskedFieldView&hideReturnLink=true";
30      
31      @Override
32      protected String getBookmarkUrl() {
33          return BOOKMARK_URL;
34      }
35  
36      @Override
37      protected void navigate() throws Exception {
38          navigateToLookup("Lookup with Masked Field");
39      }
40  
41      @Test
42      public void testLabsLookupMaskedFieldBookmark() throws Exception {
43          testLabsLookupMaskedFieldNoSearchCriteria();
44          testLabsLookupMaskedField();
45          testLabsLookupMaskedFieldWildcard();
46          passed();
47      }
48  
49      @Test
50      public void testLabsLookupMaskedFieldNav() throws Exception {
51          testLabsLookupMaskedFieldNoSearchCriteria();
52          testLabsLookupMaskedField();
53          testLabsLookupMaskedFieldWildcard();
54          passed();
55      }
56  
57      protected void testLabsLookupMaskedField()throws Exception {
58          waitAndTypeByName("lookupCriteria[number]","a1*");
59          waitAndSelectByName("uLookupResults_layout_length", "25");
60          assertTextPresent(new String[] {"a14", "*********"});
61          waitAndClickButtonByText("Clear Values");
62          waitAndTypeByName("lookupCriteria[name]","Travel Account 1");
63          waitAndClickButtonByText("Search");
64          assertTextPresent(new String[] {"a1", "*********"});
65      }
66  
67      protected void testLabsLookupMaskedFieldWildcard()throws Exception {
68          waitForElementVisibleBy(By.name("lookupCriteria[name]"));
69          clearTextByName("lookupCriteria[name]");
70          waitAndTypeByName("lookupCriteria[number]","a1*");
71          waitAndTypeByName("lookupCriteria[name]","Travel *");
72          waitAndClickButtonByText("Search");
73          waitForTextPresent("Travel Account Name is a secure field. Wildcards are not allowed on secure fields.");
74      }
75  
76      protected void testLabsLookupMaskedFieldNoSearchCriteria()throws Exception {
77          waitAndClickButtonByText("Search");
78          waitForProgressLoading();
79          waitForTextPresent("Showing 1 to 10 of");
80      }
81  }