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     */
016    package edu.samplu.krad.demo.travel.account.inquiry;
017    
018    import edu.samplu.common.Failable;
019    import edu.samplu.common.ITUtil;
020    import edu.samplu.common.WebDriverLegacyITBase;
021    
022    /**
023     * @author Kuali Rice Team (rice.collab@kuali.org)
024     */
025    public abstract class DemoTravelAccountInquirySmokeTestBase extends WebDriverLegacyITBase {
026    
027        /**
028         * //a[@title='Travel Account ']
029         */
030        public static final String ANCHOR_TITLE_TRAVEL_ACCOUNT = "//a[@title='Travel Account ']";
031    
032        /**
033         * /kr-krad/inquiry?methodToCall=start&number=a14&dataObjectClassName=org.kuali.rice.krad.demo.travel.account.TravelAccount
034         */
035        public static final String BOOKMARK_URL = "/kr-krad/inquiry?methodToCall=start&number=a14&dataObjectClassName=org.kuali.rice.krad.demo.travel.account.TravelAccount";
036    
037        /**
038         * Collapse All
039         */
040        public static final String COLLAPSE_ALL = "Collapse All";
041    
042        /**
043         * Expand All
044         */
045        public static final String EXPAND_ALL = "Expand All";
046    
047        @Override
048        public String getTestUrl() {
049            return ITUtil.KRAD_PORTAL;
050        }
051    
052        protected void navigation() throws Exception {
053            waitAndClickById("Demo-DemoLink", "");
054            waitAndClickByLinkText("Account Inquiry");
055        }
056    
057        protected void testInquiryBackButton() throws Exception {
058            waitAndClickButtonByText("Back");
059            waitForElementPresentByClassName("uif-headerText");
060            assertTextPresent("Demo - Travel Application");
061        }
062    
063        public void testInquiryBackButtonBookmark(Failable failable) throws Exception {
064            testInquiryBackButton();
065            passed();
066        }
067    
068        public void testInquiryBackButtonNav(Failable failable) throws Exception {
069            navigation();
070            testInquiryBackButton();
071            passed();
072        }
073    
074        protected void testCollapseExpand() throws InterruptedException {
075            assertTextPresent("Travel Account Number:");
076            assertTextPresent(EXPAND_ALL);
077            assertTextPresent(COLLAPSE_ALL);
078            assertIsVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, "");
079    
080            waitAndClickButtonByText(COLLAPSE_ALL);
081            assertIsNotVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, " after clicking " + COLLAPSE_ALL);
082    
083            waitAndClickButtonByText(EXPAND_ALL);
084            assertIsVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, " after clicking " + EXPAND_ALL);
085        }
086    
087        public void testInquiryCollapseExpandBookmark(Failable failable) throws Exception {
088            testCollapseExpand();
089            passed();
090        }
091    
092        public void testInquiryCollapseExpandNav(Failable failable) throws Exception {
093            navigation();
094            testCollapseExpand();
095            passed();
096        }
097    
098        protected void testInquiryLightBox() throws Exception {
099            waitAndClickByLinkText("a6");
100            assertIsVisibleByXpath(ANCHOR_TITLE_TRAVEL_ACCOUNT, "");
101        }
102    
103        public void testInquiryLightBoxBookmark(Failable failable) throws Exception {
104            testInquiryLightBox();
105            passed();
106        }
107    
108        public void testInquiryLightBoxNav(Failable failable) throws Exception {
109            navigation();
110            testInquiryLightBox();
111            passed();
112        }
113    }