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.Assert;
21 import org.junit.Test;
22
23 import edu.samplu.common.ITUtil;
24 import edu.samplu.common.WebDriverLegacyITBase;
25
26 public class MultipleLoginLogoutNavIT extends WebDriverLegacyITBase {
27
28
29
30
31 public static final String LOGIN_INFO_STRONG_2_XPATH = "//div[@id='login-info']/strong[2]";
32
33 @Override
34 public void fail(String message) {
35 Assert.fail(message);
36 }
37
38 @Override
39 public String getTestUrl() {
40 return ITUtil.PORTAL;
41 }
42
43 @Override
44 public String getUserName() {
45 return "admin";
46 }
47
48 @Test
49 public void testMultipleLoginLogout() throws Exception {
50 waitAndClickMainMenu(this);
51 waitForPageToLoad();
52 assertEquals("Logged in User: admin",getTextByXpath("//div[@id='login-info']/strong[1]"));
53 assertEquals(Boolean.FALSE, isElementPresentByXpath(LOGIN_INFO_STRONG_2_XPATH));
54 waitAndTypeByName("backdoorId", "employee");
55 waitAndClickByXpath("//input[@value='Login']");
56 waitForPageToLoad();
57 assertElementPresentByXpath(LOGIN_INFO_STRONG_2_XPATH);
58 assertEquals(" Impersonating User: employee",getTextByXpath(LOGIN_INFO_STRONG_2_XPATH));
59 waitAndClickLogout();
60 assertEquals(Boolean.FALSE, isElementPresentByXpath(LOGIN_INFO_STRONG_2_XPATH));
61 waitAndClickLogout();
62 passed();
63 }
64 }