1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.mainmenu.test;
17
18 import static org.junit.Assert.*;
19
20 import org.junit.Test;
21
22 import edu.samplu.common.ITUtil;
23 import edu.samplu.common.WebDriverLegacyITBase;
24
25 public class MultipleLoginLogoutNavIT extends WebDriverLegacyITBase {
26
27
28
29
30 public static final String LOGIN_INFO_STRONG_2_XPATH = "//div[@id='login-info']/strong[2]";
31
32 @Override
33 public String getTestUrl() {
34 return ITUtil.PORTAL;
35 }
36 @Override
37 public String getUserName() {
38 return "admin";
39 }
40 @Test
41 public void testMultipleLoginLogout() throws Exception {
42 waitAndClickMainMenu(this);
43 waitForPageToLoad();
44 assertEquals("Logged in User: admin",getTextByXpath("//div[@id='login-info']/strong[1]"));
45 assertEquals(Boolean.FALSE, isElementPresentByXpath(LOGIN_INFO_STRONG_2_XPATH));
46 waitAndTypeByName("backdoorId", "employee");
47 waitAndClickByXpath("//input[@value='Login']");
48 waitForPageToLoad();
49 assertElementPresentByXpath(LOGIN_INFO_STRONG_2_XPATH);
50 assertEquals(" Impersonating User: employee",getTextByXpath(LOGIN_INFO_STRONG_2_XPATH));
51 waitAndClickLogout();
52 assertEquals(Boolean.FALSE, isElementPresentByXpath(LOGIN_INFO_STRONG_2_XPATH));
53 waitAndClickLogout();
54 passed();
55 }
56 }