001/** 002 * Copyright 2005-2015 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 org.kuali.rice.krad.demo.travel.application; 017 018import org.kuali.rice.krad.demo.ViewDemoAftBase; 019import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase; 020import org.junit.Test; 021 022/** 023 * @author Kuali Rice Team (rice.collab@kuali.org) 024 */ 025public class DemoTravelPerDiemLookUpAft extends ViewDemoAftBase { 026 027 /** 028 * /kr-krad/lookup?methodToCall=start&dataObjectClassName=edu.sampleu.travel.dataobject.TravelPerDiemExpense 029 */ 030 public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&dataObjectClassName=edu.sampleu.travel.dataobject.TravelPerDiemExpense"; 031 032 /** 033 * Search 034 */ 035 public static final String SEARCH = "Search"; 036 037 /** 038 * Clear Values 039 */ 040 public static final String CLEAR_VALUES = "Clear Values"; 041 042 @Override 043 public String getBookmarkUrl() { 044 return BOOKMARK_URL; 045 } 046 047 @Override 048 protected void navigate() throws Exception { 049 waitAndClickDemoLink(); 050 waitAndClickByLinkText("Travel Per Diem Lookup"); 051 } 052 053 protected void testTravelPerDiemLookUp() throws Exception { 054 waitAndTypeByName("lookupCriteria[travelPerDiemExpenseId]","1"); 055 waitAndTypeByName("lookupCriteria[travelAuthorizationDocumentId]","1"); 056 selectByName("lookupCriteria[travelDestinationId]","Colorado"); 057 waitAndClickByXpath("//div[@data-label='Primary Destination']/div/div/button[@class='btn btn-default uif-action icon-search']"); 058 waitSearchAndReturnFromLightbox(); 059 assertEquals("lookupCriteria[travelAuthorizationDocumentId] value not 1 as set before Lightbox search", "1", waitAndGetAttributeByName("lookupCriteria[travelAuthorizationDocumentId]", "value")); 060 waitAndClickByXpath("//div[@data-label='Mileage Rate']/div/div/button[@class='btn btn-default uif-action icon-search']"); 061 waitSearchAndReturnFromLightbox(); 062 waitAndClickButtonByText(SEARCH); 063 waitForTextPresent("No values match this search."); 064 waitForTextPresent("You have entered the primary key for this table (Id) in the search criteria. Since these fields can be used to uniquely identify a row in this table, the other search criteria entered will be ignored."); 065 waitAndClickButtonByText(CLEAR_VALUES); 066 waitAndTypeByName("lookupCriteria[travelPerDiemExpenseId]","10000"); 067 waitAndClickButtonByText(SEARCH); 068 // Last data first so data is fully loaded 069 String activeResults [] ={"30","10000","10000","10000","10","10","15","20","DO"}; 070 assertTextPresent(activeResults); 071 } 072 073 @Test 074 public void testTravelPerDiemLookUpBookmark() throws Exception { 075 testTravelPerDiemLookUp(); 076 passed(); 077 } 078 079 @Test 080 public void testTravelPerDiemLookUpNav() throws Exception { 081 testTravelPerDiemLookUp(); 082 passed(); 083 } 084 085 private void waitSearchAndReturnFromLightbox() throws Exception { 086 gotoLightBox(); 087 waitAndClickButtonByText("Search"); 088 waitAndClickByLinkText("return value"); 089 } 090}