Skip to content
Browse files

Change selenium test to really simulate user behavior

The current selenium test only succeds because the search term
is directly entered into the URL. If the search term is entered into
the input field, searching fails.
  • Loading branch information...
1 parent 342afc9 commit 2010bbc3b908e5c98833bca06e94580a63705269 Gaudenz Steinlin committed Feb 6, 2012
Showing with 13 additions and 2 deletions.
  1. +13 −2 plone/app/search/tests/selenium/test_selenium.py
View
15 plone/app/search/tests/selenium/test_selenium.py
@@ -32,8 +32,19 @@ def test_basic_search(self):
self.assertEquals(res_num.text, '0')
self.assertEquals(res.text, 'No results were found.')
- # Now we want to get results with all elements in the site:
- open(sel, portal.absolute_url() + '/@@search?SearchableText=Foo')
+ # Now we want to get results with all elements in the site.
+ # we use the main search form for this search
+ content = sel.find_element_by_id('content')
+ main_search_form = content.find_element_by_name('searchform')
+ search_field = main_search_form.find_element_by_name('SearchableText')
+ search_button = main_search_form.find_element_by_css_selector('.searchButton')
+ search_field.send_keys('Foo')
+ search_button.click()
+
+ # We should give the view some time in order to finish the animation of
+ # the search results
+ time.sleep(1)
+
# We should get our 5 'Foo' elements:
res_num = sel.find_element_by_id('search-results-number')
self.assertEquals(res_num.text, '5')

0 comments on commit 2010bbc

Please sign in to comment.
Something went wrong with that request. Please try again.