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 */ 016package edu.samplu.krad.library.validation; 017 018import org.junit.Test; 019 020import edu.samplu.common.SmokeTestBase; 021import org.openqa.selenium.By; 022 023/** 024 * @author Kuali Rice Team (rice.collab@kuali.org) 025 */ 026public class DemoLibraryValidationDatePatternConstraintsSmokeTest extends SmokeTestBase { 027 028 /** 029 * /kr-krad/kradsampleapp?viewId=Demo-DatePatternConstraint-View&methodToCall=start 030 */ 031 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-DatePatternConstraint-View&methodToCall=start"; 032 033 @Override 034 protected String getBookmarkUrl() { 035 return BOOKMARK_URL; 036 } 037 038 @Override 039 protected void navigate() throws Exception { 040 waitAndClickById("Demo-LibraryLink", ""); 041 waitAndClickByLinkText("Validation"); 042 waitAndClickByLinkText("Date Constraint"); 043 } 044 045 protected void testValidationDatePatternConstraints() throws Exception { 046 //Scenario-1 047 waitAndTypeByName("inputField1","2 June 2012"); 048 waitAndClickByLinkText("Usage"); 049 assertElementPresentByXpath("//input[@name='inputField1' and @class='uif-textControl validChar-inputField10 dirty error']"); 050 } 051 052 protected void testValidationDatePatternConstraintsBasicDate() throws Exception { 053 waitAndClickByLinkText("Basic Date"); 054 055 //Scenario-1 056 waitAndTypeByName("inputField3","07/2/13"); 057 waitAndTypeByName("inputField2","2 July 2013"); 058 isNotVisible(By.xpath("//div[@class='uif-clientMessageItems uif-clientErrorDiv']")); 059 waitAndTypeByName("inputField2",""); 060 isVisible(By.xpath("//div[@class='uif-clientMessageItems uif-clientErrorDiv']")); 061 } 062 063 protected void testValidationDatePatternCustomize() throws Exception { 064 waitAndClickByLinkText("Customize"); 065 066 //Scenario-1 067 waitAndTypeByName("inputField4","23/12/13"); 068 waitAndClickByLinkText("Usage"); 069 isVisible(By.xpath("//div[@class='uif-clientMessageItems uif-clientErrorDiv']")); 070 } 071 072 @Test 073 public void testValidationDatePatternConstraintsBookmark() throws Exception { 074 testValidationDatePatternConstraints(); 075 testValidationDatePatternConstraintsBasicDate(); 076 testValidationDatePatternCustomize(); 077 passed(); 078 } 079 080 @Test 081 public void testValidationDatePatternConstraintsNav() throws Exception { 082 testValidationDatePatternConstraints(); 083 testValidationDatePatternConstraintsBasicDate(); 084 testValidationDatePatternCustomize(); 085 passed(); 086 } 087}