Form Search
-tests form search display, with a simple $foo$ search
-tests toggle between 'show as text' and 'show template'
-tests the $foo={bar,baz,bat}$ replacement to generate select pulldowns
-tests submitting from form search
-tests saving a form search, and then running it from the saved searches menu
-TODO - testing replacement in multiple locations, multiple clauses, subsearches, inside quoted strings.
setTimeout 120000
openAndWait / (open the main interface)
waitForDispatchCompleted 10000
comment Change to searching all time
select timelineValues value=ALL_TIME
pause 200
comment Type search string and click submit
type entry $foo$ source="*apache.error.log"
click entrySubmit (Click submit button)
comment TODO - hitting enter doesnt actually submit... But we should fix this cause it's lame.
comment Verify that it picks up the link to go into 'form search' mode.
verifyText templateSearchToggleOn Show as form »
waitForDispatchCompleted 10000
comment switch into form search mode
click templateSearchToggleOn
comment verify the field shows up
verifyElementPresent templateField0
comment verify the field label is 'foo'
verifyElementPresent //div[@id='templateSearchContainer']//label[@class='label' and .='foo']
comment Check that the 'show as text' toggle now is visible.
verifyVisible //div[@id='templateSearchContainer']//a[.='show as text']
comment enter a value for our 'foo' text field.
type templateField0 unclean shutdown
comment Submit the form
click entrySubmit (Click submit button)
waitForDispatchCompleted 60000
comment Verify right results.
verifyText eventCount 3 results
comment click the 'show as text' toggle
click //div[@id='templateSearchContainer']//a[.='show as text']
comment entry field should be visible now
verifyVisible entry
comment and should have the serialized valueof the form search
verifyValue entry $foo$ source="*apache.error.log"
comment TODO - right now the converse 'show as form' link is invisible. Maybe this was intentional though?
comment -------------------------
comment Verify the auto-generated pulldown case.
type entry $user=latrina,reba,bicycle$ source="*apache.error.log"
comment Submit the form
click entrySubmit (Click submit button)
waitForDispatchCompleted 60000
comment switch into form search mode
click templateSearchToggleOn
comment verify the field shows up
verifyElementPresent templateField0
verifyElementPresent //select[@id='templateField0']
comment Check that the options of the menu are right.
verifyText //select[@id='templateField0']/option[1] latrina
verifyText //select[@id='templateField0']/option[2] reba
verifyText //select[@id='templateField0']/option[3] bicycle
comment Verify that latrina is selected by default
verifySelected //select[@id='templateField0'] latrina
comment Submit the form
click entrySubmit (Click submit button)
waitForDispatchCompleted 60000
comment Verify that we get latrina results back.
verifySelected //select[@id='templateField0'] latrina
verifyText eventCount 260 results
comment Change the value in the pulldown
select //select[@id='templateField0'] reba
comment Submit the form
click entrySubmit (Click submit button)
waitForDispatchCompleted 60000
comment Verify that we get reba results back.
verifySelected //select[@id='templateField0'] reba
verifyText eventCount 266 results
comment -------------------------
click //div[@id='templateSearchContainer']//a[.='show as text']
comment verify form search with two fields, and typeahead for free-text fields.
type entry source="*access.combined.log" table=xar_$xaraya table$ bytes>$minBytes=1000,2000,5000,10000$
comment Submit the form
click entrySubmit (Click submit button)
waitForDispatchCompleted 60000
comment Switch back to the Form mode
click templateSearchToggleOn
type templateField0 a
keyDown templateField0 114
keyPress templateField0 114
keyUp templateField0 114
pause 5000
comment Verify that the prefixed table=xar_$xaraya table$ entry gets free text typeahead.
verifyVisible //div[@class='typeAhead']
verifyText //div[@class='typeAhead']/label[1] *"articles"
comment Click the first typeahead result..
type templateField0 articles
comment Submit the form
click entrySubmit (Click submit button)
pause 1000
waitForDispatchCompleted 60000
comment FIXME - have to submit twice
click entrySubmit (Click submit button)
pause 1000
waitForDispatchCompleted 60000
comment Verify right results.
verifyText eventCount 4 results
comment Change to just minBytes=10000 in our pulldown.
select //select[@id='templateField1'] 10000
comment change the xaraya table to a wildcard search
type templateField0 categories*
click entrySubmit (Click submit button)
waitForDispatchCompleted 60000
comment Verify right results.
verifyText eventCount 5 results
comment -------------------------
comment Verify saving this template search
click //div[@id='templateSearchContainer']//a[.='show as text']
comment Open the save search popup
click menuBug
waitForElementPresent splunksMenu 5000
click saveThisSplunk
waitForElementPresent adminPopupLayer 5000
pause 1000
comment give it a name
type //div[@id='adminPopupLayer']//input[@name='name'] form search test
comment Submit the form
click //div[@id='adminPopupLayer']//input[@type='submit' and @value='Save']
pause 5000
comment Verify status message appears
verifyText //div[@id='msgNotificationContainer']//td[@class='INFO'] Saved search form search test was updated.
comment Check it loaded
comment verify it went into the 'saved searches' menu
click menuBug
waitForElementPresent splunksMenu 5000
click savedSplunksMenu
waitForElementPresent //label[@id='savedSplunksMenu']//label[.='form search test'] 5000
comment Click on it to run it again.
click //label[@id='savedSplunksMenu']//label[.='form search test']
waitForDispatchCompleted 30000
verifyVisible templateField0
verifyVisible templateField1
verifyVisible //div[@id='templateSearchContainer']//label[@class='label' and .='xaraya table']
verifyVisible //div[@id='templateSearchContainer']//label[@class='label' and .='minBytes']
comment CLEANUP.
click menuBug
waitForElementPresent splunksMenu 500
click savedSplunksMenu
waitForElementPresent savedSplunksMenu 500
clickAndWait //label[.='Manage saved searches'] Click 'Manage saved searches'
selectWindow queryFetcher (hereafter, all selenium commands will act within the context of this iframe)
check //td[.='form search test']/preceding-sibling::td/input[@type='checkbox'] Check the box for that saved search.
clickAndWait //a[.='delete'] Click the delete link
assertConfirmation Are you sure you want to delete the selected searches?
selectWindow