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.uif.library.clientresponsiveness;
17  
18  import org.junit.Test;
19  
20  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class LibraryClientResponsivenessEnterKeySupportAft extends WebDriverLegacyITBase {
26  
27      /**
28       * /kr-krad/kradsampleapp?viewId=Demo-EnterKeySupport
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-EnterKeySupport";
31      
32      @Override
33      protected String getBookmarkUrl() {
34          return BOOKMARK_URL;
35      }
36  
37      @Override
38      protected void navigate() throws Exception {
39          waitAndClickLibraryLink();
40          waitAndClickByLinkText("Client Responsiveness");
41          waitAndClickByLinkText("Enter Key Support");
42      }
43  
44      protected void testClientResponsivenessEnterKeySupportDefaultViewKey() throws Exception {
45      	waitAndClickByXpath("//section[@id='Demo-EnterKeySupport-Example1']/a");
46      	switchToWindow("Kuali Default View Key");
47      	pressEnterByName("field1");
48      	acceptAlertIfPresent();
49      	switchToWindow("Kuali");
50      }
51      
52      protected void testClientResponsivenessEnterKeySupportDefaultPageKey() throws Exception {
53      	waitAndClickByXpath("//a[@id='Demo-EnterKeySupport-Example2_tab']");
54      	waitAndClickByXpath("//section[@id='Demo-EnterKeySupport-Example2']/a");
55      	switchToWindow("Kuali Default Page Key");
56      	pressEnterByName("field1");
57      	acceptAlertIfPresent();
58      	waitAndClickByXpath("//a[@name='Demo-EnterKeySupport-Example2-Page2']");
59      	pressEnterByName("field2");
60      	acceptAlertIfPresent();
61      	switchToWindow("Kuali");
62      }
63      
64      protected void testClientResponsivenessEnterKeySupportDefaultGroupKey() throws Exception {
65      	waitAndClickByXpath("//a[@id='Demo-EnterKeySupport-Example3_tab']");
66      	pressEnterByName("inputField1");
67      	acceptAlertIfPresent();
68      	pressEnterByName("inputField2");
69      	acceptAlertIfPresent();
70      	pressEnterByName("inputField3");
71      	acceptAlertIfPresent();
72      }
73   
74   	protected void testClientResponsivenessEnterKeySupportCollectionLineEnterKey() throws Exception {
75   		waitAndClickByXpath("//a[@id='Demo-EnterKeySupport-Example4_tab']");
76      	pressEnterByXpath("//tbody[@role='alert']/tr/td/div/input");
77      	waitForTextPresent("Adding Line...");
78   	}
79      
80      @Test
81      public void testClientResponsivenessEnterKeySupportBookmark() throws Exception {
82      	testClientResponsivenessEnterKeySupportAll();
83      }
84  
85      @Test
86      public void testClientResponsivenessEnterKeySupportNav() throws Exception {
87      	testClientResponsivenessEnterKeySupportAll();
88      }  
89      
90      private void testClientResponsivenessEnterKeySupportAll() throws Exception {
91      	testClientResponsivenessEnterKeySupportDefaultViewKey();
92      	testClientResponsivenessEnterKeySupportDefaultPageKey();
93      	testClientResponsivenessEnterKeySupportDefaultGroupKey();
94      	testClientResponsivenessEnterKeySupportCollectionLineEnterKey();
95      	passed();
96      }
97  }