001    /**
002     * Copyright 2005-2012 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.common;
017    
018    import org.junit.Test;
019    import org.openqa.selenium.By;
020    
021    import static org.junit.Assert.assertEquals;
022    
023    /**
024     * blanket approving a new document, results in a final document
025     *
026     * @author Kuali Rice Team (rice.collab@kuali.org)
027     * @deprecated
028     */
029    public abstract class AdminMenuBlanketAppLegacyITBase extends MenuLegacyITBase{
030    
031        /**
032         * blanket approve document, returning docId as a String
033         * @return docId
034         */
035        public abstract String blanketApprove() throws Exception;
036    
037        @Override
038        protected String getMenuLinkLocator() {
039            return AdminMenuLegacyITBase.ADMIN_LOCATOR;
040        }
041    
042        @Override
043        protected String getCreateNewLinkLocator() {
044            return AdminMenuLegacyITBase.CREATE_NEW_LOCATOR;
045        }
046    
047        @Test
048        public void testBlanketApprove() throws Exception {
049            gotoCreateNew();
050            String docId = blanketApprove();
051            blanketApproveTest();
052            assertDocFinal(docId);
053            passed();
054        }
055    
056        protected void assertBlanketApproveButtonsPresent() {
057            assertElementPresentByName("methodToCall.route");
058            assertElementPresentByName("methodToCall.save");
059            assertElementPresentByName("methodToCall.blanketApprove", "Blanket Approve botton not present does " + user + " have permssion?");
060            assertElementPresentByName("methodToCall.close");
061            assertElementPresentByName("methodToCall.cancel");
062        }
063    
064        protected void assertDocFinal(String docId) throws InterruptedException {
065            waitFor(By.linkText("spreadsheet"));
066            if(isElementPresent(By.linkText(docId))){
067                assertEquals("FINAL", getDocStatus());
068            }else{
069                assertEquals(docId, driver.findElement(By.xpath("//table[@id='row']/tbody/tr[1]/td[1]")));
070                assertEquals("FINAL", getDocStatus());
071            }
072        }
073    
074        private String getDocStatus() {
075            return driver.findElement(By.xpath("//table[@id='row']/tbody/tr[1]/td[4]")).getText();
076        }
077    }