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 */
016package edu.samplu.admin.test;
017
018import edu.samplu.common.ITUtil;
019import edu.samplu.common.SmokeTestBase;
020import org.junit.Test;
021
022/**
023 * Tests the Component section in Rice.
024 *
025 * @author Kuali Rice Team (rice.collab@kuali.org)
026 */
027public class ComponentSmokeTest extends SmokeTestBase {
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    @Override
046    public String getBookmarkUrl() {
047        return BOOKMARK_URL;
048    }
049
050    protected void navigate() throws InterruptedException {
051        waitAndClickAdministration(this);
052        waitForTitleToEqualKualiPortalIndex();
053        checkForIncidentReport("Component");
054        selectFrameIframePortlet();
055        waitAndClickByLinkText("Component");
056//        selectFrame("relative=up");
057        checkForIncidentReport("Component");
058    }
059
060    protected void testComponentCreateNewCancel() throws Exception {
061        waitAndCreateNew();
062        testCancelConfirmation();
063        passed();
064    }
065
066    protected void testComponentParameter() throws Exception {
067        //Create New
068        waitAndCreateNew();
069        String componentName = "TestName" + ITUtil.createUniqueDtsPlusTwoRandomChars();
070        String componentCode = "TestCode" + ITUtil.createUniqueDtsPlusTwoRandomChars();
071        docId = testCreateNewComponent(componentName, componentCode, FOR_TEST_MESSAGE);
072
073        //Lookup
074        navigate();
075        testLookUpComponent(docId, componentName, componentCode);
076
077        //edit
078        testEditComponent(docId, componentName, componentCode);
079
080        //Verify if its edited
081        navigate();
082        testVerifyEditedComponent(docId, componentName, componentCode);
083
084        //copy
085        testCopyComponent(docId, componentName + "copy", componentCode + "copy");
086
087        //Verify if its copied
088        navigate();
089        testVerifyCopyComponent(docId, componentName + "copy", componentCode + "copy");
090        passed();
091    }
092
093    @Test
094    public void testCreateNewCancelComponentBookmark() throws Exception {
095        testComponentCreateNewCancel();
096    }
097
098    @Test
099    public void testComponentCreateNewCancelComponentNav() throws Exception {
100        testComponentCreateNewCancel();
101    }
102
103    @Test
104    public void testComponentParameterBookmark() throws Exception {
105        testComponentParameter();
106    }
107
108    @Test
109    public void testComponentParameterNav() throws Exception {
110        testComponentParameter();
111    }
112}