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.samplu.admin.test;
017    
018    import edu.samplu.common.Failable;
019    import edu.samplu.common.ITUtil;
020    import edu.samplu.common.WebDriverLegacyITBase;
021    
022    /**
023     * Tests the Component section in Rice.
024     *
025     * @author Kuali Rice Team (rice.collab@kuali.org)
026     */
027    public abstract class ComponentAbstractSmokeTestBase extends WebDriverLegacyITBase {
028    
029        String docId;
030    
031        /**
032         *  for Component Parameter
033         */
034        public static final String FOR_TEST_MESSAGE = " for Component Parameter";
035    
036        /**
037         * ITUtil.PORTAL + "?channelTitle=Component&channelUrl=" + ITUtil.getBaseUrlString() +
038         "/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.coreservice.impl.component.ComponentBo&docFormKey=88888888&returnLocation=" +
039         ITUtil.PORTAL_URL + "&hideReturnLink=true";
040         */
041        public static final String BOOKMARK_URL = ITUtil.PORTAL + "?channelTitle=Component&channelUrl=" + ITUtil.getBaseUrlString() +
042                "/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.coreservice.impl.component.ComponentBo&docFormKey=88888888&returnLocation=" +
043                ITUtil.PORTAL_URL + "&hideReturnLink=true";
044    
045        protected void bookmark() {
046            open(ITUtil.getBaseUrlString() + BOOKMARK_URL);
047        }
048    
049        /**
050         * Bookmark tests should call bookmark(), navigation tests should call navigation()
051         * @throws Exception
052         */
053        protected abstract void gotoTest() throws Exception;
054    
055        protected void navigtaion() throws InterruptedException {
056            waitAndClickAdministration(this);
057            waitForTitleToEqualKualiPortalIndex();
058            checkForIncidentReport("Component");
059            selectFrameIframePortlet();
060            waitAndClickByLinkText("Component");
061    //        selectFrame("relative=up");
062            checkForIncidentReport("Component");
063        }
064    
065        protected void testComponentCreateNewCancelBookmark(Failable failable) throws Exception {
066            waitAndCreateNew();
067            testCancelConfirmation();
068            passed();
069        }
070    
071        protected void testComponentCreateNewCancelNav(Failable failable) throws Exception {
072            navigtaion(); // setUp only takes us to the portal, need to navigate to the test
073            waitAndCreateNew();
074            testCancelConfirmation();
075            passed();
076        }
077    
078        protected void testComponentParameterBookmark(Failable failable) throws Exception {
079            testComponentParameter();
080            passed();
081        }
082    
083        protected void testComponentParameterNav(Failable failable) throws Exception {
084            navigtaion(); // setUp only takes us to the portal, need to navigate to the test
085            testComponentParameter();
086            passed();
087        }
088    
089        protected void testComponentParameter() throws Exception {
090            //Create New
091            waitAndCreateNew();
092            String componentName = "TestName" + ITUtil.createUniqueDtsPlusTwoRandomChars();
093            String componentCode = "TestCode" + ITUtil.createUniqueDtsPlusTwoRandomChars();
094            docId = testCreateNewComponent(componentName, componentCode, FOR_TEST_MESSAGE);
095    
096            //Lookup
097            gotoTest();
098            testLookUpComponent(docId, componentName, componentCode);
099    
100            //edit
101            testEditComponent(docId, componentName, componentCode);
102    
103            //Verify if its edited
104            gotoTest();
105            testVerifyEditedComponent(docId, componentName, componentCode);
106    
107            //copy
108            testCopyComponent(docId, componentName + "copy", componentCode + "copy");
109    
110            //Verify if its copied
111            gotoTest();
112            testVerifyCopyComponent(docId, componentName + "copy", componentCode + "copy");
113        }
114    }