1 package org.itracker.selenium;
2
3 import java.io.IOException;
4
5 import org.junit.Test;
6
7
8
9
10
11
12 public class ViewProjectListTest extends AbstractSeleniumTestCase {
13
14
15
16
17
18
19
20
21
22
23
24
25
26 @Test
27 public void testViewProjectList() throws IOException {
28 closeSession();
29 selenium.open("http://" + applicationHost + ":" + applicationPort + "/"
30 + applicationPath);
31
32 assertElementPresent("//.[@name='login']");
33 assertElementPresent("//.[@name='password']");
34 assertElementPresent("//.[@value='Login']");
35 selenium.type("//.[@name='login']", "admin_test1");
36 selenium.type("//.[@name='password']", "admin_test1");
37 selenium.click("//.[@value='Login']");
38 selenium.waitForPageToLoad(SE_TIMEOUT);
39
40 assertElementPresent("listprojects");
41 selenium.click("listprojects");
42 selenium.waitForPageToLoad(SE_TIMEOUT);
43
44 assertElementPresent("projects");
45 assertEquals("projects count", 2,
46 selenium.getXpathCount("//tr[starts-with(@id, 'project.')]"));
47
48
49
50 assertTextEquals("4", "//tr[starts-with(@id, 'project.')]/td[3][text()='test_name']/../td[4]");
51
52
53 assertTextEquals("0", "//tr[starts-with(@id, 'project.')]/td[3][text()='test_name']/../td[5]");
54
55
56 assertTextEquals("4", "//tr[starts-with(@id, 'project.')]/td[3][text()='test_name']/../td[6]");
57
58
59
60 assertTextEquals("0", "//tr[starts-with(@id, 'project.')]/td[3][text()='test_name2']/../td[4]");
61
62
63 assertTextEquals("0", "//tr[starts-with(@id, 'project.')]/td[3][text()='test_name2']/../td[5]");
64
65
66 assertTextEquals("0", "//tr[starts-with(@id, 'project.')]/td[3][text()='test_name2']/../td[6]");
67 }
68
69 @Override
70 protected String[] getDataSetFiles() {
71 return new String[]{
72 "dataset/languagebean_init_dataset.xml",
73 "dataset/languagebean_dataset.xml",
74 "dataset/userpreferencesbean_dataset.xml",
75 "dataset/userbean_dataset.xml",
76 "dataset/projectbean_dataset.xml",
77 "dataset/permissionbean_dataset.xml",
78 "dataset/versionbean_dataset.xml",
79 "dataset/issuebean_dataset.xml"
80 };
81 }
82
83 @Override
84 protected String[] getConfigLocations() {
85 return new String[]{"application-context.xml"};
86 }
87 }