Sha256: f939cb064b301c7aa4acb3ac3de9e49f718244dd55d5f2dff8075662ee20ec6e

Contents?: true

Size: 1.07 KB

Versions: 102

Compression:

Stored size: 1.07 KB

Contents

module OpsManagerUiDrivers
  module Version16
    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

102 entries across 102 versions & 1 rubygems

Version Path
ops_manager_ui_drivers-2.17.0 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.16.0 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.15.0 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.14.3 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.14.2 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.14.1 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.14.0 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.13.1 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.13.0 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.12.0 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.11.0 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.10.9 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.10.8 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.10.7 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.10.6 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.10.5 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.10.4 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.10.3 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.10.2 lib/ops_manager_ui_drivers/version16/product_errands.rb
ops_manager_ui_drivers-2.10.1 lib/ops_manager_ui_drivers/version16/product_errands.rb