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 edu.sampleu.main;
17  
18  import org.apache.commons.lang.RandomStringUtils;
19  import org.junit.Test;
20  import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
21  import org.kuali.rice.testtools.selenium.WebDriverUtils;
22  
23  /**
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   */
26  public class TermMaintenanceNewAft extends MainTmplMthdSTNavBase {
27  
28      /**
29       * ITUtil.PORTAL + "?Term%20Lookup&channelUrl=" + WebDriverUtils.getBaseUrlString() +
30       *  "/kr-krad/maintenance?viewTypeName=MAINTENANCE&methodToCall=start&dataObjectClassName=org.kuali.rice.krms.impl.repository.TermBo&returnLocation=" +
31       *  ITUtil.PORTAL_URL + ITUtil.HIDE_RETURN_LINK;
32       */
33      public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Term%20Lookup&channelUrl=" + WebDriverUtils.getBaseUrlString()
34              + "/kr-krad/lookup?methodToCall=start&dataObjectClassName=org.kuali.rice.krms.impl.repository.TermBo&returnLocation="
35              + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK;
36  
37      @Override
38      protected String getBookmarkUrl() {
39          return BOOKMARK_URL;
40      }
41  
42      /**
43       * {@inheritDoc}
44       * Term Lookup
45       * @return
46       */
47      @Override
48      protected String getLinkLocator() {
49          return "Term Lookup";
50      }
51  
52      protected void createNewEnterDetails() throws InterruptedException {
53          selectFrameIframePortlet();
54          waitAndClickLinkContainingText("Create New");
55  
56          String randomCode = RandomStringUtils.randomAlphabetic(9).toUpperCase();
57          waitAndTypeByName("document.newMaintainableObject.dataObject.description","New Term " + randomCode);
58          waitAndTypeByName("document.newMaintainableObject.dataObject.specificationId", "T1000");
59          waitAndTypeByName("document.newMaintainableObject.dataObject.specification.namespace", "KR_RULE_TEST");
60          waitForProgressLoading();
61          waitForTextPresent("campusSize");
62          waitForTextPresent("java.lang.Integer");
63          waitForElementPresentByXpath("//label[contains(text(),'Specification Description')]/span[contains(text(),'Size in # of students of the campus')]");
64          waitAndTypeByName("document.newMaintainableObject.dataObject.parametersMap[Campus Code]","FakeCampus" + randomCode);
65  
66          waitAndClickByXpath("//button[contains(text(),'Submit')]");
67          waitAndClickConfirmationOk();
68          waitForProgressLoading();
69          waitForTextPresent("Document was successfully submitted.", WebDriverUtils.configuredImplicityWait() * 2);
70          waitForTextPresent("FakeCampus" + randomCode);
71      }
72  
73      @Test
74      public void testCreateNewTermWithParameterBookmark() throws Exception {
75          createNewEnterDetails();
76          passed();
77      }
78  
79      @Test
80      public void testCreateNewTermWithParameterNav() throws Exception {
81          createNewEnterDetails();
82          passed();
83      }
84  }