Sha256: 4dd01778bbf8750a73c565f034ce4383b40efe6f2bb57bd38191918a931c134a

Contents?: true

Size: 1.08 KB

Versions: 15

Compression:

Stored size: 1.08 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], visible: false)[:id]
    option_value = page.evaluate_script("$(\"##{field_id} option:contains('#{item_text}')\").val()")
    page.execute_script("$('##{field_id}').val('#{option_value}')")
  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 "$('#task_#{task_id} a')[0].click()"
    end
  end

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

RSpec.configuration.include SelectorHelpers, type: :feature

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
fat_free_crm-0.14.2 spec/features/support/selector_helpers.rb
fat_free_crm-0.15.2 spec/features/support/selector_helpers.rb
fat_free_crm-0.16.4 spec/features/support/selector_helpers.rb
fat_free_crm-0.14.1 spec/features/support/selector_helpers.rb
fat_free_crm-0.15.1 spec/features/support/selector_helpers.rb
fat_free_crm-0.16.3 spec/features/support/selector_helpers.rb
fat_free_crm-0.16.2 spec/features/support/selector_helpers.rb
fat_free_crm-0.16.1 spec/features/support/selector_helpers.rb
fat_free_crm-0.16.0 spec/features/support/selector_helpers.rb
fat_free_crm-0.15.0 spec/features/support/selector_helpers.rb
fat_free_crm-0.15.0.beta.2 spec/features/support/selector_helpers.rb
fat_free_crm-0.15.0.beta spec/features/support/selector_helpers.rb
fat_free_crm-0.14.0 spec/features/support/selector_helpers.rb
reduced_fat_crm-0.15.0.beta spec/features/support/selector_helpers.rb
reduced_fat_crm-0.14.0 spec/features/support/selector_helpers.rb