001 /**
002 * Copyright 2005-2014 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.sampleu.krad.validationmessagesview;
017
018 import org.junit.Test;
019 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
020
021 /**
022 * Tests the Component section in Rice.
023 *
024 * @author Kuali Rice Team (rice.collab@kuali.org)
025 */
026 public class ServerSideTestViewAft extends WebDriverLegacyITBase {
027
028 /**
029 * "/kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&readOnlyFields=field91";
030 */
031 public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=Demo-ValidationServerSide&methodToCall=start";
032
033 @Override
034 protected String getBookmarkUrl() {
035 return BOOKMARK_URL;
036 }
037
038 protected void navigate() throws InterruptedException {
039 waitAndClickKRAD();
040 waitAndClickByLinkText("ServerSide Constraint Validation Demo");
041 switchToWindow("Kuali :: Validation Server-side Test View");
042 }
043
044 //Code for KRAD Test Package.
045 protected void testServerSideTestView() throws Exception {
046
047 //MinMax length and value and Required Constraint
048 waitAndTypeByName("field9","a");
049 waitAndTypeByName("field10","1");
050 waitAndClickByXpath("//button[@id='usave']");
051 Thread.sleep(4000);
052 assertTextPresent("MinMax Length test: Must be between 2 and 5 characters long");
053 assertTextPresent("MinMax Value test: Value must be greater than 2 and no more than 50");
054 assertTextPresent(new String[]{"Required constraint", "4 errors"});
055
056 //PreRequisite constraint
057 waitForElementPresentByXpath("//input[@name='field7' and @disabled]");
058 waitAndClickByXpath("//input[@type='checkbox' and @name='booleanField']");
059 if(isElementPresentByXpath("//input[@name='field7' and @disabled]")) {
060 fail("PreRequisite Constraint isn't working !");
061 }
062
063 //MustOccurs constraint
064 waitAndTypeByName("field14","a");
065 waitAndClickByXpath("//button[@id='usave']");
066 Thread.sleep(4000);
067
068 }
069
070 @Test
071 public void testServerSideTestViewBookmark() throws Exception {
072 testServerSideTestView();
073 passed();
074 }
075
076 @Test
077 public void testServerSideTestViewNav() throws Exception {
078 testServerSideTestView();
079 passed();
080 }
081 }