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.admin;
017
018import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
019import org.kuali.rice.testtools.selenium.WebDriverUtils;
020import org.openqa.selenium.By;
021
022/**
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025public class ConfigParameterAft extends AdminTmplMthdAftNavCopyBase {
026
027    /**
028     * ITUtil.PORTAL+"?channelTitle=Parameter&channelUrl="+WebDriverUtils.getBaseUrlString()+
029     * "/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.coreservice.impl.parameter.ParameterBo&docFormKey=88888888&returnLocation="
030     * +ITUtil.PORTAL_URL+ ITUtil.HIDE_RETURN_LINK;
031     */
032    public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL+"?channelTitle=Parameter&channelUrl="+ WebDriverUtils
033            .getBaseUrlString()+"/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.coreservice.impl.parameter.ParameterBo&docFormKey=88888888&returnLocation="
034            + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK;
035
036    public static String[] inputVerifyDetails;
037
038    @Override
039    protected String getBookmarkUrl() {
040        return BOOKMARK_URL;
041    }
042
043    /**
044     * {@inheritDoc}
045     * Parameter
046     * @return
047     */
048    @Override
049    protected String getLinkLocator() {
050        return "Parameter";
051    }
052
053    @Override
054    protected void createNewEnterDetails() throws InterruptedException {
055        inputDetails();
056
057        selectOptionByName("document.newMaintainableObject.namespaceCode", inputVerifyDetails[6]);
058    }
059
060    private void inputDetails() throws InterruptedException {
061        inputVerifyDetails = new String[] {
062                getDescriptionUnique(),
063                "ActionList",
064                "name" + uniqueString,
065                "desc" + uniqueString,
066                "Config",
067                "Allowed",
068                namespaceCode
069        };
070
071// can we generalize to figure out the input type and what to do with it?
072//        for (String[] input: inputVerifyDetails) {
073//            input(input[0], input[1]);
074//        }
075
076        waitAndTypeByName("document.documentHeader.documentDescription", inputVerifyDetails[0]);
077        jiraAwareTypeByName("document.newMaintainableObject.componentCode", inputVerifyDetails[1]);
078        jiraAwareTypeByName("document.newMaintainableObject.name", inputVerifyDetails[2]);
079        jiraAwareTypeByName("document.newMaintainableObject.description", inputVerifyDetails[3]);
080        jiraAwareTypeByName(("document.newMaintainableObject.parameterTypeCode"), inputVerifyDetails[4]);
081//        selectOptionText(By.name("document.newMaintainableObject.parameterTypeCode"), inputVerifyDetails[4]);
082        waitAndClickByName("document.newMaintainableObject.evaluationOperatorCode", inputVerifyDetails[5]);
083    }
084
085    @Override
086    protected void blanketApproveAssert(String docId) throws InterruptedException {
087        super.blanketApproveAssert(docId);
088        waitAndClickLinkContainingText(docId);
089
090        driver.switchTo().window((String)driver.getWindowHandles().toArray()[1]);
091
092        assertTextPresent(inputVerifyDetails);
093        screenshot();
094    }
095
096    @Override
097    protected void createNewLookupDetails() throws InterruptedException {
098        inputDetails();
099
100        assertEquals("", getTextByName(CANCEL_NAME));
101
102        String componentLookUp = "//input[@name='methodToCall.performLookup.(!!org.kuali.rice.coreservice.impl.component.ComponentBo!!).(((code:document.newMaintainableObject.componentCode,namespaceCode:document.newMaintainableObject.namespaceCode,))).((`document.newMaintainableObject.componentCode:code,document.newMaintainableObject.namespaceCode:namespaceCode,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;"
103                + getBaseUrlString() + "/kr/lookup.do;::::).anchor4']";
104        waitAndClickByXpath(componentLookUp);
105        waitAndClickSearch();
106        waitAndClickReturnValue();
107    }
108}