View Javadoc

1   /**
2    * Copyright 2005-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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       * "//div[@id='login-info']/strong[2]"
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  }