View Javadoc

1   package org.itracker.selenium;
2   
3   import java.io.IOException;
4   
5   import org.junit.Test;
6   
7   /**
8    * Check the content and the functionality of "Projects List" page.
9    *
10   * @author Andrey Sergievskiy <seas@andreysergievskiy.com>
11   */
12  public class ViewProjectListTest extends AbstractSeleniumTestCase {
13      /**
14       * 0. Exit all available http sessions.
15       * 1. Login into the system with particular login (admin_test1).
16       * 2. Check that "Project List" link is present at the "Portal Home" page.
17       * 3. Click "Project List".
18       * 4. Check that "Projects" element is present at the "Project List" page.
19       * 5. Check that there are two projects in a table at the page.
20       * 6. Check that "test_name" project contains 4 open, 0 resolved
21       * and 4 issues total.
22       * 7. Check that "test_name2" project contains no issues at all.
23       *
24       * @throws java.io.IOException
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          //// project "test_name"
49          // Check the number of open issues.
50          assertTextEquals("4", "//tr[starts-with(@id, 'project.')]/td[3][text()='test_name']/../td[4]");
51  
52          // Check the number of resolved issues.
53          assertTextEquals("0", "//tr[starts-with(@id, 'project.')]/td[3][text()='test_name']/../td[5]");
54  
55          // Check total number of issues.
56          assertTextEquals("4", "//tr[starts-with(@id, 'project.')]/td[3][text()='test_name']/../td[6]");
57  
58          //// project "test_name2"
59          // Check the number of open issues.
60          assertTextEquals("0", "//tr[starts-with(@id, 'project.')]/td[3][text()='test_name2']/../td[4]");
61  
62          // Check the number of resolved issues.
63          assertTextEquals("0", "//tr[starts-with(@id, 'project.')]/td[3][text()='test_name2']/../td[5]");
64  
65          // Check total number of issues.
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  }