View Javadoc
1   package edu.samplu.admin.test;
2   
3   import org.junit.Test;
4   import org.openqa.selenium.By;
5   
6   import java.util.HashMap;
7   import java.util.Map;
8   
9   import static com.thoughtworks.selenium.SeleneseTestBase.assertTrue;
10  
11  /**
12   * @author Kuali Rice Team (rice.collab@kuali.org)
13   */
14  public class DocumentSearchURLParametersIT_testBasicSearchFieldsAndExecuteSearch extends DocumentSearchURLParametersITBase {
15      @Test
16      public void testBasicSearchFieldsAndExecuteSearch() throws InterruptedException {
17          // criteria.initiator=delyea&criteria.docTypeFullName=" + documentTypeName +
18          Map<String, String> fields = new HashMap<String, String>();
19          fields.putAll(BASIC_FIELDS);
20          fields.put("methodToCall", "search");
21          driver.get(getDocSearchURL(fields));
22  
23          assertInputValues(BASIC_FIELDS);
24  
25          // verify that it attempted the search
26          assertTrue(driver.getPageSource().contains("No values match this search"));
27  
28          driver.findElement(By.id("toggleAdvancedSearch")).click();
29  
30          Map<String, String> expected = new HashMap<String, String>(BASIC_FIELDS);
31          for (Map.Entry<String, String> entry: ADVANCED_FIELDS.entrySet()) {
32              if (!"isAdvancedSearch".equals(entry.getKey())) {
33                  expected.put(entry.getKey(), "");
34              } else {
35                  expected.put(entry.getKey(), entry.getValue());
36              }
37          }
38          assertInputValues(expected);
39  
40          // I guess switching modes doesn't re-execute the search
41          // assertTrue(driver.getPageSource().contains("No values match this search"));
42      }
43  }