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.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 DemoClientResponsivenessComponentRefreshAft 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          waitAndClickById("Demo-LibraryLink", "");
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          assertTrue("Input field not empty assertion", "asdf".equals(waitAndGetAttributeByName("inputField1", "value")));
59      }
60  
61      /**
62       * Ensures proper behavior of the reset data on refresh action
63       * @throws Exception if errors while testing rest data on refresh
64       */
65      protected void testClientResponsivenessResetDataOnRefresh() throws Exception {
66          waitAndClickByLinkText("Reset Data On Refresh");
67          assertIsVisibleByXpath("//input[@name='booleanField2']", "Is Visible");
68          waitAndTypeByName("inputField2","yada");
69          waitAndClickByName("booleanField2");
70          waitForTextNotPresent("Loading...");
71          assertFalse("Input field empty assertion", "yada".equals(waitAndGetAttributeByName("inputField2", "value")));
72      }
73  
74      /**
75       * Test by bookmark
76       * @throws Exception if errors while testing bookmark
77       */
78      @Test
79      public void testClientResponsivenessComponentRefreshBookmark() throws Exception {
80          testClientResponsivenessMethodToCallOnRefresh();
81          testClientResponsivenessResetDataOnRefresh();
82          passed();
83      }
84  
85      /**
86       * Test by navigation
87       * @throws Exception if errors while testing navigation
88       */
89      @Test
90      public void testClientResponsivenessComponentRefreshNav() throws Exception {
91          testClientResponsivenessMethodToCallOnRefresh();
92          testClientResponsivenessResetDataOnRefresh();
93          passed();
94      }
95  }