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.lookupviews.lookup.multivalue;
017
018 import org.kuali.rice.testtools.selenium.SmokeTestBase;
019 import org.junit.Ignore;
020 import org.junit.Test;
021
022 /**
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025 public class DemoLookUpMultiValueSmokeTest extends SmokeTestBase {
026
027 /**
028 * /kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewMultipleValuesSelectLimit&hideReturnLink=true
029 */
030 public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewMultipleValuesSelectLimit&hideReturnLink=true";
031
032 /**
033 * lookupCriteria[number]
034 */
035 private static final String LOOKUP_CRITERIA_NUMBER_NAME="lookupCriteria[number]";
036
037 /**
038 * Search
039 */
040 private static final String SEARCH="Search";
041
042 /**
043 * Clear Values
044 */
045 private static final String CLEAR_VALUES="Clear Values";
046
047 /**
048 * table table-condensed table-bordered uif-tableCollectionLayout dataTable
049 */
050 private static final String TABLE_ROW_SIX_XPATH="//table[@class='table table-condensed table-bordered uif-tableCollectionLayout dataTable']/tbody/tr[6]";
051
052 /**
053 * Clear Values
054 */
055 private static final String FAILURE_MESSAGE="Results are not restricted to 5 rows.";
056
057 @Override
058 public String getBookmarkUrl() {
059 return BOOKMARK_URL;
060 }
061
062 @Override
063 protected void navigate() throws Exception {
064 waitAndClickById("Demo-DemoLink", "");
065 waitAndClickByLinkText("Lookup Multi Value");
066 }
067
068 protected void testLookUpMultiValue() throws InterruptedException {
069 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME,"a1");
070 waitAndClickButtonByText(SEARCH);
071 Thread.sleep(3000);
072 waitForElementPresentByXpath("//a[contains(text(), 'a1')]");
073 waitAndClickButtonByText(CLEAR_VALUES);
074 waitAndClickButtonByText(SEARCH);
075 Thread.sleep(3000);
076 if(isElementPresentByXpath(TABLE_ROW_SIX_XPATH)){
077 fail(FAILURE_MESSAGE);
078 }
079 }
080
081 @Test
082 public void testLookUpMultiValueBookmark() throws Exception {
083 testLookUpMultiValue();
084 passed();
085 }
086
087 @Ignore // Link removed
088 @Test
089 public void testLookUpMultiValueNav() throws Exception {
090 testLookUpMultiValue();
091 passed();
092 }
093 }