001 /**
002 * Copyright 2005-2011 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package edu.samplu.admin.test;
017
018 import static org.junit.Assert.assertEquals;
019 import static org.junit.Assert.assertTrue;
020
021 import edu.samplu.common.MenuITBase;
022 import org.junit.Test;
023
024 /**
025 * tests that a blanket approval by user admin of a Namespace maintenance document results in a document in state FINAL
026 *
027 * To Keep the BlanketAppIT tests separate MenuItBase is extended rather than AdminMenuITBase this only requires the implementation of the getMenuLinkLocator() and getCreateNewLinkLocator so there should probably be another abstract class....
028 *
029 * @author Kuali Rice Team (rice.collab@kuali.org)
030 */
031 public class ConfigNameSpaceBlanketAppIT extends MenuITBase {
032 @Override
033 protected String getCreateNewLinkLocator() {
034 return "//img[@alt='create new']";
035 }
036
037 @Override
038 protected String getMenuLinkLocator() {
039 return "link=Administration";
040 }
041
042 @Override
043 public String getLinkLocator() {
044 return "link=Namespace";
045 }
046
047 @Test
048 public void testNameSpace() throws Exception {
049 gotoCreateNew();
050 String docId = selenium.getText("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
051 assertTrue(selenium.isElementPresent("methodToCall.cancel"));
052 selenium.type("//input[@id='document.documentHeader.documentDescription']", "Validation Test Namespace");
053 selenium.type("//input[@id='document.newMaintainableObject.code']", "VTN");
054 selenium.type("//input[@id='document.newMaintainableObject.name']", "Validation Test NameSpace");
055 selenium.type("//input[@id='document.newMaintainableObject.applicationId']", "RICE");
056 selenium.click("//input[@id='document.newMaintainableObject.active']");
057 selenium.click("methodToCall.blanketApprove");
058 selenium.waitForPageToLoad("30000");
059 selenium.selectWindow("null");
060 selenium.click("//img[@alt='doc search']"); // if document already exists, the test fails here
061 selenium.waitForPageToLoad("30000");
062 assertEquals("Kuali Portal Index", selenium.getTitle());
063 selenium.selectFrame("iframeportlet");
064 selenium.click("//input[@name='methodToCall.search' and @value='search']");
065 selenium.waitForPageToLoad("30000");
066 docId= "link=" + docId;
067
068 assertTrue(selenium.isElementPresent(docId));
069 if(selenium.isElementPresent(docId)){
070 assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
071 }else{
072 assertEquals(docId, selenium.getText("//table[@id='row']/tbody/tr[1]/td[1]"));
073 assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
074 }
075 }
076 }