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;
17  
18  import org.junit.Test;
19  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20  import org.openqa.selenium.By;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class LabsEnterKeySupportTables2Aft extends WebDriverLegacyITBase {
26  
27      /**
28       * /kr-krad/labs?viewId=Lab-LayoutTest-EnterKeyTables2
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/labs?viewId=Lab-LayoutTest-EnterKeyTables2";
31     
32      @Override
33      protected String getBookmarkUrl() {
34          return BOOKMARK_URL;
35      }
36  
37      @Override
38      protected void navigate() throws Exception {
39      	waitAndClickByLinkText("Enter Key Support - Tables 2");
40      }
41  
42      protected void testDemoEnterKeySupportTables2() throws InterruptedException {
43          //verify the result of the first result row
44          String value1 = waitAndGetAttributeByXpath("//table/tbody/tr[2]/td[2]/div/input", "value");
45          String value2 = waitAndGetAttributeByXpath("//table/tbody/tr[2]/td[3]/div/input", "value");
46          jGrowl("got first row values "+value1+" "+value2);
47          assertFalse(value1.equals("1"));
48          assertFalse(value2.equals("1"));
49  
50          //fill in values and send the enter key
51          waitAndTypeByXpath("//table/tbody/tr[1]/td[2]/div/input", "1");
52          waitAndTypeByXpath("//table/tbody/tr[1]/td[3]/div/input","1");
53          pressEnterByXpath("//table/tbody/tr[1]/td[3]/div/input");
54  
55          //wait for first result row
56          waitForElementVisibleBy(By.xpath("//table/tbody/tr[2]/td[3]/div/input"),"1");
57  
58          //verify the result of the first result row
59          String value3 = waitAndGetAttributeByXpath("//table/tbody/tr[2]/td[2]/div/input", "value");
60          String value4 = waitAndGetAttributeByXpath("//table/tbody/tr[2]/td[3]/div/input", "value");
61          jGrowl("got first row values "+value3+" "+value4);
62          assertTrue(value3.equals("1"));
63          assertTrue(value4.equals("1"));
64  
65          pressEnterByXpath("//table/tbody/tr[2]/td[3]/div/input");
66          acceptAlert();
67      }
68  
69      @Test
70      public void testDemoEnterKeySupportTables2Bookmark() throws Exception {
71      	testDemoEnterKeySupportTables2();
72          passed();
73      }
74  
75      @Test
76      public void testDemoEnterKeySupportTables2Nav() throws Exception {
77      	testDemoEnterKeySupportTables2();
78          passed();
79      }
80  }