Sha256: f0636a2b220b88f5a6c48c4d717ed24abf407de1c90bcaf2292bfdf253dd00a6

Contents?: true

Size: 1.31 KB

Versions: 14

Compression:

Stored size: 1.31 KB

Contents

module OpsManagerUiDrivers
  module Version15
    class AvailabilityZones
      def initialize(browser:)
        @browser = browser
      end

      def add_aws_az(iaas_identifier)
        open_form('availability_zones')

        set_fields(fields: {'iaas_identifier' => iaas_identifier})
        save_form
      end

      def add_az(name, cluster, resource_pool)
        open_form('availability_zones')

        browser.click_on 'Add'
        set_fields(
          fields: {
            'name' => name,
            'cluster' => cluster,
            'resource_pool' => resource_pool,
          }
        )
        save_form
      end

      private

      attr_reader :browser

      def save_form
        browser.click_on 'Save'
        browser.expect(browser.page).to browser.have_css('.flash-message.success')
      end

      def open_form(form)
        browser.visit '/'
        browser.click_on 'show-microbosh-configure-action'
        browser.click_on "show-#{form}-action"
      end

      def set_fields(fields:)
        fields.each do |field, value|
          set_field(field, value)
        end
      end

      def set_field(field, value)
        last_field(field).set(value)
      end

      def last_field(field)
        browser.all(:field, "availability_zones[availability_zones][][#{field}]").last
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ops_manager_ui_drivers-0.9.1 lib/ops_manager_ui_drivers/version15/availability_zones.rb
ops_manager_ui_drivers-0.9.0 lib/ops_manager_ui_drivers/version15/availability_zones.rb
ops_manager_ui_drivers-0.8.2 lib/ops_manager_ui_drivers/version15/availability_zones.rb
ops_manager_ui_drivers-0.8.1 lib/ops_manager_ui_drivers/version15/availability_zones.rb
ops_manager_ui_drivers-0.8.0 lib/ops_manager_ui_drivers/version15/availability_zones.rb
ops_manager_ui_drivers-0.7.0 lib/ops_manager_ui_drivers/version15/availability_zones.rb
ops_manager_ui_drivers-0.6.2 lib/ops_manager_ui_drivers/version15/availability_zones.rb
ops_manager_ui_drivers-0.6.1 lib/ops_manager_ui_drivers/version15/availability_zones.rb
ops_manager_ui_drivers-0.6.0 lib/ops_manager_ui_drivers/version15/availability_zones.rb
ops_manager_ui_drivers-0.5.0 lib/ops_manager_ui_drivers/version15/availability_zones.rb
ops_manager_ui_drivers-0.4.1 lib/ops_manager_ui_drivers/version15/availability_zones.rb
ops_manager_ui_drivers-0.4.0 lib/ops_manager_ui_drivers/version15/availability_zones.rb
ops_manager_ui_drivers-0.3.0 lib/ops_manager_ui_drivers/version15/availability_zones.rb
ops_manager_ui_drivers-0.2.0 lib/ops_manager_ui_drivers/version15/availability_zones.rb