001/**
002 * Copyright 2005-2016 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.kim.api.identity;
017
018import edu.sampleu.admin.AdminTmplMthdAftNavBase;
019import org.kuali.rice.testtools.common.JiraAwareFailable;
020import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
021import org.kuali.rice.testtools.selenium.WebDriverUtils;
022
023import java.util.List;
024
025/**
026 * @author Kuali Rice Team (rice.collab@kuali.org)
027 */
028public abstract class PermissionAftBase extends AdminTmplMthdAftNavBase {
029
030    /**
031     * ITUtil.PORTAL + "?channelTitle=Permission&channelUrl=" 
032     * + WebDriverUtils.getBaseUrlString() + ITUtil.KNS_LOOKUP_METHOD + "org.kuali.rice.kim.impl.permission.UberPermissionBo&docFormKey=88888888&returnLocation=" +
033     * ITUtil.PORTAL_URL + ITUtil.HIDE_RETURN_LINK;
034     */
035    public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Permission&channelUrl="
036            + WebDriverUtils.getBaseUrlString() + AutomatedFunctionalTestUtils.KNS_LOOKUP_METHOD +
037            "org.kuali.rice.kim.impl.permission.UberPermissionBo&docFormKey=88888888&returnLocation=" +
038            AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK ;
039
040    private String docId;
041    private String permissionName;
042
043    @Override
044    protected String getBookmarkUrl() {
045        return BOOKMARK_URL;
046    }
047
048    /**
049     * {@inheritDoc}
050     * Permission
051     * @return
052     */
053    @Override
054    protected String getLinkLocator() {
055        return "Permission";
056    }
057   
058    public void testPermissionBookmark(JiraAwareFailable failable) throws Exception {
059      //Create New Permission
060        selectFrame("iframeportlet");
061        waitAndCreateNew();
062        List<String> params;
063        params=testCreateNewPermission(docId, permissionName);
064       
065        //LookUp Permission
066        selectTopFrame();
067        open(WebDriverUtils.getBaseUrlString()+BOOKMARK_URL);
068        selectFrame("iframeportlet");
069        params=testLookUpPermission(params.get(0), params.get(1));
070
071        //Edit Permission
072        params=testEditPermission(params.get(0), params.get(1));
073        
074        //Verify Permission
075        selectTopFrame();
076        open(WebDriverUtils.getBaseUrlString()+BOOKMARK_URL);
077        selectFrame("iframeportlet");
078        params=testVerifyPermission(params.get(0), params.get(1));
079        passed();
080    }
081
082    public void testPermissionNav(JiraAwareFailable failable) throws Exception {
083        //Create New
084        gotoCreateNew();
085        List<String> params;
086        params = testCreateNewPermission(docId, permissionName);
087
088        //LookUp Permission
089        selectTopFrame();
090        navigate();
091        params = testLookUpPermission(params.get(0), params.get(1));
092
093        //Edit Permission
094        params = testEditPermission(params.get(0), params.get(1));
095
096        //Verify Permisstion
097        selectTopFrame();
098        navigate();
099        params = testVerifyPermission(params.get(0), params.get(1));
100        passed();
101    }
102}