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 org.kuali.rice.krad.demo.uif.library.collections;
017
018 import org.junit.Test;
019
020 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
021
022 /**
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025 public class DemoCollectionFeaturesAddLineAft extends WebDriverLegacyITBase {
026
027 /**
028 * /kr-krad/kradsampleapp?viewId=Demo-CollectionAddLineView
029 */
030 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-CollectionAddLineView";
031
032 @Override
033 protected String getBookmarkUrl() {
034 return BOOKMARK_URL;
035 }
036
037 @Override
038 protected void navigate() throws Exception {
039 waitAndClickById("Demo-LibraryLink", "");
040 waitAndClickByLinkText("Collection Features");
041 waitAndClickByLinkText("Add Line");
042 }
043
044 protected void testCollectionFeaturesDefaultAddLine() throws Exception {
045 selectByName("exampleShown","Collection Default Add Line");
046 waitAndTypeByXpath("//section[@id='Demo-CollectionAddLine-Example1']/section/div/div/table/tbody/tr[1]/td[2]/div/input","12");
047 waitAndTypeByXpath("//section[@id='Demo-CollectionAddLine-Example1']/section/div/div/table/tbody/tr[1]/td[3]/div/input","5");
048 waitAndClickButtonByText("add");
049 assertElementPresentByXpath("//input[@name='collection1[0].field1' and @value='12']");
050 assertElementPresentByXpath("//input[@name='collection1[0].field2' and @value='5']");
051 }
052
053 protected void testCollectionFeaturesDefaultAddViaLightbox() throws Exception {
054 selectByName("exampleShown","Collection Add Via Lightbox");
055 waitAndClickButtonByText("Add Line");
056 waitAndTypeByXpath("//form[@id='kualiLightboxForm']/section/table/tbody/tr/td/div/input","");
057 waitAndTypeByXpath("//form[@id='kualiLightboxForm']/section/table/tbody/tr[2]/td/div/input","");
058 fireMouseOverEventByXpath("//form[@id='kualiLightboxForm']/section/table/tbody/tr/td/div/input");
059 waitForElementPresent("//div[@class='jquerybubblepopup jquerybubblepopup-kr-error-cs' and @style='margin: 0px 0px 0px 72.16666662693024px; opacity: 1; top: 61px; left: 834px; position: absolute; display: block;']");
060 waitAndTypeByXpath("//form[@id='kualiLightboxForm']/section/table/tbody/tr/td/div/input","12");
061 waitAndTypeByXpath("//form[@id='kualiLightboxForm']/section/table/tbody/tr[2]/td/div/input","5");
062 waitAndClickByXpath("//form[@id='kualiLightboxForm']/section/div/button");
063 waitForElementPresentByXpath("//input[@name='collection1_2[0].field1' and @value='12']");
064 waitForElementPresentByXpath("//input[@name='collection1_2[0].field2' and @value='5']");
065 }
066
067 protected void testCollectionFeaturesDefaultAddBlankLine() throws Exception {
068 selectByName("exampleShown","Collection Add Blank Line");
069 waitAndClickByXpath("//section[@id='Demo-CollectionAddLine-Example3']/section/div/button");
070 assertElementPresentByXpath("//input[@name='collection1_4[0].field1' and @value]");
071 assertElementPresentByXpath("//input[@name='collection1_4[0].field2' and @value]");
072 }
073
074 @Test
075 public void testCollectionFeaturesAddLineBookmark() throws Exception {
076 testCollectionFeaturesDefaultAddLine();
077 testCollectionFeaturesDefaultAddBlankLine();
078 testCollectionFeaturesDefaultAddViaLightbox();
079 passed();
080 }
081
082 @Test
083 public void testCollectionFeaturesAddLineNav() throws Exception {
084 testCollectionFeaturesDefaultAddLine();
085 testCollectionFeaturesDefaultAddBlankLine();
086 testCollectionFeaturesDefaultAddViaLightbox();
087 passed();
088 }
089 }