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.demo.uif.library.clientresponsiveness;
17  
18  import org.junit.Test;
19  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20  
21  /**
22   * @author Kuali Rice Team (rice.collab@kuali.org)
23   *
24   * Functional Test ensures correct behavior of the client responsiveness component refresh actions.
25   */
26  public class LibraryClientResponsivenessComponentRefreshAft extends WebDriverLegacyITBase {
27  
28      /* Bookmark url for client repsonsiveness component refresh view */
29      protected static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-ComponentRefresh&methodToCall=start";
30  
31      /**
32       * Returns the client responsiveness component refresh view
33       * @return the url for the client responsiveness component refresh view
34       */
35      @Override
36      protected String getBookmarkUrl() { return BOOKMARK_URL; }
37  
38      /**
39       * Navigates to the base page, before the tests start
40       * @throws Exception if errors while navigating to base page
41       */
42      @Override
43      protected void navigate() throws Exception {
44          waitAndClickLibraryLink();
45          waitAndClickByLinkText("Client Responsiveness");
46          waitAndClickByLinkText("Component Refresh");
47      }
48  
49      /**
50       * Ensures proper behaviour of the method to call on refresh action
51       * @throws Exception if errors while testing the method to call on refresh action
52       */
53      protected void testClientResponsivenessMethodToCallOnRefresh() throws Exception {
54          assertIsVisibleByXpath("//input[@name='booleanField1']", "Is Visible");
55          waitAndTypeByName("inputField1","asdf");
56          waitAndClickByName("booleanField1");
57          waitForTextNotPresent("Loading...");
58      }
59  
60      /**
61       * Ensures proper behavior of the reset data on refresh action
62       * @throws Exception if errors while testing rest data on refresh
63       */
64      protected void testClientResponsivenessResetDataOnRefresh() throws Exception {
65          waitAndClickByLinkText("Reset Data On Refresh");
66          assertIsVisibleByXpath("//input[@name='booleanField2']", "Is Visible");
67          waitAndTypeByName("inputField2","yada");
68          waitAndClickByName("booleanField2");
69          waitForTextNotPresent("Loading...");
70          assertFalse("Input field empty assertion", "yada".equals(waitAndGetAttributeByName("inputField2", "value")));
71      }
72  
73      /**
74       * Test by bookmark
75       * @throws Exception if errors while testing bookmark
76       */
77      @Test
78      public void testClientResponsivenessComponentRefreshBookmark() throws Exception {
79          testClientResponsivenessMethodToCallOnRefresh();
80          testClientResponsivenessResetDataOnRefresh();
81          passed();
82      }
83  
84      /**
85       * Test by navigation
86       * @throws Exception if errors while testing navigation
87       */
88      @Test
89      public void testClientResponsivenessComponentRefreshNav() throws Exception {
90          testClientResponsivenessMethodToCallOnRefresh();
91          testClientResponsivenessResetDataOnRefresh();
92          passed();
93      }
94  }