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 */
016package edu.samplu.krad.labs.clientside.stateview;
017
018import org.junit.Test;
019import org.junit.Assert;
020import edu.samplu.common.SmokeTestBase;
021
022/**
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025public class ClientSideStateViewSmokeTest extends SmokeTestBase {
026
027    /**
028     * /kr-krad/labs?viewId=Lab-ClientSideState&formKey=ff000d97-13e9-4130-81a3-bc0217e8e0eb&
029     * cacheKey=otutyty24mo0f76n59ebqxvtpg&pageId=Lab-ClientSideState-Page1
030     */
031    public static final String BOOKMARK_URL = "/kr-krad/labs?viewId=Lab-ClientSideState&formKey=ff000d97-13e9-4130-81a3-bc0217e8e0eb&cacheKey=otutyty24mo0f76n59ebqxvtpg&pageId=Lab-ClientSideState-Page1";
032
033    /**
034     * inactivatableCollection[0].active
035     */
036    private static final String ACTIVE_COMPONENT_NAME = "inactivatableCollection[0].active";
037
038    /**
039     * inactivatableCollection[0].active
040     */
041    private static final String ACTIVE_COMPONENT2_NAME = "inactivatableCollection2[0].active";
042    
043    /**
044     * //div[4]/div[2]/button
045     */
046    private static final String AJAX_BUTTON_XPATH = "//div[4]/div[2]/button";
047    
048    /**
049     * //div[4]/div[2]/button[2]
050     */
051    private static final String SUBMIT_BUTTON_XPATH = "//div[4]/div[2]/button[2]";
052
053    /**
054     * This overridden method ...
055     * 
056     * @see edu.samplu.common.SmokeTestBase#navigate()
057     */
058    @Override
059    protected void navigate() throws Exception {
060        // TODO deep - THIS METHOD NEEDS JAVADOCS
061        //Navigation is not defined for this functionality so we only do have URL in this Smoke Test.
062    }
063
064    @Override
065    protected String getBookmarkUrl() {
066        return BOOKMARK_URL;
067    }
068
069    @Test
070    public void testClientSideStateViewBookmark() throws Exception {
071        testClientSideStateView();
072    }
073
074    public void testClientSideStateView() throws Exception
075    {
076        selectFrameIframePortlet();
077        waitAndClickByName(ACTIVE_COMPONENT_NAME);
078        waitAndClickByName(ACTIVE_COMPONENT2_NAME);
079        waitAndClickByXpath(AJAX_BUTTON_XPATH);
080        Thread.sleep(5000);
081        Assert.assertFalse(isElementPresentByName(ACTIVE_COMPONENT_NAME));
082        Assert.assertFalse(isElementPresentByName(ACTIVE_COMPONENT2_NAME));
083        waitAndClickByXpath(SUBMIT_BUTTON_XPATH);
084        Thread.sleep(5000);
085        Assert.assertFalse(isElementPresentByName(ACTIVE_COMPONENT_NAME));
086        Assert.assertFalse(isElementPresentByName(ACTIVE_COMPONENT2_NAME));
087    }
088}