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.sampleu.travel; 017 018 import com.thoughtworks.selenium.SeleneseTestBase; 019 import org.kuali.rice.testtools.common.JiraAwareFailable; 020 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase; 021 022 /** 023 * Tests the Component section in Rice. 024 * 025 * @author Kuali Rice Team (rice.collab@kuali.org) 026 */ 027 public abstract class DirtyFieldsAftBase extends WebDriverLegacyITBase { 028 029 /** 030 * "/kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&readOnlyFields=field91"; 031 */ 032 public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&readOnlyFields=field91"; 033 034 @Override 035 protected String getBookmarkUrl() { 036 return BOOKMARK_URL; 037 } 038 039 protected void navigation() throws InterruptedException { 040 waitAndClickKRAD(); 041 waitAndClickByLinkText(UIF_COMPONENTS_KITCHEN_SINK_LINK_TEXT); 042 switchToWindow(KUALI_UIF_COMPONENTS_WINDOW_XPATH); 043 } 044 045 protected void testDirtyFieldsCheckNav(JiraAwareFailable failable) throws Exception { 046 navigation(); 047 testDirtyFieldsCheck(); 048 passed(); 049 } 050 051 protected void testDirtyFieldsCheckBookmark(JiraAwareFailable failable) throws Exception { 052 testDirtyFieldsCheck(); 053 passed(); 054 } 055 056 057 protected void testDirtyFieldsCheck() throws Exception { 058 checkForIncidentReport(getTestUrl()); 059 waitAndClickByLinkText("Text Controls"); 060 waitAndTypeByName("field1", "test 1"); 061 waitAndTypeByName("field102", "test 2"); 062 assertCancelConfirmation(); 063 064 // testing manually 065 waitForElementPresentByName("field100"); 066 waitAndTypeByName("field100", "here"); 067 waitAndTypeByName("field103", "there"); 068 069 // 'Validation' navigation link 070 assertCancelConfirmation(); 071 072 // testing manually 073 waitForElementPresentByName("field106"); 074 075 // //Asserting text-field style to uppercase. This style would display 076 // input text in uppercase. 077 assertTrue(waitAndGetAttributeByName("field112", "style").contains("text-transform: uppercase;")); 078 assertCancelConfirmation(); 079 waitForElementPresentByName("field101"); 080 SeleneseTestBase.assertEquals("val", waitAndGetAttributeByName("field101", "value")); 081 clearTextByName("field101"); 082 waitAndTypeByName("field101", "1"); 083 waitAndTypeByName("field104", ""); 084 SeleneseTestBase.assertEquals("1", waitAndGetAttributeByName("field101", "value")); 085 waitAndTypeByName("field104", "2"); 086 087 // 'Progressive Disclosure' navigation link 088 assertCancelConfirmation(); 089 } 090 }