Sha256: b95720268db2e3b32ebdc02c4ced9037c66f2d4f4a8bf6ec72480edf69114ab8

Contents?: true

Size: 1.06 KB

Versions: 40

Compression:

Stored size: 1.06 KB

Contents

module OpsManagerUiDrivers
  module Version17
    class ProductErrands
      def initialize(browser:, product_name:)
        @browser = browser
        @product_name = product_name
      end

      def enable_errand(errand_name)
        open_form
        browser.find_field("errands_collection_enabled_names_#{errand_name}").set(true)
        save_form
      end

      def disable_errand(errand_name)
        open_form
        browser.find_field("errands_collection_enabled_names_#{errand_name}").set(false)
        save_form
      end

      def save_form(validate: true)
        browser.click_on 'Save'

        fail('unexpected failure') unless browser.has_css?('.flash-message')

        if validate
          fail(browser.find('.flash-message.error').text) unless browser.has_css?('.flash-message.success')
        end
      end

      def open_form
        browser.visit '/'
        browser.click_on "show-#{product_name}-configure-action"
        browser.click_on "show-product-errands-action"
      end

      private

      attr_reader :browser, :product_name
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
ops_manager_ui_drivers-1.8.3 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.28.1 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.28.0 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.27.0 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.26.1 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.26.0 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.25.1 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.25.0 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.24.4 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.24.3 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.24.2 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.24.1 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.24.0 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.23.0 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.22.0 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.21.1 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.21.0 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.20.0 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.19.0 lib/ops_manager_ui_drivers/version17/product_errands.rb
ops_manager_ui_drivers-1.18.0 lib/ops_manager_ui_drivers/version17/product_errands.rb