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; 017 018import static org.junit.Assert.*; 019 020import edu.samplu.common.SmokeTestBase; 021import org.junit.Assert; 022import org.junit.Test; 023 024import edu.samplu.common.ITUtil; 025 026public class LoginLogoutMultipleSmokeTest extends SmokeTestBase { 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 protected String getBookmarkUrl() { 040 return ITUtil.PORTAL; 041 } 042 043 @Override 044 protected void navigate() throws Exception { 045 waitAndClickMainMenu(this); 046 waitForPageToLoad(); 047 } 048 049 @Override 050 public String getTestUrl() { 051 return ITUtil.PORTAL; 052 } 053 054 @Override 055 public String getUserName() { 056 return "admin"; 057 } 058 059 @Test 060 public void testMultipleLoginLogoutNav() throws Exception { 061 testMultipleLoginLogout(); 062 passed(); 063 } 064 065 public void testMultipleLoginLogout() throws Exception { 066 assertEquals("Logged in User: admin",getTextByXpath("//div[@id='login-info']/strong[1]")); 067 assertEquals(Boolean.FALSE, isElementPresentByXpath(LOGIN_INFO_STRONG_2_XPATH)); 068 waitAndTypeByName("backdoorId", "employee"); 069 waitAndClickByXpath("//input[@value='Login']"); 070 waitForPageToLoad(); 071 assertElementPresentByXpath(LOGIN_INFO_STRONG_2_XPATH); 072 assertEquals(" Impersonating User: employee",getTextByXpath(LOGIN_INFO_STRONG_2_XPATH)); 073 waitAndClickLogout(); 074 assertEquals(Boolean.FALSE, isElementPresentByXpath(LOGIN_INFO_STRONG_2_XPATH)); 075 waitAndClickLogout(); 076 passed(); 077 } 078}