Module: Cello::PageObjects::SelectHelper

Included in:
ElementHelper
Defined in:
lib/cello/pageobjects/html_elements/select_helper.rb

Instance Method Summary collapse

Instance Method Details

#define_extras_for_select(name) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/cello/pageobjects/html_elements/select_helper.rb', line 4

def define_extras_for_select(name)
  include LogHelper

  define_method "#{name}_get_options" do
    logger(name, __method__, :select) {
      options = Array.new
      send(name).options.each do |option|
        options.push option.text
      end
      options
    }
  end
  define_method "#{name}_select" do |option|
    logger(name, __method__, :select) {
      send(name).select option
    }
  end
  define_method "#{name}_is" do |option|
    logger(name, __method__, :select) {
      send(name).selected_options.last.text == option
    }
  end
  define_method "#{name}_selected" do
    logger(name, __method__, :select) {
      send(name).selected_options.last.text
    }
  end
#  define_method "#{name}_clear" do
#    send(name).clear
#  end
end