Sha256: 7ead22a16814f8707a8d0b64fa303c75fe8b57e5ba3e6d05cd6aa68aa9c0c751

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

module Furter
  module Accessors
    class View
      include Furter, Frank::Cucumber::FrankHelper, Frank::Cucumber::WaitHelper

      def initialize(locator={})
        @locator = locator
      end

      def click

        wait_for_and_touch selector
      end

      def visible?
        element_is_not_hidden selector
      end

      def enabled?
        frankly_map(selector, 'isEnabled')[0]
      end

      def next_responders
        frankly_map("view:'UIView'", 'nextResponder').map do |r|
          r.gsub(/[<>]/,'')
        end
      end

      private
      def selector
        "#{view_class} #{selector_how}#{selector_extra}"
      end

      def selector_how
        case
          when @locator[:label]
            "marked:'#{@locator[:label]}'"
          when @locator[:text]
            "text:'#{@locator[:text]}'"
        end
      end

      def selector_extra
        " #{@locator[:extra]}" if @locator[:extra]
      end

      def view_class
        return "view:'#{@locator[:type]}'" if @locator[:type]
        "view"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
furter-0.0.3.2 lib/furter/accessors/view.rb