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.mainmenu.test; 017 018 import static org.junit.Assert.*; 019 020 import org.junit.Test; 021 import org.openqa.selenium.internal.seleniumemulation.IsElementPresent; 022 023 import edu.samplu.common.ITUtil; 024 import edu.samplu.common.WebDriverLegacyITBase; 025 026 public class MultipleLoginLogoutLegacyIT extends WebDriverLegacyITBase { 027 @Override 028 public String getTestUrl() { 029 return ITUtil.PORTAL; 030 } 031 @Override 032 public String getUserName() { 033 return "admin"; 034 } 035 @Test 036 public void testMultipleLoginLogout() throws Exception { 037 waitAndClickByLinkText("Main Menu"); 038 waitForPageToLoad(); 039 assertEquals("Logged in User: admin",getTextByXpath("//div[@id='login-info']/strong[1]")); 040 assertEquals(Boolean.FALSE, isElementPresentByXpath("//div[@id='login-info']/strong[2]")); 041 waitAndTypeByName("backdoorId", "employee"); 042 waitAndClickByXpath("//input[@value='Login']"); 043 waitForPageToLoad(); 044 assertElementPresentByXpath("//div[@id='login-info']/strong[2]"); 045 assertEquals(" Impersonating User: employee",getTextByXpath("//div[@id='login-info']/strong[2]")); 046 waitAndClickByXpath("//input[@name='imageField' and @value='Logout']"); 047 assertEquals(Boolean.FALSE, isElementPresentByXpath("//div[@id='login-info']/strong[2]")); 048 waitAndClickByXpath("//input[@name='imageField' and @value='Logout']"); 049 passed(); 050 } 051 }