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.krad.reference;
017
018import org.junit.Test;
019import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
020import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
021import org.kuali.rice.testtools.selenium.WebDriverUtils;
022
023/**
024 * Tests the Component section in Rice.
025 *
026 * @author Kuali Rice Team (rice.collab@kuali.org)
027 */
028public class EmploymentStatusAft extends WebDriverLegacyITBase {
029
030    /**
031     *  AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Employment%20Status&channelUrl="
032     *   + WebDriverUtils.getBaseUrlString() + AutomatedFunctionalTestUtils.KRAD_LOOKUP_METHOD +
033     *   "org.kuali.rice.kim.impl.identity.employment.EntityEmploymentStatusBo&docFormKey=88888888&returnLocation="
034     *   + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK;
035     */
036    public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Employment%20Status&channelUrl="
037            + WebDriverUtils.getBaseUrlString() + AutomatedFunctionalTestUtils.KRAD_LOOKUP_METHOD +
038            "org.kuali.rice.kim.impl.identity.employment.EntityEmploymentStatusBo&docFormKey=88888888&returnLocation="
039            + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK;
040         
041    @Override
042    protected String getBookmarkUrl() {
043        return BOOKMARK_URL;
044    }
045
046    @Override
047    protected void navigate() throws InterruptedException {
048        waitAndClickKRAD();
049        waitAndClickByLinkText("Employment Status");
050    }
051
052    //Code for KRAD Test Package.
053    protected void testEmploymentStatus() throws Exception {
054        selectFrameIframePortlet();
055        waitAndClickClearValues();
056
057        //Search by "Both" Filter in Active Indicator
058        clickSearch();
059        String[][] data = {{"A", "Active", "01","true"},
060                {"D", "Deceased", "99","true"}};
061        assertTextPresent(data);
062        waitAndClickClearValues();
063
064        //Search by "Yes" Filter in Active Indicator
065        waitAndClickByXpath("//input[@name='lookupCriteria[active]' and @value='Y']");
066        clickSearch();
067        assertTextPresent(data);
068        waitAndClickClearValues();
069
070        //Search by "No" Filter in Active Indicator
071        waitAndClickByXpath("//input[@name='lookupCriteria[active]' and @value='N']");
072        clickSearch();
073        waitForTextPresent("No values match this search.");
074        waitAndClickClearValues();
075
076        //Search by Code Filter
077        waitAndTypeByName("lookupCriteria[code]","A");
078        clickSearch();
079        String[] assertSearchResultForTypeCode = {"A", "Active", "01","true"};
080        assertTextPresent(assertSearchResultForTypeCode);
081        waitAndClickClearValues();
082
083        //Search by Name Filter
084        waitAndTypeByName("lookupCriteria[name]","Active");
085        clickSearch();
086        String[] assertSearchResultForTypeName = {"A", "Active", "01","true"};
087        assertTextPresent(assertSearchResultForTypeName);
088        waitAndClickClearValues();
089
090        //Search by Short Code Filter
091        waitAndTypeByName("lookupCriteria[sortCode]","01");
092        clickSearch();
093        String[] assertSearchResultForShortCode = {"A", "Active", "01","true"};
094        assertTextPresent(assertSearchResultForShortCode);
095        waitAndClickClearValues();
096    }
097
098    protected void clickSearch() throws InterruptedException {
099        waitAndClickSearchByText();
100    }
101
102    @Test
103    public void testEmploymentStatusBookmark() throws Exception {
104        testEmploymentStatus();
105        passed();
106    }
107
108    @Test
109    public void testEmploymentStatusNav() throws Exception {
110        testEmploymentStatus();
111        passed();
112    }
113}