001/** 002 * Copyright 2005-2016 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 LibraryValidationPrerequisiteConstraintsAft extends WebDriverLegacyITBase { 027 028 /** 029 * /kr-krad/kradsampleapp?viewId=Demo-PrerequisiteConstraintView&methodToCall=start 030 */ 031 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-PrerequisiteConstraintView&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("Prerequisite Constraint"); 043 } 044 045 protected void testValidationPrerequisiteConstraintsRequired() throws Exception { 046 waitAndClickByLinkText("Basic Example"); 047 048 waitAndTypeByName("inputField1","a"); 049 waitAndTypeByName("inputField2",""); 050 waitAndTypeByName("inputField3",""); 051 waitAndTypeByName("inputField1",""); 052 String id2 = findElement(By.name("inputField2")).getAttribute("id"); 053 assertTrue(findElement(By.id(id2)).getAttribute("class").contains("error")); 054 String id3 = findElement(By.name("inputField3")).getAttribute("id"); 055 assertTrue(findElement(By.id(id3)).getAttribute("class").contains("error")); 056 clearTextByName("inputField1"); 057 waitAndTypeByName("inputField3","a"); 058 waitAndTypeByName("inputField1",""); 059 String id1 = findElement(By.name("inputField1")).getAttribute("id"); 060 assertTrue(findElement(By.id(id1)).getAttribute("class").contains("error")); 061 } 062 063 @Test 064 public void testValidationPrerequisiteConstraintsBookmark() throws Exception { 065 testValidationPrerequisiteConstraintsRequired(); 066 passed(); 067 } 068 069 @Test 070 public void testValidationPrerequisiteConstraintsNav() throws Exception { 071 testValidationPrerequisiteConstraintsRequired(); 072 passed(); 073 } 074}