Sha256: 3ee8aab42ce4ccb91ff2707aac755f608c1d9558bf6ca71c0e4882cb67ba7c91

Contents?: true

Size: 1.18 KB

Versions: 42

Compression:

Stored size: 1.18 KB

Contents

require 'calabash-cucumber'

module Briar
  module Picker

    def should_see_picker (picker_name)
      picker_exists = !query("pickerView marked:'#{picker_name}").empty?
      unless picker_exists
        screenshot_and_raise "could not find picker named #{picker_name}"
      end
    end

    def should_not_see_picker (picker_name)
      picker_exists = !query("pickerView marked:'#{picker_name}").empty?
      if picker_exists
        screenshot_and_raise "expected to _not_ see #{picker}"
      end
    end

    def visible_titles (column)
      query("pickerTableView index:#{column} child pickerTableViewWrapperCell", :wrappedView, :text).reverse
    end

# may only work on circular pickers - does _not_ work on non-circular pickers
# because the visible titles do _not_ follow the selected index
    def selected_title_for_column (column)
      selected_idx = picker_current_index_for_column column
      titles = visible_titles column
      titles[selected_idx]
    end

    def scroll_picker(dir, picker_id)
      should_see_picker picker_id
      if dir.eql? 'down'
        picker_scroll_down_on_column 0
      else
        picker_scroll_up_on_column 0
      end
      step_pause
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
briar-2.0.5 lib/briar/picker/picker.rb
briar-2.0.4 lib/briar/picker/picker.rb
briar-2.0.3 lib/briar/picker/picker.rb
briar-2.0.2 lib/briar/picker/picker.rb
briar-2.0.1 lib/briar/picker/picker.rb
briar-2.0.0 lib/briar/picker/picker.rb
briar-1.4.2 lib/briar/picker/picker.rb
briar-1.4.1 lib/briar/picker/picker.rb
briar-1.3.2 lib/briar/picker/picker.rb
briar-1.3.1 lib/briar/picker/picker.rb
briar-1.3.0 lib/briar/picker/picker.rb
briar-1.2.2 lib/briar/picker/picker.rb
briar-1.2.1 lib/briar/picker/picker.rb
briar-1.2.0 lib/briar/picker/picker.rb
briar-1.1.9 lib/briar/picker/picker.rb
briar-1.1.8 lib/briar/picker/picker.rb
briar-1.1.7 lib/briar/picker/picker.rb
briar-1.1.6 lib/briar/picker/picker.rb
briar-1.1.5 lib/briar/picker/picker.rb
briar-1.1.4 lib/briar/picker/picker.rb