View Javadoc
1   /**
2    * Copyright 2005-2015 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.admin;
17  
18  import org.kuali.rice.testtools.common.JiraAwareFailable;
19  import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
20  import org.kuali.rice.testtools.selenium.WebDriverUtils;
21  import org.openqa.selenium.By;
22  
23  /**
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   */
26  public abstract class AddingNameSpacesAftBase extends AdminTmplMthdAftNavBase {
27  
28      /**
29       * ITUtil.PORTAL+"?channelTitle=Namespace&channelUrl="+WebDriverUtils.getBaseUrlString()+"/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.coreservice.impl.namespace.NamespaceBo&docFormKey=88888888&returnLocation="+ITUtil.PORTAL_URL+"&hideReturnLink=true";
30       */
31      public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL+"?channelTitle=Namespace&channelUrl="+ WebDriverUtils
32              .getBaseUrlString()+"/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.coreservice.impl.namespace.NamespaceBo&docFormKey=88888888&returnLocation="+ AutomatedFunctionalTestUtils.PORTAL_URL+"&hideReturnLink=true";
33  
34      @Override
35      protected String getBookmarkUrl() {
36          return BOOKMARK_URL;
37      }
38  
39      /**
40       * {@inheritDoc}
41       * Namespace
42       * @return
43       */
44      @Override
45      protected String getLinkLocator() {
46          return "Namespace";
47      }
48  
49      public void testAddingNamespaceBookmark(JiraAwareFailable failable) throws Exception {
50          testAddingNamespace(this);
51          passed();
52      }
53  
54      public void testAddingNamespaceNav(JiraAwareFailable failable) throws Exception {
55          testAddingNamespace(this);
56          passed();
57      }
58  
59      public void testSearchEditBackNav(JiraAwareFailable failable) throws Exception {
60          testSearchEditBack(this);
61          passed();
62      }
63  
64      public void testSearchSearchBackNav(JiraAwareFailable failable) throws Exception {
65          testSearchSearchBack(this, "code", "KR-SYS");
66          passed();
67      }
68  
69      protected void testAddingNamespace(JiraAwareFailable failable) throws Exception {
70          selectFrameIframePortlet();
71          waitAndCreateNew();
72          waitForElementPresentByXpath(SAVE_XPATH_2, "save button does not exist on the page");
73  
74          //Enter details for Namespace.
75          waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Adding PEANUTS");
76          waitAndTypeByXpath("//*[@id='document.documentHeader.explanation']", "I want to add PEANUTS to test KIM");
77          waitAndTypeByXpath(DOC_CODE_XPATH, "PEANUTS");
78          waitAndTypeByXpath("//input[@id='document.newMaintainableObject.name']", "The Peanuts Gang");
79          checkByXpath("//input[@id='document.newMaintainableObject.active']");
80          waitAndClickByXpath(SAVE_XPATH_2);
81          waitForElementPresentByXpath(SAVE_SUCCESSFUL_XPATH, "Document is not saved successfully");
82  
83          //checks it is saved and initiator is admin.
84          assertEquals(DOC_STATUS_SAVED, findElement(By.xpath("//table[@class='headerinfo']/tbody/tr[1]/td[2]")).getText());
85          assertEquals("admin", findElement(By.xpath("//table[@class='headerinfo']/tbody/tr[2]/td[1]/a")).getText());
86      }
87  }