Sha256: 5e061f97a023307f35a4f0c4ae947d0f663ac4f758453e0c9b685158e511145e

Contents?: true

Size: 1.36 KB

Versions: 85

Compression:

Stored size: 1.36 KB

Contents

module OpsManagerUiDrivers
  module Version14
    class Networks
      def initialize(browser:, product:)
        @browser = browser
        @product = product
      end

      def add_network(name:, iaas_network_identifier:, subnet:, dns:, gateway:, reserved_ip_ranges:)
        open_form('network')

        browser.click_on 'Add'
        set_fields(
          fields: {
            'name' => name,
            'iaas_network_identifier' => iaas_network_identifier,
            'subnet' => subnet,
            'dns' => dns,
            'gateway' => gateway,
            'reserved_ip_ranges' => reserved_ip_ranges,
          }
        )
        save_form
      end

      private
      attr_reader(
        :browser,
        :product,
      )

      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-#{product}-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, "network[networks][][#{field}]").last
      end
    end
  end
end

Version data entries

85 entries across 85 versions & 1 rubygems

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