Sha256: 47405bedc963eea2083076e1dbd743d7c4ed879b2fb1e37bee6ed82984234245

Contents?: true

Size: 1.07 KB

Versions: 102

Compression:

Stored size: 1.07 KB

Contents

module OpsManagerUiDrivers
  module Version15
    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.5.0 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.4.2 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.4.1 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.4.0 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.3.2 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.3.1 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.3.0 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.2.1 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.2.0 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.1.8 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.1.7 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.1.6 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.1.5 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.1.4 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.1.3 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.1.2 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.1.1 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.1.0 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.0.4 lib/ops_manager_ui_drivers/version15/product_errands.rb
ops_manager_ui_drivers-2.0.3 lib/ops_manager_ui_drivers/version15/product_errands.rb