Sha256: ecaadf0a4d90d2f42bf7cca4aeac927bdfcae853182e9ed8840aac5d14c57609

Contents?: true

Size: 927 Bytes

Versions: 1

Compression:

Stored size: 927 Bytes

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

      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 lib/furter/accessors/view.rb