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,8 +167,8 @@ Feature: events | ||
167 | And I go to josesilva's control panel | 167 | And I go to josesilva's control panel |
168 | And I follow "Manage Content" | 168 | And I follow "Manage Content" |
169 | And I follow "Another Conference" | 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 | And I press "Spread this" | 172 | And I press "Spread this" |
173 | And I am on /profile/sample-community/events/2009/10/24 | 173 | And I am on /profile/sample-community/events/2009/10/24 |
174 | Then I should see "Another Conference" | 174 | Then I should see "Another Conference" |
features/publish_article.feature
@@ -40,7 +40,6 @@ Feature: publish article | @@ -40,7 +40,6 @@ Feature: publish article | ||
40 | | Sample Community | | 40 | | Sample Community | |
41 | And I fill in "Title" with "Another name" | 41 | And I fill in "Title" with "Another name" |
42 | And I press "Spread this" | 42 | And I press "Spread this" |
43 | - And show sample-community tasks | ||
44 | When I go to sample-community's blog | 43 | When I go to sample-community's blog |
45 | Then I should see "Another name" | 44 | Then I should see "Another name" |
46 | And I should not see "Sample Article" | 45 | And I should not see "Sample Article" |
features/step_definitions/custom_web_steps.rb
@@ -44,3 +44,15 @@ end | @@ -44,3 +44,15 @@ end | ||
44 | When /^I confirm the browser dialog$/ do | 44 | When /^I confirm the browser dialog$/ do |
45 | page.driver.browser.switch_to.alert.accept | 45 | page.driver.browser.switch_to.alert.accept |
46 | end | 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
@@ -772,7 +772,3 @@ Given /^the field (.*) is public for all users$/ do |field| | @@ -772,7 +772,3 @@ Given /^the field (.*) is public for all users$/ do |field| | ||
772 | person.save! | 772 | person.save! |
773 | end | 773 | end |
774 | end | 774 | end |
775 | - | ||
776 | -And /^show (.*) tasks$/ do |identifier| | ||
777 | - puts Community.find_by_identifier(identifier).tasks.pending.count | ||
778 | -end |
features/step_definitions/search_steps.rb
@@ -5,16 +5,16 @@ When /^I choose the search filter "(.*)"$/ do |filter| | @@ -5,16 +5,16 @@ When /^I choose the search filter "(.*)"$/ do |filter| | ||
5 | end | 5 | end |
6 | 6 | ||
7 | When /^I choose the following communities to spread$/ do |table| | 7 | When /^I choose the following communities to spread$/ do |table| |
8 | - ids = [] | ||
9 | table.hashes.each do |row| | 8 | table.hashes.each do |row| |
10 | name = row.delete("name") | 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 | end | 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 | end | 20 | end |