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