001    package edu.samplu.admin.test;
002    
003    import org.junit.Test;
004    import org.openqa.selenium.By;
005    
006    import java.util.HashMap;
007    import java.util.Map;
008    
009    import static com.thoughtworks.selenium.SeleneseTestBase.assertTrue;
010    
011    /**
012     * @author Kuali Rice Team (rice.collab@kuali.org)
013     */
014    public class DocumentSearchURLParametersIT_testBasicSearchFieldsAndExecuteSearch extends DocumentSearchURLParametersITBase {
015        @Test
016        public void testBasicSearchFieldsAndExecuteSearch() throws InterruptedException {
017            // criteria.initiator=delyea&criteria.docTypeFullName=" + documentTypeName +
018            Map<String, String> fields = new HashMap<String, String>();
019            fields.putAll(BASIC_FIELDS);
020            fields.put("methodToCall", "search");
021            driver.get(getDocSearchURL(fields));
022    
023            assertInputValues(BASIC_FIELDS);
024    
025            // verify that it attempted the search
026            assertTrue(driver.getPageSource().contains("No values match this search"));
027    
028            driver.findElement(By.id("toggleAdvancedSearch")).click();
029    
030            Map<String, String> expected = new HashMap<String, String>(BASIC_FIELDS);
031            for (Map.Entry<String, String> entry: ADVANCED_FIELDS.entrySet()) {
032                if (!"isAdvancedSearch".equals(entry.getKey())) {
033                    expected.put(entry.getKey(), "");
034                } else {
035                    expected.put(entry.getKey(), entry.getValue());
036                }
037            }
038            assertInputValues(expected);
039    
040            // I guess switching modes doesn't re-execute the search
041            // assertTrue(driver.getPageSource().contains("No values match this search"));
042        }
043    }