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.admin.test;
17  
18  import edu.samplu.common.Failable;
19  import edu.samplu.common.ITUtil;
20  import edu.samplu.common.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 ComponentAbstractSmokeTestBase extends WebDriverLegacyITBase {
28  
29      String docId;
30  
31      /**
32       *  for Component Parameter
33       */
34      public static final String FOR_TEST_MESSAGE = " for Component Parameter";
35  
36      /**
37       * ITUtil.PORTAL + "?channelTitle=Component&channelUrl=" + ITUtil.getBaseUrlString() +
38       "/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.coreservice.impl.component.ComponentBo&docFormKey=88888888&returnLocation=" +
39       ITUtil.PORTAL_URL + "&hideReturnLink=true";
40       */
41      public static final String BOOKMARK_URL = ITUtil.PORTAL + "?channelTitle=Component&channelUrl=" + ITUtil.getBaseUrlString() +
42              "/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.coreservice.impl.component.ComponentBo&docFormKey=88888888&returnLocation=" +
43              ITUtil.PORTAL_URL + "&hideReturnLink=true";
44  
45      protected void bookmark() {
46          open(ITUtil.getBaseUrlString() + BOOKMARK_URL);
47      }
48  
49      /**
50       * Bookmark tests should call bookmark(), navigation tests should call navigation()
51       * @throws Exception
52       */
53      protected abstract void gotoTest() throws Exception;
54  
55      protected void navigtaion() throws InterruptedException {
56          waitAndClickAdministration(this);
57          waitForTitleToEqualKualiPortalIndex();
58          checkForIncidentReport("Component");
59          selectFrameIframePortlet();
60          waitAndClickByLinkText("Component");
61  //        selectFrame("relative=up");
62          checkForIncidentReport("Component");
63      }
64  
65      protected void testComponentCreateNewCancelBookmark(Failable failable) throws Exception {
66          waitAndCreateNew();
67          testCancelConfirmation();
68          passed();
69      }
70  
71      protected void testComponentCreateNewCancelNav(Failable failable) throws Exception {
72          navigtaion(); // setUp only takes us to the portal, need to navigate to the test
73          waitAndCreateNew();
74          testCancelConfirmation();
75          passed();
76      }
77  
78      protected void testComponentParameterBookmark(Failable failable) throws Exception {
79          testComponentParameter();
80          passed();
81      }
82  
83      protected void testComponentParameterNav(Failable failable) throws Exception {
84          navigtaion(); // setUp only takes us to the portal, need to navigate to the test
85          testComponentParameter();
86          passed();
87      }
88  
89      protected void testComponentParameter() throws Exception {
90          //Create New
91          waitAndCreateNew();
92          String componentName = "TestName" + ITUtil.createUniqueDtsPlusTwoRandomChars();
93          String componentCode = "TestCode" + ITUtil.createUniqueDtsPlusTwoRandomChars();
94          docId = testCreateNewComponent(componentName, componentCode, FOR_TEST_MESSAGE);
95  
96          //Lookup
97          gotoTest();
98          testLookUpComponent(docId, componentName, componentCode);
99  
100         //edit
101         testEditComponent(docId, componentName, componentCode);
102 
103         //Verify if its edited
104         gotoTest();
105         testVerifyEditedComponent(docId, componentName, componentCode);
106 
107         //copy
108         testCopyComponent(docId, componentName + "copy", componentCode + "copy");
109 
110         //Verify if its copied
111         gotoTest();
112         testVerifyCopyComponent(docId, componentName + "copy", componentCode + "copy");
113     }
114 }