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 */
016package org.kuali.rice.krad.labs;
017
018import org.junit.Test;
019import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
020
021/**
022 * @author Kuali Rice Team (rice.collab@kuali.org)
023 */
024public class LabsDialogWithExplanationReadOnlyAft extends WebDriverLegacyITBase {
025
026    /**
027     * /kr-krad/labs?viewId=Lab-DialogReadOnly
028     */
029    public static final String BOOKMARK_URL = "/kr-krad/labs?viewId=Lab-DialogReadOnly";
030    
031    @Override
032    protected String getBookmarkUrl() {
033        return BOOKMARK_URL;
034    }
035
036    @Override
037    public String getUserName() {
038        return "guest";
039    }
040
041    @Override
042    protected void navigate() throws Exception {
043        waitAndClickByLinkText("Dialog with Explanation in ReadOnly mode");
044    }
045
046    protected void testDemoDialogWithExplanationReadOnly() throws InterruptedException {
047        waitAndClickByXpath("//button[@data-confirmdialogid='Lab-DialogEx']");
048        waitAndTypeByXpath("//div[@data-parent='Lab-DialogEx']/textarea","");
049        waitAndClickByXpath("//div[@data-parent='Lab-DialogEx']/button[contains(text(),'OK')]");
050        waitForElementPresentByXpath("//a[contains(text(),'Required')]");
051        waitAndTypeByXpath("//div[@data-parent='Lab-DialogEx']/textarea","a");
052        waitAndClickByXpath("//div[@data-parent='Lab-DialogEx']/button[contains(text(),'OK')]");
053        waitAndClickByXpath("//button[@data-confirmdialogid='Lab-DialogExReadOnly']");
054        waitAndTypeByXpath("//div[@data-parent='Lab-DialogExReadOnly']/textarea","");
055        waitAndClickByXpath("//div[@data-parent='Lab-DialogExReadOnly']/button[contains(text(),'OK')]");
056        waitForElementPresentByXpath("//a[contains(text(),'Required')]");
057        waitAndTypeByXpath("//div[@data-parent='Lab-DialogExReadOnly']/textarea","a");
058        waitAndClickByXpath("//div[@data-parent='Lab-DialogExReadOnly']/button[contains(text(),'OK')]");
059        //Read Only Explanation is also having textarea. This functionality is not working properly.
060    }
061
062    @Test
063    public void testDemoDialogWithExplanationReadOnlyBookmark() throws Exception {
064        testDemoDialogWithExplanationReadOnly();
065        passed();
066    }
067
068    @Test
069    public void testDemoDialogWithExplanationReadOnlyNav() throws Exception {
070        testDemoDialogWithExplanationReadOnly();
071        passed();
072    }
073}