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 edu.sampleu.krad.screenelement; 017 018import org.junit.Test; 019import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils; 020import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase; 021import org.kuali.rice.testtools.selenium.WebDriverUtils; 022 023/** 024 * @author Kuali Rice Team (rice.collab@kuali.org) 025 */ 026public class StateBasedValidationClientCustomizedTestsAft extends WebDriverLegacyITBase { 027 028 /** 029 * /kr-krad/uicomponents?viewId=Demo-StateBasedValidation-ClientCustom&methodToCall=start 030 */ 031 public static final String BOOKMARK_URL ="/kr-krad/uicomponents?viewId=Demo-StateBasedValidation-ClientCustom&methodToCall=start"; 032 033 @Override 034 protected String getBookmarkUrl() { 035 return BOOKMARK_URL; 036 } 037 038 @Override 039 protected void navigate() throws InterruptedException { 040 waitAndClickKRAD(); 041 waitAndClickByLinkText("State-based Validation (Client customized test)"); 042 switchToWindow("Kuali :: State-based Validation Custom client-side Test View"); 043 } 044 045 private void testStateBasedValidationClientCustomizedTests() throws Exception{ 046 //State 1 047 waitAndClickButtonByText("Check Form"); 048 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasWarning' and @data-label='Field 1']"); 049 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasWarning' and @data-label='Field 2']"); 050 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 3']"); 051 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 4']"); 052 waitForElementPresentByXpath("//input[@maxlength='50']"); 053 054 //State 2 055 waitAndClickButtonByText("Change to State 2"); 056 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 1']"); 057 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 2']"); 058 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 3']"); 059 waitForElementPresentByXpath("//input[@maxlength='50']"); 060 061 //State 3 062 waitAndTypeByName("field5","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); 063 waitAndClickButtonByText("Change to State 3"); 064 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 2']"); 065 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 4']"); 066 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 5']"); 067 fireMouseOverEventByName("field5"); 068 waitForTextPresent("For State 3, Must be at most 25 characters"); 069 070 //State 4 071 waitAndClickButtonByText("Change to State 4"); 072 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 2']"); 073 waitForElementPresentByXpath("//div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutVerticalItem clearfix uif-hasError' and @data-label='Field 5']"); 074 fireMouseOverEventByName("field5"); 075 waitForTextPresent("For State 4, Must be at most 15 characters"); 076 } 077 078 @Test 079 public void testStateBasedValidationClientCustomizedTestsBookmark() throws Exception { 080 testStateBasedValidationClientCustomizedTests(); 081 passed(); 082 } 083 084 @Test 085 public void testStateBasedValidationClientCustomizedTestsNav() throws Exception { 086 testStateBasedValidationClientCustomizedTests(); 087 passed(); 088 } 089 090}