Sha256: f06a8d115c6ac545453817b56953794f7f6fd8a3e7afb069298a63613071a3d5

Contents?: true

Size: 1.65 KB

Versions: 20

Compression:

Stored size: 1.65 KB

Contents

module OpsManagerUiDrivers
  module Version17
    module BoshProductSections
      class Networks
        FLASH_MESSAGE_CLASS = '.flash-message'.freeze
        FLASH_MESSAGE_ERRORS = '.flash-message.error ul.message li'.freeze

        def initialize(browser:)
          @browser = browser
          @bosh_product_form_section = BoshProductFormSection.new(@browser, 'network_collection[networks_attributes][0]')
        end

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

          @browser.click_on 'Add Network'
          @bosh_product_form_section.set_fields('name' => name)

          subnet_section = Subnet.new(browser: @browser, network_form: @bosh_product_form_section)
          subnet_section.add_subnet(iaas_identifier: iaas_network_identifier, subnet: subnet, dns: dns, gateway: gateway, reserved_ip_ranges: reserved_ip_ranges)

          @browser.click_on 'Save'
          @browser.expect(@browser.page).to @browser.have_css(FLASH_MESSAGE_CLASS)
          flash_errors = @browser.all(FLASH_MESSAGE_ERRORS).to_a
          flash_errors.reject! { |node| node.text =~ /cannot reach gateway/i }

          if (flash_errors.length > 0)
            fail flash_errors.collect(&:text).inspect
          end
        end

        def delete_network(network_name)
          @bosh_product_form_section.open_form('network')
          button = @browser.find('button', text: network_name)
          button.click
          button.find(:xpath, '..').first('.with-delete-record').trigger('click')

          @bosh_product_form_section.save_form
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

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