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.krad.labs.clientside.stateview;
17  
18  import org.junit.Test;
19  import org.junit.Assert;
20  import edu.samplu.common.SmokeTestBase;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class ClientSideStateViewSmokeTest extends SmokeTestBase {
26  
27      /**
28       * /kr-krad/labs?viewId=Lab-ClientSideState&formKey=ff000d97-13e9-4130-81a3-bc0217e8e0eb&
29       * cacheKey=otutyty24mo0f76n59ebqxvtpg&pageId=Lab-ClientSideState-Page1
30       */
31      public static final String BOOKMARK_URL = "/kr-krad/labs?viewId=Lab-ClientSideState&formKey=ff000d97-13e9-4130-81a3-bc0217e8e0eb&cacheKey=otutyty24mo0f76n59ebqxvtpg&pageId=Lab-ClientSideState-Page1";
32  
33      /**
34       * inactivatableCollection[0].active
35       */
36      private static final String ACTIVE_COMPONENT_NAME = "inactivatableCollection[0].active";
37  
38      /**
39       * inactivatableCollection[0].active
40       */
41      private static final String ACTIVE_COMPONENT2_NAME = "inactivatableCollection2[0].active";
42      
43      /**
44       * //div[4]/div[2]/button
45       */
46      private static final String AJAX_BUTTON_XPATH = "//div[4]/div[2]/button";
47      
48      /**
49       * //div[4]/div[2]/button[2]
50       */
51      private static final String SUBMIT_BUTTON_XPATH = "//div[4]/div[2]/button[2]";
52  
53      /**
54       * This overridden method ...
55       * 
56       * @see edu.samplu.common.SmokeTestBase#navigate()
57       */
58      @Override
59      protected void navigate() throws Exception {
60          // TODO deep - THIS METHOD NEEDS JAVADOCS
61          //Navigation is not defined for this functionality so we only do have URL in this Smoke Test.
62      }
63  
64      @Override
65      protected String getBookmarkUrl() {
66          return BOOKMARK_URL;
67      }
68  
69      @Test
70      public void testClientSideStateViewBookmark() throws Exception {
71          testClientSideStateView();
72      }
73  
74      public void testClientSideStateView() throws Exception
75      {
76          selectFrameIframePortlet();
77          waitAndClickByName(ACTIVE_COMPONENT_NAME);
78          waitAndClickByName(ACTIVE_COMPONENT2_NAME);
79          waitAndClickByXpath(AJAX_BUTTON_XPATH);
80          Thread.sleep(5000);
81          Assert.assertFalse(isElementPresentByName(ACTIVE_COMPONENT_NAME));
82          Assert.assertFalse(isElementPresentByName(ACTIVE_COMPONENT2_NAME));
83          waitAndClickByXpath(SUBMIT_BUTTON_XPATH);
84          Thread.sleep(5000);
85          Assert.assertFalse(isElementPresentByName(ACTIVE_COMPONENT_NAME));
86          Assert.assertFalse(isElementPresentByName(ACTIVE_COMPONENT2_NAME));
87      }
88  }