001/** 002 * Copyright 2005-2015 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.validation; 017 018import org.junit.Test; 019 020import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase; 021import org.openqa.selenium.By; 022 023/** 024 * @author Kuali Rice Team (rice.collab@kuali.org) 025 */ 026public class LibraryValidationSimpleConstraintsAft extends WebDriverLegacyITBase { 027 028 /** 029 * /kr-krad/kradsampleapp?viewId=Demo-SimpleConstraintView&methodToCall=start 030 */ 031 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-SimpleConstraintView&methodToCall=start"; 032 033 @Override 034 protected String getBookmarkUrl() { 035 return BOOKMARK_URL; 036 } 037 038 @Override 039 protected void navigate() throws Exception { 040 waitAndClickLibraryLink(); 041 waitAndClickByLinkText("Validation"); 042 waitAndClickByLinkText("Simple Constraints"); 043 } 044 045 protected void testValidationSimpleConstraintsRequired() throws Exception { 046 waitAndClickByLinkText("Required"); 047 048 assertFocusTypeBlurError("inputField1", ""); 049 assertFocusTypeBlurError("inputField2", ""); 050 assertFocusTypeBlurError("inputField3", ""); 051 } 052 053 protected void testValidationSimpleConstraintsMinMaxLength() throws Exception { 054 waitAndClickByLinkText("Min/Max Length"); 055 056 waitAndTypeByName("inputField4","deepmoteria"); 057 Thread.sleep(1000); 058 assertEquals("deepm", findElement(By.name("inputField4")).getAttribute("value")); 059 assertFocusTypeBlurError("inputField5", "de"); 060 } 061 062 protected void testValidationSimpleConstraintsMinMaxValue() throws Exception { 063 waitAndClickByLinkText("Min/Max Value"); 064 065 assertFocusTypeBlurError("inputField6","21"); 066 assertFocusTypeBlurError("inputField7","2"); 067 } 068 069 @Test 070 public void testValidationSimpleConstraintsBookmark() throws Exception { 071 testValidationSimpleConstraintsRequired(); 072 testValidationSimpleConstraintsMinMaxLength(); 073 testValidationSimpleConstraintsMinMaxValue(); 074 passed(); 075 } 076 077 @Test 078 public void testValidationSimpleConstraintsNav() throws Exception { 079 testValidationSimpleConstraintsRequired(); 080 testValidationSimpleConstraintsMinMaxLength(); 081 testValidationSimpleConstraintsMinMaxValue(); 082 passed(); 083 } 084}