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.library.controls; 017 018 import org.junit.Test; 019 import org.kuali.rice.testtools.selenium.SmokeTestBase; 020 021 /** 022 * @author Kuali Rice Team (rice.collab@kuali.org) 023 */ 024 public class DemoLibraryControlSpinnerSmokeTest extends SmokeTestBase { 025 026 /** 027 * /kr-krad/kradsampleapp?viewId=Demo-SpinnerControl-View 028 */ 029 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-SpinnerControl-View"; 030 031 @Override 032 protected String getBookmarkUrl() { 033 return BOOKMARK_URL; 034 } 035 036 @Override 037 protected void navigate() throws Exception { 038 waitAndClickById("Demo-LibraryLink", ""); 039 waitAndClickByLinkText("Controls"); 040 waitAndClickByLinkText("Spinner"); 041 } 042 043 protected void testLibraryControlSpinnerDefault() throws Exception { 044 assertElementPresentByXpath("//input[@name='inputField1' and @size='10']"); 045 assertElementPresentByXpath("//div[@data-parent='Demo-SpinnerControl-Example1']/span/a[@tabindex='-1']"); 046 } 047 048 protected void testLibraryControlSpinnerCurrency() throws Exception { 049 waitAndClickByLinkText("Currency option"); 050 waitAndClickByXpath("//div[@data-parent='Demo-SpinnerControl-Example2']/span/a[@tabindex='-1']"); 051 assertElementPresentByXpath("//div[@data-parent='Demo-SpinnerControl-Example2']/span/input[@aria-valuenow='25']"); 052 } 053 054 protected void testLibraryControlSpinnerDecimal() throws Exception { 055 waitAndClickByLinkText("Decimal option"); 056 waitAndClickByXpath("//div[@data-parent='Demo-SpinnerControl-Example3']/span/a[@tabindex='-1']"); 057 assertElementPresentByXpath("//div[@data-parent='Demo-SpinnerControl-Example3']/span/input[@aria-valuenow='0.01']"); 058 } 059 060 protected void testLibraryControlSpinnerWidgetInput() throws Exception { 061 waitAndClickByLinkText("Widget Input Only"); 062 waitAndClickByXpath("//div[@data-parent='Demo-SpinnerControl-Example4']/span/a[@tabindex='-1']"); 063 assertElementPresentByXpath("//div[@data-parent='Demo-SpinnerControl-Example4']/span/input[@aria-valuenow='1']"); 064 } 065 066 @Test 067 public void testControlSpinnerBookmark() throws Exception { 068 testLibraryControlSpinnerDefault(); 069 testLibraryControlSpinnerCurrency(); 070 testLibraryControlSpinnerDecimal(); 071 testLibraryControlSpinnerWidgetInput(); 072 passed(); 073 } 074 075 @Test 076 public void testControlSpinnerNav() throws Exception { 077 testLibraryControlSpinnerDefault(); 078 testLibraryControlSpinnerCurrency(); 079 testLibraryControlSpinnerDecimal(); 080 testLibraryControlSpinnerWidgetInput(); 081 passed(); 082 } 083 }