cirandas.net

ref: master

features/step_definitions/search_steps.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
When /^I choose the search filter "(.*)"$/ do |filter|
  # Wish this worked instead...
  # find("li", :text => filter).click
  page.execute_script("jQuery('li[title=#{filter}]').click();")
end

When /^I choose the following communities to spread$/ do |table|
  table.hashes.each do |row|
    name = row.delete("name")
    # We seem to have to wait for the page to load js
    sleep 1
    page.execute_script("jQuery('#token-input-search-communities-to-publish').trigger('focus').val('#{name}').trigger('keydown')")

    # We use this to wait for the search
    page.should have_selector('.token-input-dropdown li')

    page.execute_script ("jQuery('.token-input-dropdown li:contains(\"#{name}\")').trigger('mousedown');")
    page.should have_selector('li.token-input-token')
  end
end