View Javadoc

1   /**
2    * Copyright 2005-2012 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  import org.openqa.selenium.internal.seleniumemulation.IsElementPresent;
22  
23  import edu.samplu.common.ITUtil;
24  import edu.samplu.common.WebDriverLegacyITBase;
25  
26  public class MultipleLoginLogoutLegacyIT extends WebDriverLegacyITBase {
27      @Override
28      public String getTestUrl() {
29          return ITUtil.PORTAL;
30      }
31      @Override
32      public String getUserName() {
33          return "admin";
34      }
35      @Test
36      public void testMultipleLoginLogout() throws Exception {
37          waitAndClickByLinkText("Main Menu");
38          waitForPageToLoad();
39          assertEquals("Logged in User: admin",getTextByXpath("//div[@id='login-info']/strong[1]"));
40          assertEquals(Boolean.FALSE, isElementPresentByXpath("//div[@id='login-info']/strong[2]"));
41          waitAndTypeByName("backdoorId", "employee");
42          waitAndClickByXpath("//input[@value='Login']");
43          waitForPageToLoad();
44          assertElementPresentByXpath("//div[@id='login-info']/strong[2]");
45          assertEquals("  Impersonating User: employee",getTextByXpath("//div[@id='login-info']/strong[2]"));
46          waitAndClickByXpath("//input[@name='imageField' and @value='Logout']");
47          assertEquals(Boolean.FALSE, isElementPresentByXpath("//div[@id='login-info']/strong[2]"));
48          waitAndClickByXpath("//input[@name='imageField' and @value='Logout']");
49          passed();
50      }
51  }