Sha256: 9bfa2239d0daaa5dcdbbfd2bf686c03519dfebd9745096e4c28bde583cd05f5e

Contents?: true

Size: 1.32 KB

Versions: 4

Compression:

Stored size: 1.32 KB

Contents

# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
module SelectorHelpers
  def chosen_select(item_text, options)
    field_id = find_field(options[:from])[:id]
    option_value = page.evaluate_script("jQuery(\"##{field_id} option:contains('#{item_text}')\").val()")#page.evaluate_script("$(\"##{field_id} option:contains('#{item_text}')\").val()")
    page.execute_script("jQuery('##{field_id}').val('#{option_value}')")
  end

  def check_filter(filter_name)
    filter_checkbox = find(:xpath, "//input[@type='checkbox'][@value='due_#{filter_name}']")
    filter_checkbox.click
  end

  def click_filter_tab(filter_name)
    tab = find(:xpath, "//div[@class='filters']//td[contains(text(), '#{filter_name}')]")
    tab.click
  end

  def click_edit_for_task_id(task_id)
    within("#task_#{task_id}") do
      page.execute_script "jQuery('#task_#{task_id} a')[0].click()"
    end
  end

  def click_delete_for_task_id(task_id)
    within("#task_#{task_id}") do
      page.execute_script "jQuery('#task_#{task_id} a')[1].click()"
    end
  end
end

RSpec.configuration.include SelectorHelpers, :type => :feature

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fat_free_crm-0.12.3 spec/features/support/selector_helpers.rb
fat_free_crm-0.12.2 spec/features/support/selector_helpers.rb
fat_free_crm-0.12.1 spec/features/support/selector_helpers.rb
fat_free_crm-0.12.0 spec/features/support/selector_helpers.rb