001    /**
002     * Copyright 2005-2013 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.sampleu.admin;
017    
018    import org.apache.commons.lang.RandomStringUtils;
019    import org.kuali.rice.testtools.common.JiraAwareFailable;
020    import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
021    import org.kuali.rice.testtools.selenium.WebDriverUtils;
022    
023    /**
024     * @author Kuali Rice Team (rice.collab@kuali.org)
025     */
026    public abstract class ConfigComponentCreateNewAftBase extends AdminTmplMthdAftNavBase {
027    
028        /**
029         * ITUtil.PORTAL+"?channelTitle=Component&channelUrl="+WebDriverUtils.getBaseUrlString()+
030         * "/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.coreservice.impl.component.ComponentBo&docFormKey=88888888&returnLocation="+
031         * +ITUtil.PORTAL_URL+ ITUtil.HIDE_RETURN_LINK;
032         */    
033        public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL+"?channelTitle=Component&channelUrl="+ WebDriverUtils
034                .getBaseUrlString()+"/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.coreservice.impl.component.ComponentBo&docFormKey=88888888&returnLocation="+
035                AutomatedFunctionalTestUtils.PORTAL_URL+ AutomatedFunctionalTestUtils.HIDE_RETURN_LINK;
036    
037        String fourLetters;
038    
039        @Override
040        protected String getBookmarkUrl() {
041            return BOOKMARK_URL;
042        }
043    
044        /**
045         * {@inheritDoc}
046         * Component
047         * @return
048         */
049        @Override
050        protected String getLinkLocator() {
051            return "Component";
052        }
053    
054        public void testConfigComponentCreateNewBookmark(JiraAwareFailable failable) throws Exception {
055            testConfigComponentCreateNew();
056            passed();
057        }
058    
059        public void testConfigComponentCreateNewNav(JiraAwareFailable failable) throws Exception {
060            testConfigComponentCreateNew();
061            passed();
062        }
063    
064        protected void createNewEnterDetails() throws InterruptedException {
065            waitAndTypeByName("document.documentHeader.documentDescription","Test description of Component create new");
066            selectByName("document.newMaintainableObject.namespaceCode","KR-WKFLW - Workflow");
067            waitAndTypeByName("document.newMaintainableObject.code","Test1" + fourLetters);
068            waitAndTypeByName("document.newMaintainableObject.name","Test1ComponentCode" + fourLetters);
069        }
070    
071        public void testConfigComponentCreateNew() throws Exception {
072            selectFrameIframePortlet();
073            waitAndClickByXpath(CREATE_NEW_XPATH);
074            fourLetters = RandomStringUtils.randomAlphabetic(4);
075            createNewEnterDetails();
076            waitAndClickByName("methodToCall.route");
077            checkForDocError();
078            waitAndClickByName("methodToCall.close");
079            waitAndClickByName("methodToCall.processAnswer.button1");        
080        }
081    
082        public void testConfigComponentCreateNewFull() throws Exception {
083            fourLetters = RandomStringUtils.randomAlphabetic(4);
084            createNewTemplateMethod();
085        }
086    }