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.elements;
017
018 import org.junit.Test;
019
020 import org.kuali.rice.testtools.selenium.Failable;
021 import org.kuali.rice.testtools.selenium.ITUtil;
022 import org.kuali.rice.testtools.selenium.SmokeTestBase;
023 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
024
025 /**
026 * @author Kuali Rice Team (rice.collab@kuali.org)
027 */
028 public class DemoLibraryElementsDropdownMenuSmokeTest extends SmokeTestBase {
029
030 /**
031 * /kr-krad/kradsampleapp?viewId=Demo-DropdownMenu-View
032 */
033 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-DropdownMenu-View";
034
035 @Override
036 protected String getBookmarkUrl() {
037 return BOOKMARK_URL;
038 }
039
040 @Override
041 protected void navigate() throws Exception {
042 waitAndClickById("Demo-LibraryLink", "");
043 waitAndClickByLinkText("Elements");
044 waitAndClickByLinkText("Dropdown Menu");
045 }
046
047 protected void testLibraryElementsDropdownBasic() throws Exception {
048 waitAndClickByLinkText("User thclark");
049 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example1']/div[3]/div/ul/li/a[contains(text(),'Preferences')]");
050 }
051
052 protected void testLibraryElementsDropdownWithDivider() throws Exception {
053 waitAndClickByLinkText("Dropdown with Divider");
054 waitAndClickByLinkText("Action List");
055 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example2']/div[3]/div/ul/li/a[contains(text(),'Proposal #1034')]");
056 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example2']/div[3]/div/ul/li[@class='uif-actionLink divider ui-corner-right']");
057 }
058
059 protected void testLibraryElementsDropdownWithHeader() throws Exception {
060 waitAndClickByLinkText("Dropdown with Headers");
061 waitAndClickByLinkText("Favorites");
062 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example3']/div[3]/div/ul/li/a[contains(text(),'Proposal')]");
063 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example3']/div[3]/div/ul/li[@class='uif-actionLink dropdown-header ui-corner-right']");
064 }
065
066 protected void testLibraryElementsDropdownWithDisabled() throws Exception {
067 waitAndClickByLinkText("Dropdown with Disabled");
068 waitAndClickByXpath("//div[@id='Demo-DropdownMenu-Example4']/div[3]/div/a");
069 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example4']/div[3]/div/ul/li/a[@class='uif-actionLink']");
070 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example4']/div[3]/div/ul/li/a[@class='uif-actionLink disabled']");
071 }
072
073 protected void testLibraryElementsDropdownWithActionOptions() throws Exception {
074 waitAndClickByLinkText("Dropdown with Action Options");
075 waitAndClickByXpath("//div[@id='Demo-DropdownMenu-Example5']/div[3]/div/a");
076 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example5']/div[3]/div/ul/li/a[contains(text(),'Refresh Section')]");
077 }
078
079 protected void testLibraryElementsDropdownWithToggleButton() throws Exception {
080 waitAndClickByLinkText("Dropdown with Toggle Button");
081 waitAndClickByXpath("//div[@id='Demo-DropdownMenu-Example6']/div[3]/div/a/b[@class='caret']");
082 assertElementPresentByXpath("//div[@id='Demo-DropdownMenu-Example6']/div[3]/div/ul/li/a[contains(text(),'Preferences')]");
083 }
084 @Test
085 public void testLibraryElementsDropdownBookmark() throws Exception {
086 testLibraryElementsDropdownBasic();
087 testLibraryElementsDropdownWithDivider();
088 testLibraryElementsDropdownWithHeader();
089 testLibraryElementsDropdownWithDisabled();
090 testLibraryElementsDropdownWithActionOptions();
091 testLibraryElementsDropdownWithToggleButton();
092 passed();
093 }
094
095 @Test
096 public void testLibraryElementsDropdownNav() throws Exception {
097 testLibraryElementsDropdownBasic();
098 testLibraryElementsDropdownWithDivider();
099 testLibraryElementsDropdownWithHeader();
100 testLibraryElementsDropdownWithDisabled();
101 testLibraryElementsDropdownWithActionOptions();
102 testLibraryElementsDropdownWithToggleButton();
103 passed();
104 }
105 }