Commit 568c06a72a16c9dfa4a3cf8e5716bbd2f6a37aed
1 parent
cebc50a3
Exists in
master
and in
29 other branches
Adds step definition to select token input search results
In the process, fixes a `events.feature` scenario
Showing
5 changed files
with
23 additions
and
16 deletions
Show diff stats
features/events.feature
... | ... | @@ -167,8 +167,8 @@ Feature: events |
167 | 167 | And I go to josesilva's control panel |
168 | 168 | And I follow "Manage Content" |
169 | 169 | And I follow "Another Conference" |
170 | - And I follow "Spread" | |
171 | - And I check "Sample Community" | |
170 | + And I follow "Spread this" | |
171 | + And I type in "Sample Community" into autocomplete list "search-communities-to-publish" and I choose "Sample Community" | |
172 | 172 | And I press "Spread this" |
173 | 173 | And I am on /profile/sample-community/events/2009/10/24 |
174 | 174 | Then I should see "Another Conference" | ... | ... |
features/publish_article.feature
... | ... | @@ -40,7 +40,6 @@ Feature: publish article |
40 | 40 | | Sample Community | |
41 | 41 | And I fill in "Title" with "Another name" |
42 | 42 | And I press "Spread this" |
43 | - And show sample-community tasks | |
44 | 43 | When I go to sample-community's blog |
45 | 44 | Then I should see "Another name" |
46 | 45 | And I should not see "Sample Article" | ... | ... |
features/step_definitions/custom_web_steps.rb
... | ... | @@ -44,3 +44,15 @@ end |
44 | 44 | When /^I confirm the browser dialog$/ do |
45 | 45 | page.driver.browser.switch_to.alert.accept |
46 | 46 | end |
47 | + | |
48 | +When /^I type in "([^\"]*)" into autocomplete list "([^\"]*)" and I choose "([^\"]*)"$/ do |term, input, result| | |
49 | + # We seem to have to wait for the page to load js | |
50 | + sleep 1 | |
51 | + page.execute_script("jQuery('#token-input-#{input}').trigger('focus').val('#{term}').trigger('keydown')") | |
52 | + | |
53 | + # We use this to wait for the search | |
54 | + page.should have_selector('.token-input-dropdown li') | |
55 | + | |
56 | + page.execute_script ("jQuery('.token-input-dropdown li:contains(\"#{result}\")').trigger('mousedown');") | |
57 | + page.should have_selector('li.token-input-token') | |
58 | +end | ... | ... |
features/step_definitions/noosfero_steps.rb
features/step_definitions/search_steps.rb
... | ... | @@ -5,16 +5,16 @@ When /^I choose the search filter "(.*)"$/ do |filter| |
5 | 5 | end |
6 | 6 | |
7 | 7 | When /^I choose the following communities to spread$/ do |table| |
8 | - ids = [] | |
9 | 8 | table.hashes.each do |row| |
10 | 9 | name = row.delete("name") |
11 | - community = Community.find_by_name(name) | |
12 | - ids << community.id | |
10 | + # We seem to have to wait for the page to load js | |
11 | + sleep 1 | |
12 | + page.execute_script("jQuery('#token-input-search-communities-to-publish').trigger('focus').val('#{name}').trigger('keydown')") | |
13 | + | |
14 | + # We use this to wait for the search | |
15 | + page.should have_selector('.token-input-dropdown li') | |
16 | + | |
17 | + page.execute_script ("jQuery('.token-input-dropdown li:contains(\"#{name}\")').trigger('mousedown');") | |
18 | + page.should have_selector('li.token-input-token') | |
13 | 19 | end |
14 | - #TODO make this work somehow... | |
15 | - #fill_in('q', :with => ids.join(',')) | |
16 | - #fill_in('#search-communities-to-publish', :with => ids.join(',')) | |
17 | - page.execute_script("jQuery('#search-communities-to-publish').val(#{ids.join(',')})") | |
18 | - page.execute_script("jQuery('#search-communities-to-publish').show()") | |
19 | - p find('#search-communities-to-publish').value | |
20 | 20 | end | ... | ... |