View Javadoc

1   /**
2    * Copyright 2005-2013 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 edu.sampleu.travel;
17  
18  import com.thoughtworks.selenium.SeleneseTestBase;
19  import org.kuali.rice.testtools.common.JiraAwareFailable;
20  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21  
22  /**
23   * Tests the Component section in Rice.
24   *
25   * @author Kuali Rice Team (rice.collab@kuali.org)
26   */
27  public abstract class DirtyFieldsAftBase extends WebDriverLegacyITBase {
28  
29      /**
30       * "/kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&readOnlyFields=field91";
31       */
32      public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&readOnlyFields=field91";
33  
34      @Override
35      protected String getBookmarkUrl() {
36          return BOOKMARK_URL;
37      }
38  
39      protected void navigation() throws InterruptedException {
40          waitAndClickKRAD();
41          waitAndClickByLinkText(UIF_COMPONENTS_KITCHEN_SINK_LINK_TEXT);
42          switchToWindow(KUALI_UIF_COMPONENTS_WINDOW_XPATH);
43      }
44  
45      protected void testDirtyFieldsCheckNav(JiraAwareFailable failable) throws Exception {
46          navigation();
47          testDirtyFieldsCheck();
48          passed();
49      }
50  
51      protected void testDirtyFieldsCheckBookmark(JiraAwareFailable failable) throws Exception {
52          testDirtyFieldsCheck();
53          passed();
54      }
55  
56  
57      protected void testDirtyFieldsCheck() throws Exception {
58          checkForIncidentReport(getTestUrl());
59          waitAndClickByLinkText("Text Controls");
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          SeleneseTestBase.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  }