1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu;
17
18 import static org.junit.Assert.*;
19
20 import edu.samplu.common.SmokeTestBase;
21 import org.junit.Assert;
22 import org.junit.Test;
23
24 import edu.samplu.common.ITUtil;
25
26 public class LoginLogoutMultipleSmokeTest extends SmokeTestBase {
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 protected String getBookmarkUrl() {
40 return ITUtil.PORTAL;
41 }
42
43 @Override
44 protected void navigate() throws Exception {
45 waitAndClickMainMenu(this);
46 waitForPageToLoad();
47 }
48
49 @Override
50 public String getTestUrl() {
51 return ITUtil.PORTAL;
52 }
53
54 @Override
55 public String getUserName() {
56 return "admin";
57 }
58
59 @Test
60 public void testMultipleLoginLogoutNav() throws Exception {
61 testMultipleLoginLogout();
62 passed();
63 }
64
65 public void testMultipleLoginLogout() throws Exception {
66 assertEquals("Logged in User: admin",getTextByXpath("//div[@id='login-info']/strong[1]"));
67 assertEquals(Boolean.FALSE, isElementPresentByXpath(LOGIN_INFO_STRONG_2_XPATH));
68 waitAndTypeByName("backdoorId", "employee");
69 waitAndClickByXpath("//input[@value='Login']");
70 waitForPageToLoad();
71 assertElementPresentByXpath(LOGIN_INFO_STRONG_2_XPATH);
72 assertEquals(" Impersonating User: employee",getTextByXpath(LOGIN_INFO_STRONG_2_XPATH));
73 waitAndClickLogout();
74 assertEquals(Boolean.FALSE, isElementPresentByXpath(LOGIN_INFO_STRONG_2_XPATH));
75 waitAndClickLogout();
76 passed();
77 }
78 }