001/**
002 * Copyright 2005-2015 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 */
016package edu.sampleu.admin;
017
018import org.junit.Test;
019import org.kuali.rice.testtools.common.JiraAwareFailable;
020import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
021import org.kuali.rice.testtools.selenium.WebDriverUtils;
022
023/**
024 * @author Kuali Rice Team (rice.collab@kuali.org)
025 */
026public class ConfigNamespaceCreateNewAft extends AdminTmplMthdAftNavCreateNewBase {
027
028    /**
029     * ITUtil.PORTAL+"?channelTitle=Namespace&channelUrl="+WebDriverUtils.getBaseUrlString()+
030     * "/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.coreservice.impl.namespace.NamespaceBo&docFormKey=88888888&returnLocation="+
031     * +ITUtil.PORTAL_URL+ ITUtil.HIDE_RETURN_LINK;
032     */   
033    public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL+"?channelTitle=Namespace&channelUrl="+ WebDriverUtils
034            .getBaseUrlString()+"/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.coreservice.impl.namespace.NamespaceBo&docFormKey=88888888&returnLocation="+
035            AutomatedFunctionalTestUtils.PORTAL_URL+ AutomatedFunctionalTestUtils.HIDE_RETURN_LINK;
036
037    protected void createNewEnterDetails() throws InterruptedException {
038        waitAndTypeByName("document.documentHeader.documentDescription", getDescriptionUnique());
039        jiraAwareTypeByName("document.newMaintainableObject.code", "code" + uniqueString);
040        jiraAwareTypeByName("document.newMaintainableObject.name", "name" + uniqueString);
041    }
042
043    @Override
044    protected String getBookmarkUrl() {
045        return BOOKMARK_URL;
046    }
047
048    /**
049     * {@inheritDoc}
050     * Namespace
051     * @return
052     */
053    @Override
054    protected String getLinkLocator() {
055        return "Namespace";
056    }
057
058    public void testConfigNamespaceCreateNewBookmark(JiraAwareFailable failable) throws Exception {
059        testConfigNamespaceCreateNew();
060        passed();
061    }
062
063    public void testConfigNamespaceCreateNewNav(JiraAwareFailable failable) throws Exception {
064        testConfigNamespaceCreateNew();
065        passed();
066    }    
067    
068    public void testConfigNamespaceCreateNew() throws Exception {
069        selectFrameIframePortlet();
070        waitAndCreateNew();
071//        waitAndClickByXpath(CREATE_NEW_XPATH);
072        String docId = waitForDocId();
073
074        waitAndTypeByName("document.documentHeader.documentDescription", "Test description of Namespace create new " + AutomatedFunctionalTestUtils
075                .createUniqueDtsPlusTwoRandomCharsNot9Digits());
076        waitAndTypeByName("document.newMaintainableObject.code", "KR-SYS3" + AutomatedFunctionalTestUtils
077                .createUniqueDtsPlusTwoRandomChars());
078        waitAndTypeByName("document.newMaintainableObject.name","Enterprise Infrastructure 3");
079        waitAndTypeByName("document.newMaintainableObject.applicationId","RICE");
080
081        addAdHocRecipientsPerson(new String[]{getUserName(), "A"});
082
083//        waitAndClickByName("methodToCall.route");
084        waitAndClickSave();
085        waitAndClickSubmit();
086        assertActionList(docId, "A", "ENROUTE");
087        assertOutbox(docId, "FINAL");
088        checkForDocError();
089
090        assertDocSearch(docId, DOC_STATUS_FINAL);
091
092//        waitAndClickByName("methodToCall.close");
093////         waitAndClickByName("methodToCall.processAnswer.button1");
094    }
095
096    @Test
097    public void testConfigNamespaceCreateNewBookmark() throws Exception {
098        testConfigNamespaceCreateNewBookmark(this);
099    }
100
101    @Test
102    public void testConfigNamespaceCreateNewNav() throws Exception {
103        testConfigNamespaceCreateNewNav(this);
104    }
105}