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     */
016    package edu.sampleu.admin;
017    
018    import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
019    import org.kuali.rice.testtools.selenium.WebDriverUtils;
020    
021    /**
022     * @author Kuali Rice Team (rice.collab@kuali.org)
023     */
024    public abstract class ConfigComponentActionListAftBase 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        private void assertActionListRequestGroup(String userInGroup, String group, String namespace, String actionCode, String state) throws InterruptedException {
041            namespaceCode = namespace;
042            String docId = testCreateActionRequestGroup(group, namespace, actionCode);
043            impersonateUser(userInGroup);
044            assertActionList(docId, actionCode, state);
045            selectTopFrame();
046        }
047    
048        private void assertActionListRequestPerson(String backdoorUser, String actionCode, String state) throws InterruptedException {
049            String docId = testCreateActionRequestPerson(backdoorUser, actionCode);
050            impersonateUser(backdoorUser);
051            assertActionList(docId, actionCode, state);
052            selectTopFrame();
053        }
054    
055        protected String testCreateActionRequestGroup(String user, String namespace, String actionType) throws InterruptedException{
056            String docId = testCreateNew();
057            addAdHocRecipientsGroup(new String[]{user, actionType, namespace});
058            submitAndClose();
059            return docId;
060        }
061    
062        /**
063         * Creates an Action Request in a users action list.
064         *
065         * Initiates a new maintenance document (Component BO) with added adHoc request to create an action request
066         * in a users action list for the document
067         * @param user
068         * @param actionType
069         *
070         * @return documentID of the newly initiated document to which the created action request applies.
071         */
072        protected String testCreateActionRequestPerson(String user, String actionType) throws InterruptedException {
073            String docId = testCreateNew();
074            addAdHocRecipientsPerson(new String[]{user, actionType});
075            submitAndClose();
076            return docId;
077        }
078    
079        public void testActionListAcknowledgeGroup() throws Exception {
080            assertActionListRequestGroup("fran", "RecipeMasters", "KR-WKFLW", "K", "PROCESSED");
081            passed();
082        }
083    
084        /**
085         * tests the Acknowledge ActionRequest.
086         * Creates an Acknowledge request for a user. Then performs the Acknowledge action.
087         * @throws Exception
088         */
089        public void testActionListAcknowledgePerson() throws Exception {
090            assertActionListRequestPerson("erin", "K", "PROCESSED");
091            passed();
092        }
093    
094        public void testActionListApproveGroup() throws Exception {
095            assertActionListRequestGroup("fred", "RecipeMasters", "KR-WKFLW", "A", "ENROUTE");
096            passed();
097        }
098    
099        /**
100         * tests the Approve ActionRequest.
101         * Creates an approve request for a user. Then performs the Approve action.
102         * @throws Exception
103         */
104        public void testActionListApprovePerson() throws Exception {
105            assertActionListRequestPerson("fred", "A", "ENROUTE");
106            passed();
107        }
108    
109        public void testActionListCompleteGroup() throws Exception {
110            assertActionListRequestGroup("dev1", "Kuali Developers", "KUALI", "C", "ENROUTE");
111            passed();
112        }
113    
114        /**
115         * tests the complete ActionRequest.
116         * Creates an complete request for a user. Then performs the Complete action.
117         * @throws Exception
118         */
119        public void testActionListCompletePerson() throws Exception {
120            assertActionListRequestPerson("fran", "C", "ENROUTE");
121            passed();
122        }
123    
124        public void testActionListDisapproveGroup() throws Exception {
125            assertActionListRequestGroup("director", "ChickenRecipeMasters", "KR-WKFLW", "D", "ENROUTE");
126            passed();
127        }
128    
129        /**
130         * tests the  ActionRequest.
131         * Creates an approve request for a user. Then performs the Disapprove action.
132         * @throws Exception
133         */
134        public void testActionListDisapprovePerson() throws Exception {
135            assertActionListRequestPerson("fred", "D", "ENROUTE");
136            passed();
137        }
138    
139        public void testActionListFyiGroup() throws Exception {
140            assertActionListRequestGroup("dev2", "Kuali Developers", "KUALI", "F", "FINAL");
141            passed();
142        }
143    
144        /**
145         * tests the FYI ActionRequest.
146         * Creates an FYI request for a user. Then performs the FYI action.
147         * @throws Exception
148         */
149        public void testActionListFyiPerson() throws Exception {
150            assertActionListRequestPerson("eric", "F", "FINAL");
151            passed();
152        }
153    }