View Javadoc
1   /**
2    * Copyright 2005-2014 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.demo.lookup.view;
17  
18  import org.kuali.rice.krad.demo.ViewDemoAftBase;
19  import org.junit.Test;
20  
21  /**
22   * @author Kuali Rice Team (rice.collab@kuali.org)
23   */
24  public class DemoLookUpVerticallyStackedActionsAft extends ViewDemoAftBase {
25  
26      /**
27       * /kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewVerticalActions
28       */
29      public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewVerticalActions";
30  
31      /**
32       *	lookupCriteria[number] 
33       */
34      private static final String TRAVEL_ACCOUNT_NUMBER="lookupCriteria[number]";
35      
36      /**
37       *	lookupCriteria[name]
38       */
39      private static final String TRAVEL_ACCOUNT_NAME="lookupCriteria[name]";
40      
41      /**
42       *	Search 
43       */
44      private static final String SEARCH_BUTTON_TEXT="Search";
45      
46      /**
47       *	Clear Values 
48       */
49      private static final String CLEAR_VALUES_BUTTON_TEXT="Clear Values";
50      
51      /**
52       * lookupCriteria[fiscalOfficer.principalName]
53       */
54      private static final String PRINCIPAL_NAME="lookupCriteria[fiscalOfficer.principalName]";
55      
56      @Override
57      public String getBookmarkUrl() {
58          return BOOKMARK_URL;
59      }
60  
61      @Override
62      protected void navigate() throws Exception {
63          waitAndClickDemoLink();
64          waitAndClickByLinkText("Lookup vertically stacked actions");
65      }
66  
67      protected void testLookUpVerticallyStackedActions() throws InterruptedException {
68      	//Search By Number 
69      	waitAndTypeByName(TRAVEL_ACCOUNT_NUMBER,"a1");
70      	waitAndClickButtonByText(SEARCH_BUTTON_TEXT);
71          waitForProgressLoading();
72      	assertVerticallyStackedActions();
73      	waitAndClickButtonByText(CLEAR_VALUES_BUTTON_TEXT);
74  
75          //Search By Fiscal Officer
76          waitAndTypeByName(PRINCIPAL_NAME,"fran");
77          waitAndClickButtonByText(SEARCH_BUTTON_TEXT);
78          waitForProgressLoading();
79          assertVerticallyStackedActions();
80          waitAndClickButtonByText(CLEAR_VALUES_BUTTON_TEXT);
81  
82      	//Search By Name
83      	waitAndTypeByName(TRAVEL_ACCOUNT_NAME,"Travel Account 3");
84      	waitAndClickButtonByText(SEARCH_BUTTON_TEXT);
85          waitForProgressLoading();
86      	assertVerticallyStackedActions();
87      	waitAndClickButtonByText(CLEAR_VALUES_BUTTON_TEXT);
88      }
89      
90      private void assertVerticallyStackedActions() throws InterruptedException{
91      	waitIsVisibleByXpath("//a[contains(text(),'edit') and @class='uif-link uif-boxLayoutVerticalItem pull-left clearfix']");
92          assertTrue(isVisibleByXpath("//a[contains(text(),'copy') and @class='uif-link uif-boxLayoutVerticalItem pull-left clearfix']"));
93      }
94  
95      @Test
96      public void testLookUpVerticallyStackedActionsBookmark() throws Exception {
97          testLookUpVerticallyStackedActions();
98          passed();
99      }
100 
101     @Test
102     public void testLookUpVerticallyStackedActionsNav() throws Exception {
103         testLookUpVerticallyStackedActions();
104         passed();
105     }
106 }