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 */ 016package org.kuali.rice.krad.demo.uif.library.controls; 017 018import org.junit.Test; 019 020import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase; 021 022/** 023 * @author Kuali Rice Team (rice.collab@kuali.org) 024 */ 025public class DemoControlRadioAft extends WebDriverLegacyITBase { 026 027 /** 028 * /kr-krad/kradsampleapp?viewId=Demo-RadioControlView&methodToCall=start 029 */ 030 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-RadioControlView&methodToCall=start"; 031 032 @Override 033 protected String getBookmarkUrl() { 034 return BOOKMARK_URL; 035 } 036 037 @Override 038 protected void navigate() throws Exception { 039 waitAndClickById("Demo-LibraryLink", ""); 040 waitAndClickByLinkText("Controls"); 041 waitAndClickByLinkText("Radio"); 042 } 043 044 protected void testLibraryControlRadioOptionsFinder() throws Exception { 045 waitAndClickByLinkText("OptionsFinder"); 046 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example1']/fieldset/span/input[@type='radio' and @name='inputField2' and @value='1']"); 047 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example1']/fieldset/span/input[@type='radio' and @name='inputField2' and @value='5']"); 048 } 049 050 protected void testLibraryControlRadioKeyValuePairs() throws Exception { 051 waitAndClickByLinkText("Key-value pr."); 052 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example2']/fieldset/span/input[@type='radio' and @name='inputField2' and @value='1']"); 053 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example2']/fieldset/span/input[@type='radio' and @name='inputField2' and @value='2']"); 054 } 055 056 protected void testLibraryControlRadioDisabled() throws Exception { 057 waitAndClickByLinkText("Disabled"); 058 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example3']/fieldset/span/input[@type='radio' and @name='inputField2' and @value='1']"); 059 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example3']/fieldset/span/input[@type='radio' and @name='inputField2' and @value='2']"); 060 } 061 062 protected void testLibraryControlRadioDelimiter() throws Exception { 063 waitAndClickByLinkText("Delimiter"); 064 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example4']/fieldset/span/input[@type='radio' and @name='inputField2' and @value='1']"); 065 assertTextPresent(";"); 066 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example4']/fieldset/span/input[@type='radio' and @name='inputField2' and @value='2']"); 067 } 068 069 protected void testLibraryControlRadioEvaluateDisabledOnKeyUp() throws Exception { 070 waitAndClickByLinkText("Evaluate disabled on key up"); 071 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example5']/fieldset/span/input[@type='radio' and @name='inputField2' and @disabled='disabled' and @value='1']"); 072 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example5']/fieldset/span/input[@type='radio' and @name='inputField2' and @disabled='disabled' and @value='2']"); 073 waitAndTypeByName("inputField1","a"); 074 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example5']/fieldset/span/input[@type='radio' and @name='inputField2' and @value='1']"); 075 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example5']/fieldset/span/input[@type='radio' and @name='inputField2' and @value='2']"); 076 } 077 078 protected void testLibraryControlRadioEnableWhenChanged() throws Exception { 079 waitAndClickByLinkText("Enable when changed"); 080 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example6']/fieldset/span/input[@type='radio' and @name='inputField4' and @disabled='disabled' and @value='1']"); 081 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example6']/fieldset/span/input[@type='radio' and @name='inputField4' and @disabled='disabled' and @value='2']"); 082 waitAndTypeByName("inputField3","a"); 083 waitAndClickLinkContainingText("Library Navigation"); 084 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example6']/fieldset/span/input[@type='radio' and @name='inputField4' and @value='1']"); 085 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example6']/fieldset/span/input[@type='radio' and @name='inputField4' and @value='2']"); 086 } 087 088 protected void testLibraryControlRadioDisableWhenChanged() throws Exception { 089 waitAndClickByLinkText("Disable when changed"); 090 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example7']/fieldset/span/input[@type='radio' and @name='inputField6' and @value='1']"); 091 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example7']/fieldset/span/input[@type='radio' and @name='inputField6' and @value='2']"); 092 waitAndTypeByName("inputField5","a"); 093 waitAndClickLinkContainingText("Library Navigation"); 094 waitForElementPresentByXpath("//div[@data-parent='Demo-RadioControl-Example7']/fieldset/span/input[@disabled]"); 095 } 096 097 @Test 098 public void testControlRadioBookmark() throws Exception { 099 testLibraryControlRadioOptionsFinder(); 100 testLibraryControlRadioKeyValuePairs(); 101 testLibraryControlRadioDisabled(); 102 testLibraryControlRadioDelimiter(); 103 testLibraryControlRadioEvaluateDisabledOnKeyUp(); 104 testLibraryControlRadioEnableWhenChanged(); 105 testLibraryControlRadioDisableWhenChanged(); 106 passed(); 107 } 108 109 @Test 110 public void testControlRadioNav() throws Exception { 111 testLibraryControlRadioOptionsFinder(); 112 testLibraryControlRadioKeyValuePairs(); 113 testLibraryControlRadioDisabled(); 114 testLibraryControlRadioDelimiter(); 115 testLibraryControlRadioEvaluateDisabledOnKeyUp(); 116 testLibraryControlRadioEnableWhenChanged(); 117 testLibraryControlRadioDisableWhenChanged(); 118 passed(); 119 } 120}