1 package org.itracker.selenium;
2
3 import org.junit.Test;
4 import org.openqa.selenium.By;
5
6 import java.io.IOException;
7 import static org.itracker.Assert.*;
8
9
10
11
12
13
14
15 public class LogoutSeleniumIT extends AbstractSeleniumTestCase {
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 @Test
33 public void testLoginAndLogout() throws IOException {
34 closeSession();
35 driver.get("http://" + applicationHost + ":" + applicationPort + "/"
36 + applicationPath + "/portalhome.do");
37
38 assertElementNotPresent(By.name("id"));
39 assertElementPresent(By.name("login")).sendKeys("user_test1");
40
41 assertElementPresent(By.name("password")).sendKeys("user_test1");
42 assertElementPresent(By.id("btn-login")).click();
43
44 waitForPageToLoad();
45
46 assertElementPresent(By.name("id"));
47 assertElementPresent(By.name("logoff")).click();
48 waitForPageToLoad();
49
50 assertElementNotPresent(By.name("id"));
51 assertElementPresent(By.name("login"));
52 assertElementPresent(By.name("password"));
53 driver.get("http://" + applicationHost + ":" + applicationPort + "/"
54 + applicationPath + "/portalhome.do");
55
56 assertElementNotPresent(By.name("id"));
57 assertElementPresent(By.name("login"));
58 assertElementPresent(By.name("password"));
59 }
60
61 @Override
62 protected String[] getDataSetFiles() {
63 return new String[]{
64 "dataset/languagebean_init_dataset.xml",
65 "dataset/languagebean_dataset.xml",
66 "dataset/userpreferencesbean_dataset.xml",
67 "dataset/userbean_dataset.xml"
68 };
69 }
70 }