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.mainmenu.test;
017
018 import static org.junit.Assert.*;
019
020 import org.junit.Assert;
021 import org.junit.Test;
022
023 import edu.samplu.common.ITUtil;
024 import edu.samplu.common.WebDriverLegacyITBase;
025
026 public class MultipleLoginLogoutNavIT extends WebDriverLegacyITBase {
027
028 /**
029 * "//div[@id='login-info']/strong[2]"
030 */
031 public static final String LOGIN_INFO_STRONG_2_XPATH = "//div[@id='login-info']/strong[2]";
032
033 @Override
034 public void fail(String message) {
035 Assert.fail(message);
036 }
037
038 @Override
039 public String getTestUrl() {
040 return ITUtil.PORTAL;
041 }
042
043 @Override
044 public String getUserName() {
045 return "admin";
046 }
047
048 @Test
049 public void testMultipleLoginLogout() throws Exception {
050 waitAndClickMainMenu(this);
051 waitForPageToLoad();
052 assertEquals("Logged in User: admin",getTextByXpath("//div[@id='login-info']/strong[1]"));
053 assertEquals(Boolean.FALSE, isElementPresentByXpath(LOGIN_INFO_STRONG_2_XPATH));
054 waitAndTypeByName("backdoorId", "employee");
055 waitAndClickByXpath("//input[@value='Login']");
056 waitForPageToLoad();
057 assertElementPresentByXpath(LOGIN_INFO_STRONG_2_XPATH);
058 assertEquals(" Impersonating User: employee",getTextByXpath(LOGIN_INFO_STRONG_2_XPATH));
059 waitAndClickLogout();
060 assertEquals(Boolean.FALSE, isElementPresentByXpath(LOGIN_INFO_STRONG_2_XPATH));
061 waitAndClickLogout();
062 passed();
063 }
064 }