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.junit.Test;
019    import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
020    import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
021    import org.kuali.rice.testtools.selenium.WebDriverUtils;
022    
023    /**
024     * Tests the Component section in Rice.
025     *
026     * @author Kuali Rice Team (rice.collab@kuali.org)
027     */
028    public class ComponentAft extends WebDriverLegacyITBase {
029    
030        String docId;
031        String componentCode;
032        String componentName;
033    
034        /**
035         *  for Component Parameter
036         */
037        public static final String FOR_TEST_MESSAGE = " for Component Parameter";
038    
039        /**
040         * ITUtil.PORTAL + "?channelTitle=Component&channelUrl=" + WebDriverUtils.getBaseUrlString() +
041         "/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.coreservice.impl.component.ComponentBo&docFormKey=88888888&returnLocation=" +
042         ITUtil.PORTAL_URL + "&hideReturnLink=true";
043         */
044        public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Component&channelUrl=" + WebDriverUtils
045                .getBaseUrlString() +"/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.coreservice.impl.component.ComponentBo&docFormKey=88888888&returnLocation=" +
046                AutomatedFunctionalTestUtils.PORTAL_URL + "&hideReturnLink=true";
047    
048        @Override
049        protected String getBookmarkUrl() {
050            return BOOKMARK_URL;
051        }
052    
053        protected void navigate() throws InterruptedException {
054            waitAndClickAdministration();
055            waitForTitleToEqualKualiPortalIndex();
056            checkForIncidentReport("Component");
057            selectFrameIframePortlet();
058            waitAndClickByLinkText("Component");
059    //        selectFrame("relative=up");
060            checkForIncidentReport("Component");
061        }
062    
063        @Override
064        protected void createNewEnterDetails() throws InterruptedException {
065            waitAndTypeByName("document.documentHeader.documentDescription", "Adding Test Component");
066            selectOptionByName("document.newMaintainableObject.namespaceCode", "KR-IDM");
067            waitAndTypeByName("document.newMaintainableObject.code", componentCode);
068            waitAndTypeByName("document.newMaintainableObject.name", componentName);
069            checkByName("document.newMaintainableObject.active");
070        }
071    
072        protected void testComponentCreateNewCancel() throws Exception {
073            waitAndCreateNew();
074            testCancelConfirmation();
075            passed();
076        }
077    
078        protected void testComponentParameter() throws Exception {
079            //Create New
080            componentName = "TestName" + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
081            componentCode = "TestCode" + AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
082            docId = createNewTemplateMethod();
083    
084            //Lookup
085            navigate();
086            testLookUpComponent(docId, componentName, componentCode);
087    
088            //edit
089            testEditComponent(docId, componentName, componentCode);
090    
091            //Verify if its edited
092            navigate();
093            testVerifyEditedComponent(docId, componentName, componentCode);
094    
095            //copy
096            testCopyComponent(docId, componentName + "copy", componentCode + "copy");
097    
098            //Verify if its copied
099            navigate();
100            testVerifyCopyComponent(docId, componentName + "copy", componentCode + "copy");
101            passed();
102        }
103    
104        @Test
105        public void testCreateNewCancelComponentBookmark() throws Exception {
106            testComponentCreateNewCancel();
107        }
108    
109        @Test
110        public void testComponentCreateNewCancelComponentNav() throws Exception {
111            testComponentCreateNewCancel();
112        }
113    
114        @Test
115        public void testComponentParameterBookmark() throws Exception {
116            testComponentParameter();
117        }
118    
119        @Test
120        public void testComponentParameterNav() throws Exception {
121            testComponentParameter();
122        }
123    }