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     */
016    package edu.samplu.krad.demo.travelapplication.accountmultivalue.lookup;
017    
018    import org.junit.Test;
019    import org.kuali.rice.testtools.selenium.SmokeTestBase;
020    import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
021    
022    /**
023     * @author Kuali Rice Team (rice.collab@kuali.org)
024     */
025    public class DemoTravelAccountMultivalueLookUpSmokeTest extends SmokeTestBase {
026    
027        /**
028         * /kr-krad/lookup?methodToCall=start&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount&hideReturnLink=true&multipleValuesSelect=true&suppressActions=true&conversionFields=number:foo,name:foo
029         */
030        public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount&hideReturnLink=true&multipleValuesSelect=true&suppressActions=true&conversionFields=number:foo,name:foo";
031       
032        /**
033         * lookupCriteria[accountTypeCode]
034         */
035        public static final String ACCOUNT_TYPE_CODE_NAME = "lookupCriteria[accountTypeCode]";
036    
037        @Override
038        public String getBookmarkUrl() {
039            return BOOKMARK_URL;
040        }
041    
042        @Override
043        protected void navigate() throws Exception {
044            waitAndClickById("Demo-DemoLink", "");
045            waitAndClickByLinkText("Account Multi-Value Lookup");
046        }
047    
048        private void testSearchSelect() throws InterruptedException {
049            waitAndClickByValue("CAT");
050            waitAndClickButtonByText(WebDriverLegacyITBase.SEARCH);
051            waitAndClickByName("selectedCollectionLines['lookupResults']");
052            assertTextPresent("a14");
053            assertTextPresent("a6");
054            assertTextPresent("a9");
055            assertButtonEnabledByText(WebDriverLegacyITBase.RETURN_SELECTED_BUTTON_TEXT);
056            waitAndClickByName("selectedCollectionLines['lookupResults']");
057            assertButtonDisabledByText(WebDriverLegacyITBase.RETURN_SELECTED_BUTTON_TEXT);
058    
059            assertMultiValueSelectAllThisPage();
060            assertMultiValueDeselectAllThisPage();
061    
062            waitAndClickByName("selectedCollectionLines['lookupResults']");
063            waitAndClickButtonByText(WebDriverLegacyITBase.SEARCH);
064            checkForIncidentReport();
065        }
066    
067        @Test
068        public void testTravelAccountMultivalueLookUpSearchSelectBookmark() throws Exception {
069            testSearchSelect();
070            passed();
071        }
072    
073        @Test
074        public void testTravelAccountMultivalueLookUpSearchSelectNav() throws Exception {
075            testSearchSelect();
076            passed();
077        }
078    
079        @Test
080        public void testTravelAccountMultivalueLookUpSelectThisPageBookmark() throws Exception {
081            testMultiValueSelectAllThisPage();
082            passed();
083        }
084    
085        @Test
086        public void testTravelAccountMultivalueLookUpSelectThisPageNav() throws Exception {
087            testMultiValueSelectAllThisPage();
088            passed();
089        }
090    
091        @Test
092        public void testTravelAccountMultivalueLookUpSelectAllPagesBookmark() throws Exception {
093            testMultiValueSelectAllPages();
094            passed();
095        }
096    
097        @Test
098        public void testTravelAccountMultivalueLookUpSelectAllPagesNav() throws Exception {
099            testMultiValueSelectAllPages();
100            passed();
101        }
102    }