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.lookup.view; 017 018import org.kuali.rice.krad.demo.ViewDemoAftBase; 019import org.junit.Test; 020 021/** 022 * @author Kuali Rice Team (rice.collab@kuali.org) 023 */ 024public class DemoLookUpVerticallyStackedActionsAft extends ViewDemoAftBase { 025 026 /** 027 * /kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewVerticalActions 028 */ 029 public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewVerticalActions"; 030 031 /** 032 * lookupCriteria[number] 033 */ 034 private static final String TRAVEL_ACCOUNT_NUMBER="lookupCriteria[number]"; 035 036 /** 037 * lookupCriteria[name] 038 */ 039 private static final String TRAVEL_ACCOUNT_NAME="lookupCriteria[name]"; 040 041 /** 042 * Search 043 */ 044 private static final String SEARCH_BUTTON_TEXT="Search"; 045 046 /** 047 * Clear Values 048 */ 049 private static final String CLEAR_VALUES_BUTTON_TEXT="Clear Values"; 050 051 /** 052 * lookupCriteria[fiscalOfficer.principalName] 053 */ 054 private static final String PRINCIPAL_NAME="lookupCriteria[fiscalOfficer.principalName]"; 055 056 @Override 057 public String getBookmarkUrl() { 058 return BOOKMARK_URL; 059 } 060 061 @Override 062 protected void navigate() throws Exception { 063 waitAndClickDemoLink(); 064 waitAndClickByLinkText("Lookup vertically stacked actions"); 065 } 066 067 protected void testLookUpVerticallyStackedActions() throws InterruptedException { 068 //Search By Number 069 waitAndTypeByName(TRAVEL_ACCOUNT_NUMBER,"a1"); 070 waitAndClickButtonByText(SEARCH_BUTTON_TEXT); 071 waitForProgressLoading(); 072 assertVerticallyStackedActions(); 073 waitAndClickButtonByText(CLEAR_VALUES_BUTTON_TEXT); 074 075 //Search By Fiscal Officer 076 waitAndTypeByName(PRINCIPAL_NAME,"fran"); 077 waitAndClickButtonByText(SEARCH_BUTTON_TEXT); 078 waitForProgressLoading(); 079 assertVerticallyStackedActions(); 080 waitAndClickButtonByText(CLEAR_VALUES_BUTTON_TEXT); 081 082 //Search By Name 083 waitAndTypeByName(TRAVEL_ACCOUNT_NAME,"Travel Account 3"); 084 waitAndClickButtonByText(SEARCH_BUTTON_TEXT); 085 waitForProgressLoading(); 086 assertVerticallyStackedActions(); 087 waitAndClickButtonByText(CLEAR_VALUES_BUTTON_TEXT); 088 } 089 090 private void assertVerticallyStackedActions() throws InterruptedException{ 091 waitIsVisibleByXpath("//a[contains(text(),'edit') and @class='uif-link uif-boxLayoutVerticalItem pull-left clearfix']"); 092 assertTrue(isVisibleByXpath("//a[contains(text(),'copy') and @class='uif-link uif-boxLayoutVerticalItem pull-left clearfix']")); 093 } 094 095 @Test 096 public void testLookUpVerticallyStackedActionsBookmark() throws Exception { 097 testLookUpVerticallyStackedActions(); 098 passed(); 099 } 100 101 @Test 102 public void testLookUpVerticallyStackedActionsNav() throws Exception { 103 testLookUpVerticallyStackedActions(); 104 passed(); 105 } 106}