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.demo.uif.library;
017
018 import com.thoughtworks.selenium.SeleneseTestBase;
019 import org.junit.Test;
020 import edu.samplu.common.SmokeTestBase;
021
022 /**
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025 public class DemoLibraryWidgetsBreadcrumbsSmokeTest extends SmokeTestBase {
026
027 /**
028 * /kr-krad/kradsampleapp?viewId=Demo-Breadcrumbs-View&methodToCall=start
029 */
030 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-Breadcrumbs-View&methodToCall=start";
031
032 public static final String FIELD_TO_CHECK = "inputField9";
033 public static final String START_PAGE_TITLE = "Kuali";
034 public static final String TARGET_PAGE_TITLE = "Kuali :: View Title";
035 public static final String TARGET_URL_CHECK = "/kr-krad/kradsampleapp?viewId=Demo-Breadcrumbs-View";
036
037 @Override
038 protected String getBookmarkUrl() {
039 return BOOKMARK_URL;
040 }
041
042 @Override
043 protected void navigate() throws Exception {
044 waitAndClickById("Demo-LibraryLink", "");
045 waitAndClickByLinkText("Widgets");
046 waitAndClickByLinkText("Breadcrumbs");
047 }
048
049 protected void testWidgetsBreadcrumbDefault() throws Exception {
050 waitAndClickByLinkText("Default Breadcrumbs");
051 switchToWindow(TARGET_PAGE_TITLE);
052 SeleneseTestBase.assertTrue(driver.getCurrentUrl().contains(TARGET_URL_CHECK + "1"));
053 assertElementPresentByName(FIELD_TO_CHECK);
054 driver.close();
055 switchToWindow(START_PAGE_TITLE);
056 }
057
058 protected void testWidgetsBreadcrumbParentLocation() throws Exception {
059 waitAndClickByLinkText("ParentLocation");
060 waitAndClickByLinkText("Home ParentLocation");
061 switchToWindow(TARGET_PAGE_TITLE);
062 SeleneseTestBase.assertTrue(driver.getCurrentUrl().contains(TARGET_URL_CHECK + "2"));
063 assertElementPresentByName(FIELD_TO_CHECK);
064 driver.close();
065 switchToWindow(START_PAGE_TITLE);
066 }
067
068 protected void testWidgetsBreadcrumbParentLocationChain() throws Exception {
069 waitAndClickByLinkText("ParentLocation Chain");
070 waitAndClickByLinkText("ParentLocation Chain/Trail");
071 switchToWindow(TARGET_PAGE_TITLE);
072 SeleneseTestBase.assertTrue(driver.getCurrentUrl().contains(TARGET_URL_CHECK + "3"));
073 assertElementPresentByName(FIELD_TO_CHECK);
074 driver.close();
075 switchToWindow(START_PAGE_TITLE);
076 }
077
078 protected void testWidgetsBreadcrumbParentLocationPage() throws Exception {
079 waitAndClickByLinkText("ParentLocation Page");
080 waitAndClickByLinkText("ParentLocation View and Page");
081 switchToWindow(TARGET_PAGE_TITLE);
082 SeleneseTestBase.assertTrue(driver.getCurrentUrl().contains(TARGET_URL_CHECK + "4"));
083 assertElementPresentByName(FIELD_TO_CHECK);
084 driver.close();
085 switchToWindow(START_PAGE_TITLE);
086 }
087
088 protected void testWidgetsBreadcrumbPreViewAndPrePage() throws Exception {
089 waitAndClickByLinkText("preView and prePage");
090 waitAndClickByLinkText("preView and prePage breadcrumbs");
091 switchToWindow(TARGET_PAGE_TITLE);
092 SeleneseTestBase.assertTrue(driver.getCurrentUrl().contains(TARGET_URL_CHECK + "5"));
093 assertElementPresentByName(FIELD_TO_CHECK);
094 driver.close();
095 switchToWindow(START_PAGE_TITLE);
096 }
097
098 protected void testWidgetsBreadcrumbBreadcrumbLabel() throws Exception {
099 waitAndClickByLinkText("Breadcrumb Label");
100 waitAndClickByLinkText("Override Breadcrumb Label");
101 switchToWindow(TARGET_PAGE_TITLE);
102 SeleneseTestBase.assertTrue(driver.getCurrentUrl().contains(TARGET_URL_CHECK + "6"));
103 assertElementPresentByName(FIELD_TO_CHECK);
104 driver.close();
105 switchToWindow(START_PAGE_TITLE);
106 }
107
108 protected void testWidgetsBreadcrumbHomewardPath() throws Exception {
109 waitAndClickByLinkText("Homeward Path");
110 waitAndClickByLinkText("Homeward Path Breadcrumbs");
111 switchToWindow(TARGET_PAGE_TITLE);
112 SeleneseTestBase.assertTrue(driver.getCurrentUrl().contains(TARGET_URL_CHECK + "7"));
113 assertElementPresentByName(FIELD_TO_CHECK);
114 driver.close();
115 switchToWindow(START_PAGE_TITLE);
116 }
117
118 protected void testWidgetsBreadcrumbPathBased() throws Exception {
119 waitAndClickByLinkText("Path-based");
120 waitAndClickByLinkText("Path-based Breadcrumbs");
121 switchToWindow(TARGET_PAGE_TITLE);
122 SeleneseTestBase.assertTrue(driver.getCurrentUrl().contains(TARGET_URL_CHECK + "8"));
123 waitAndClickByLinkText("Page 2");
124 assertElementPresentByName("inputField9");
125 driver.close();
126 switchToWindow(START_PAGE_TITLE);
127 }
128
129 protected void testWidgetsBreadcrumbOverrides() throws Exception {
130 waitAndClickByLinkText("Overrides");
131 waitAndClickByLinkText("Breadcrumb Overrides");
132 switchToWindow(TARGET_PAGE_TITLE);
133 SeleneseTestBase.assertTrue(driver.getCurrentUrl().contains(TARGET_URL_CHECK + "9"));
134 assertElementPresentByName(FIELD_TO_CHECK);
135 driver.close();
136 switchToWindow(START_PAGE_TITLE);
137 }
138
139 protected void testWidgetsBreadcrumbSiblingBreadcrumbs() throws Exception {
140 waitAndClickByLinkText("Sibling Breadcrumbs");
141 waitAndClickById("u100164");
142 switchToWindow(TARGET_PAGE_TITLE);
143 SeleneseTestBase.assertTrue(driver.getCurrentUrl().contains(TARGET_URL_CHECK + "10"));
144 assertElementPresentByName(FIELD_TO_CHECK);
145 driver.close();
146 switchToWindow(START_PAGE_TITLE);
147 }
148
149 @Test
150 public void testWidgetsBreadcrumbBookmark() throws Exception {
151 testWidgetsBreadcrumbDefault();
152 testWidgetsBreadcrumbParentLocation();
153 testWidgetsBreadcrumbParentLocationChain();
154 testWidgetsBreadcrumbParentLocationPage();
155 testWidgetsBreadcrumbPreViewAndPrePage();
156 testWidgetsBreadcrumbBreadcrumbLabel();
157 testWidgetsBreadcrumbHomewardPath();
158 testWidgetsBreadcrumbPathBased();
159 testWidgetsBreadcrumbOverrides();
160 testWidgetsBreadcrumbSiblingBreadcrumbs();
161 driver.close();
162 passed();
163 }
164
165 @Test
166 public void testWidgetsBreadcrumbNav() throws Exception {
167 testWidgetsBreadcrumbDefault();
168 testWidgetsBreadcrumbParentLocation();
169 testWidgetsBreadcrumbParentLocationChain();
170 testWidgetsBreadcrumbParentLocationPage();
171 testWidgetsBreadcrumbPreViewAndPrePage();
172 testWidgetsBreadcrumbBreadcrumbLabel();
173 testWidgetsBreadcrumbHomewardPath();
174 testWidgetsBreadcrumbPathBased();
175 testWidgetsBreadcrumbOverrides();
176 testWidgetsBreadcrumbSiblingBreadcrumbs();
177 driver.close();
178 passed();
179 }
180 }