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.travel.account;
017
018import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
019import org.apache.commons.lang.RandomStringUtils;
020import org.junit.Test;
021
022/**
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025public class DemoTravelAccountMaintenanceNewExpandCollapseAft extends WebDriverLegacyITBase {
026
027    /**
028     * /kr-krad/maintenance?methodToCall=start&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount&hideReturnLink=true
029     */
030    public static final String BOOKMARK_URL = "/kr-krad/maintenance?methodToCall=start&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount&hideReturnLink=true";
031
032    @Override
033    public String getBookmarkUrl() {
034        return BOOKMARK_URL;
035    }
036
037    protected void navigate() throws Exception {
038        waitAndClickDemoLink();
039        waitAndClickByLinkText("Travel Account Maintenance (New)");
040    }
041
042    protected void testTravelAccountMaintenanceNewExpandCollapse() throws Exception {
043        waitAndClickByXpath("//a/span[contains(text(),'Document Overview')]");
044        waitAndClickByXpath("//a/span[contains(text(),'Account Information')]");
045        waitAndClickByXpath("//a/span[contains(text(),'Sub Accounts')]");
046        waitAndClickButtonByExactText("Submit");
047        waitForElementPresentByXpath("//div[@style='overflow: hidden; display: block;']/div/ul/li/a[contains(text(),'Description: Required')]");
048        waitForElementPresentByXpath("//div[@style='overflow: hidden; display: block;']/div/ul/li/a[contains(text(),'Travel Account Number: Required')]");
049        waitForElementPresentByXpath("//div[@style='overflow: hidden; display: block;']/div/ul/li/a[contains(text(),'Travel Account Name: Required')]");
050        waitForElementPresentByXpath("//div[@style='overflow: hidden; display: block;']/div/ul/li/a[contains(text(),'Travel Account Type Code: Required')]");
051    }
052    
053    protected void testTravelAccountMaintenanceNewExpandCollapse1() throws Exception {
054         waitAndTypeByName("document.documentHeader.documentDescription","Travel Account Maintenance New Test Document");
055         String randomCode = RandomStringUtils.randomAlphabetic(9).toUpperCase();
056         waitAndTypeByName("document.newMaintainableObject.dataObject.number",randomCode);
057         waitAndTypeByName("document.newMaintainableObject.dataObject.name",randomCode);
058         waitAndClickByName("document.newMaintainableObject.dataObject.accountTypeCode");
059        waitForElementPresentByXpath("//section[@class='uif-disclosure tableborders wrap uif-boxLayoutVerticalItem clearfix']/div[@style='display: none; overflow: hidden;']");
060        waitAndClickByXpath("//section[@class='uif-disclosure tableborders wrap uif-boxLayoutVerticalItem clearfix']/header/h3/a");
061        waitForElementPresentByXpath("//section[@class='uif-disclosure tableborders wrap uif-boxLayoutVerticalItem clearfix']/div[@style='display: block; overflow: hidden;']");
062        waitAndClickButtonByExactText("Submit");
063        waitAndClickConfirmSubmitOk();
064        waitForElementPresentByXpath("//section[@class='uif-disclosure tableborders wrap uif-boxLayoutVerticalItem clearfix']/header/h3/a[@data-open='true']");
065    }
066
067    @Test
068    public void testDemoTravelAccountMaintenanceNewExpandCollapseBookmark() throws Exception {
069        testTravelAccountMaintenanceNewExpandCollapse();
070        passed();
071    }
072
073    @Test
074    public void testDemoTravelAccountMaintenanceNewExpandCollapseNav() throws Exception {
075        testTravelAccountMaintenanceNewExpandCollapse();
076        passed();
077    }
078    
079    @Test
080    public void testDemoTravelAccountMaintenanceNewExpandCollapse1Bookmark() throws Exception {
081        testTravelAccountMaintenanceNewExpandCollapse1();
082        passed();
083    }
084
085    @Test
086    public void testDemoTravelAccountMaintenanceNewExpandCollapse1Nav() throws Exception {
087        testTravelAccountMaintenanceNewExpandCollapse1();
088        passed();
089    }
090}