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.labs.kitchensink;
17  
18  import com.thoughtworks.selenium.SeleneseTestBase;
19  import org.junit.Test;
20  import org.kuali.rice.testtools.common.JiraAwareFailable;
21  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
22  
23  /**
24   * Tests the Component section in Rice.
25   *
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   */
28  public class LabsDirtyFieldsAft extends LabsKitchenSinkBase {
29  
30      /**
31       * "/kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&readOnlyFields=field91";
32       */
33      public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=UifCompView&pageId=UifCompView-Page1";
34  
35      @Override
36      protected String getBookmarkUrl() {
37          return BOOKMARK_URL;
38      }
39  
40      @Override
41      protected void navigate() throws Exception {
42          navigateToKitchenSink("Input Fields");
43      }
44  
45      @Test
46      public void testDirtyFieldsCheckBookmark() throws Exception {
47          testDirtyFieldsCheck();
48          passed();
49      }
50  
51      @Test
52      public void testDirtyFieldsCheckNav() throws Exception {
53          testDirtyFieldsCheck();
54          passed();
55      }
56  
57      protected void testDirtyFieldsCheck() throws Exception {
58          waitForPageToLoad();
59  
60          waitAndTypeByName("field1", "test 1");
61          waitAndTypeByName("field102", "test 2");
62          assertCancelConfirmation();
63  
64          // testing manually
65          waitForElementPresentByName("field100");
66          waitAndTypeByName("field100", "here");
67          waitAndTypeByName("field103", "there");
68  
69          // 'Validation' navigation link
70          assertCancelConfirmation();
71  
72          // testing manually
73          waitForElementPresentByName("field106");
74  
75          // //Asserting text-field style to uppercase. This style would display
76          // input text in uppercase.
77          assertTrue(waitAndGetAttributeByName("field112", "style").contains("text-transform: uppercase;"));
78          assertCancelConfirmation();
79          waitForElementPresentByName("field101");
80          assertEquals("val", waitAndGetAttributeByName("field101", "value"));
81          clearTextByName("field101");
82          waitAndTypeByName("field101", "1");
83          waitAndTypeByName("field104", "");
84          SeleneseTestBase.assertEquals("1", waitAndGetAttributeByName("field101", "value"));
85          waitAndTypeByName("field104", "2");
86  
87          // 'Progressive Disclosure' navigation link
88          assertCancelConfirmation();
89      }
90  
91      private void assertCancelConfirmation() throws InterruptedException {
92          waitAndClickCancelByText();
93          alertDismiss();
94      }
95  
96  }