001/**
002 * Copyright 2005-2014 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.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
019import org.kuali.rice.testtools.selenium.WebDriverUtils;
020
021/**
022 * @author Kuali Rice Team (rice.collab@kuali.org)
023 */
024public abstract class ConfigComponentCreateNewAftBase extends ConfigComponentAftBase {
025
026    /**
027     * ITUtil.PORTAL+"?channelTitle=Component&channelUrl="+WebDriverUtils.getBaseUrlString()+
028     * "/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.coreservice.impl.component.ComponentBo&docFormKey=88888888&returnLocation="+
029     * +ITUtil.PORTAL_URL+ ITUtil.HIDE_RETURN_LINK;
030     */    
031    public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL+"?channelTitle=Component&channelUrl="+ WebDriverUtils
032            .getBaseUrlString()+"/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.coreservice.impl.component.ComponentBo&docFormKey=88888888&returnLocation="+
033            AutomatedFunctionalTestUtils.PORTAL_URL+ AutomatedFunctionalTestUtils.HIDE_RETURN_LINK;
034
035    @Override
036    protected String getBookmarkUrl() {
037        return BOOKMARK_URL;
038    }
039
040    public void testConfigComponentCreateNewBookmark() throws Exception {
041        testConfigComponentCreateNew();
042        passed();
043    }
044
045    public void testConfigComponentCreateNewNav() throws Exception {
046        testConfigComponentCreateNew();
047        passed();
048    }
049
050    public void testConfigComponentCreateNewSaveBookmark() throws Exception {
051        testConfigComponentCreateNewSave();
052        passed();
053    }
054
055    public void testConfigComponentCreateNewSaveNav() throws Exception {
056        testConfigComponentCreateNewSave();
057        passed();
058    }
059
060    public void testConfigComponentCreateNewDuplicateEntryBookmark() throws Exception {
061        testConfigComponentCreateNewDuplicateEntry();
062        passed();
063    }
064    
065     public void testConfigComponentCreateNewDuplicateEntryNav() throws Exception {
066         testConfigComponentCreateNewDuplicateEntry();
067         passed();
068     }
069 
070
071    public void testConfigComponentCreateNew() throws Exception {
072        String docId = testCreateNew();
073        submitAndClose();
074        assertDocSearch(docId, "FINAL");
075        passed();
076    }
077
078    public void testConfigComponentCreateNewDuplicateEntry() throws Exception {
079        selectFrameIframePortlet();
080        waitAndClickByXpath("//img[@alt='create new']");
081        selectFrameIframePortlet();
082        String tempValue=AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
083        waitAndTypeByName("document.documentHeader.documentDescription","Description for Duplicate");
084        selectByName("document.newMaintainableObject.namespaceCode","KR-BUS - Service Bus");
085        waitAndTypeByName("document.newMaintainableObject.code","COMPCODE" + tempValue);
086        waitAndTypeByName("document.newMaintainableObject.name","Component Name "+tempValue);
087        waitAndClickByXpath("//input[@name='methodToCall.route']");
088        waitForTextPresent("Document was successfully submitted.");
089        selectTopFrame();
090        waitAndClickAdministration();
091        waitAndClickByLinkText("Component");
092        selectFrameIframePortlet();
093        waitAndClickByXpath("//img[@alt='create new']");
094        selectFrameIframePortlet();
095        waitAndTypeByName("document.documentHeader.documentDescription","Description for Duplicate");
096        selectByName("document.newMaintainableObject.namespaceCode","KR-BUS - Service Bus");
097        waitAndTypeByName("document.newMaintainableObject.code","COMPCODE" + tempValue);
098        waitAndTypeByName("document.newMaintainableObject.name","Component Name "+tempValue);
099        waitAndClickByXpath("//input[@name='methodToCall.route']");
100        waitForTextPresent("This document cannot be Saved or Routed because a record with the same primary key already exists.");
101        passed();
102    }
103    
104    public void testConfigComponentCreateNewSave() throws Exception {
105        String docId = testCreateNew();
106        saveAndClose();
107        assertDocSearch(docId, DOC_STATUS_SAVED);
108        passed();
109    }
110}