Sha256: 0fa231296972bf247243f371b1e7098c31f14ceac442a6f000306db33e5e6deb

Contents?: true

Size: 1.18 KB

Versions: 102

Compression:

Stored size: 1.18 KB

Contents

module OpsManagerUiDrivers
  module Version14
    class ProductResourceConfiguration
      attr_reader :product_name

      def initialize(browser:, product_name:)
        @browser      = browser
        @product_name = product_name
      end

      def set_instances_for_job(job_name, instance_count)
        open_form
        browser.find_field("product_resources_form[#{job_name}][instances][value]").set(instance_count)
        save_form
      end

      def set_elb_for_job(job_name, elb_name)
        open_form
        browser.find_field("product_resources_form[#{job_name}][elb_name]").set(elb_name)
        save_form
      end

      private

      attr_reader :browser

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

      def save_form
        browser.click_on 'Save'

        unless browser.has_css?('.flash-message.success')
          if browser.has_css?('.flash-message.error')
            raise browser.find('.flash-message.error').text
          else
            raise 'unexpected failure'
          end
        end
      end
    end
  end
end

Version data entries

102 entries across 102 versions & 1 rubygems

Version Path
ops_manager_ui_drivers-2.42.0 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.41.0 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.40.1 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.40.0 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.39.0 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.38.0 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.37.0 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.36.0 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.35.2 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.35.1 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.35.0 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.34.1 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.34.0 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.33.1 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.33.0 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.32.1 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.32.0 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.31.3 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.31.2 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb
ops_manager_ui_drivers-2.31.1 lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb