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 org.kuali.rice.krad.demo.travel.account;
017
018 import org.junit.Test;
019 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
020 import org.openqa.selenium.By;
021
022 /**
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025 public class DemoTravelAccountMultivalueLookUpAft extends WebDriverLegacyITBase {
026
027 /**
028 * /kr-krad/lookup?methodToCall=start&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount&hideReturnLink=true&multipleValuesSelect=true&lookupCollectionName=travelAccounts&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&lookupCollectionName=travelAccounts&suppressActions=true&conversionFields=number:foo,name:foo";
031
032 /**
033 * selectedCollectionLines['lookupResults']
034 */
035 public static final String LOOKUP_RESULTS = "selectedCollectionLines['lookupResults']";
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 Exception {
049 waitAndClickByValue("CAT");
050 waitAndClickButtonByText(WebDriverLegacyITBase.SEARCH);
051
052 By[] bysPresent = new By[] {By.xpath("//a[contains(text(), 'a6')]"), By.xpath("//a[contains(text(), 'a9')]"), By.xpath("//a[contains(text(), 'a14')]")};
053 assertElementsPresentInResultPages(bysPresent);
054
055 waitAndClickByName(LOOKUP_RESULTS);
056 assertButtonEnabledByText(WebDriverLegacyITBase.RETURN_SELECTED_BUTTON_TEXT);
057 waitAndClickByName(LOOKUP_RESULTS);
058 assertButtonDisabledByText(WebDriverLegacyITBase.RETURN_SELECTED_BUTTON_TEXT);
059
060 assertMultiValueSelectAllThisPage();
061 assertMultiValueDeselectAllThisPage();
062
063 waitAndClickByName(LOOKUP_RESULTS);
064 waitAndClickButtonByText(WebDriverLegacyITBase.SEARCH);
065 checkForIncidentReport();
066 }
067
068 @Test
069 public void testTravelAccountMultivalueLookUpSearchSelectBookmark() throws Exception {
070 testSearchSelect();
071 passed();
072 }
073
074 @Test
075 public void testTravelAccountMultivalueLookUpSearchSelectNav() throws Exception {
076 testSearchSelect();
077 passed();
078 }
079
080 @Test
081 public void testTravelAccountMultivalueLookUpSelectThisPageBookmark() throws Exception {
082 testMultiValueSelectAllThisPage();
083 passed();
084 }
085
086 @Test
087 public void testTravelAccountMultivalueLookUpSelectThisPageNav() throws Exception {
088 testMultiValueSelectAllThisPage();
089 passed();
090 }
091
092 @Test
093 public void testTravelAccountMultivalueLookUpSelectAllPagesBookmark() throws Exception {
094 testMultiValueSelectAllPages();
095 passed();
096 }
097
098 @Test
099 public void testTravelAccountMultivalueLookUpSelectAllPagesNav() throws Exception {
100 testMultiValueSelectAllPages();
101 passed();
102 }
103 }