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.samplu.travel.krad.test;
17  
18  import com.thoughtworks.selenium.SeleneseTestBase;
19  import edu.samplu.common.Failable;
20  import edu.samplu.common.ITUtil;
21  import edu.samplu.common.WebDriverLegacyITBase;
22  
23  /**
24   * Tests the Component section in Rice.
25   *
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   */
28  public abstract class DirtyFieldsAbstractSmokeTestBase extends WebDriverLegacyITBase {
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&methodToCall=start&readOnlyFields=field91";
34  
35      protected void bookmark() {
36          open(ITUtil.getBaseUrlString() + BOOKMARK_URL);
37      }
38  
39      /**
40       * Nav tests start at {@link edu.samplu.common.ITUtil#PORTAL}.
41       * Bookmark Tests should override and return {@link edu.samplu.travel.krad.test.DirtyFieldsAbstractSmokeTestBase#BOOKMARK_URL}
42       * {@inheritDoc}
43       * @return
44       */
45      @Override
46      public String getTestUrl() {
47          return ITUtil.PORTAL;
48      }
49  
50      protected void navigation() throws InterruptedException {
51          waitAndClickKRAD();
52          waitAndClickByLinkText(UIF_COMPONENTS_KITCHEN_SINK_LINK_TEXT);
53          switchToWindow(KUALI_UIF_COMPONENTS_WINDOW_XPATH);
54      }
55  
56      protected void testDirtyFieldsCheckNav(Failable failable) throws Exception {
57          navigation();
58          testDirtyFieldsCheck();
59          passed();
60      }
61  
62      protected void testDirtyFieldsCheckBookmark(Failable failable) throws Exception {
63          testDirtyFieldsCheck();
64          passed();
65      }
66  
67  
68      protected void testDirtyFieldsCheck() throws Exception {
69          checkForIncidentReport(getTestUrl());
70          waitAndClickByLinkText("Text Controls");
71          waitAndTypeByName("field1", "test 1");
72          waitAndTypeByName("field102", "test 2");
73          assertCancelConfirmation();
74  
75          // testing manually
76          waitForElementPresentByName("field100");
77          waitAndTypeByName("field100", "here");
78          waitAndTypeByName("field103", "there");
79  
80          // 'Validation' navigation link
81          assertCancelConfirmation();
82  
83          // testing manually
84          waitForElementPresentByName("field106");
85  
86          // //Asserting text-field style to uppercase. This style would display
87          // input text in uppercase.
88          SeleneseTestBase.assertTrue(waitAndGetAttributeByName("field112", "style").contains("text-transform: uppercase;"));
89          assertCancelConfirmation();
90          waitForElementPresentByName("field101");
91          SeleneseTestBase.assertEquals("val", waitAndGetAttributeByName("field101", "value"));
92          clearTextByName("field101");
93          waitAndTypeByName("field101", "1");
94          waitAndTypeByName("field104", "");
95          SeleneseTestBase.assertEquals("1", waitAndGetAttributeByName("field101", "value"));
96          waitAndTypeByName("field104", "2");
97  
98          // 'Progressive Disclosure' navigation link
99          assertCancelConfirmation();
100     }
101 }