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.uif.library.collections;
017
018 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
019 import org.junit.Test;
020 import org.openqa.selenium.By;
021
022 /**
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025 public class DemoCollectionFeaturesMultiValueLookupAft extends WebDriverLegacyITBase {
026
027 /**
028 * /kr-krad/kradsampleapp?viewId=Demo-LightTableView&methodToCall=start
029 */
030 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-CollectionLookupView&methodToCall=start";
031
032 @Override
033 protected String getBookmarkUrl() {
034 return BOOKMARK_URL;
035 }
036
037 @Override
038 protected void navigate() throws Exception {
039 jGrowl("Click the Library Link");
040 waitAndClickById("Demo-LibraryLink", "");
041 waitAndClickByLinkText("Collection Features");
042 waitAndClickByLinkText("Multi-Value Lookup");
043 }
044
045 protected void testMultiValueLookup() throws InterruptedException {
046 lightBoxLookupAddMultipleLines();
047
048 waitAndTypeByName("lookupCriteria[number]", "a1");
049 waitAndClickButtonByText("Search");
050 acceptAlertIfPresent();
051 assertButtonDisabledByText("return selected");
052
053 jGrowl("Check Travel Account 1 checkbox");
054 waitAndClickByValue("IAT:Travel Account 1:a1");
055 assertButtonEnabledByText("return selected");
056
057 jGrowl("Uncheck Travel Account 1 checkbox");
058 waitAndClickByValue("IAT:Travel Account 1:a1");
059 assertButtonDisabledByText("return selected");
060
061 waitAndClickButtonByText("return selected");
062 Thread.sleep(3000);
063 assertTextPresent("a1"); // TODO better assertion once NullPointer is resolved
064 }
065
066 private void lightBoxLookupAddMultipleLines() throws InterruptedException {
067 waitAndClickByLinkText("Lookup/Add Multiple Lines");
068
069 driver.switchTo().frame(driver.findElement(By.cssSelector(".fancybox-iframe")));
070 selectTopFrame();
071 gotoIframeByXpath("//iframe[@class='fancybox-iframe']");
072 }
073
074 @Test
075 public void testMultiValueLookupBookmark() throws InterruptedException {
076 testMultiValueLookup();
077 passed();
078 }
079
080 @Test
081 public void testMultiValueLookupNav() throws InterruptedException {
082 testMultiValueLookup();
083 passed();
084 }
085
086 @Test
087 public void testMultivalueLookUpSelectThisPageBookmark() throws Exception {
088 lightBoxLookupAddMultipleLines();
089 testMultiValueSelectAllThisPage();
090 passed();
091 }
092
093 @Test
094 public void testMultivalueLookUpSelectThisPageNav() throws Exception {
095 lightBoxLookupAddMultipleLines();
096 testMultiValueSelectAllThisPage();
097 passed();
098 }
099
100 @Test
101 public void testMultivalueLookUpSelectAllPagesBookmark() throws Exception {
102 lightBoxLookupAddMultipleLines();
103 testMultiValueSelectAllPages();
104 passed();
105 }
106
107 @Test
108 public void testMultivalueLookUpSelectAllPagesNav() throws Exception {
109 lightBoxLookupAddMultipleLines();
110 testMultiValueSelectAllPages();
111 passed();
112 }
113 }