Sha256: e6f2b10f44e111d9ba2333a6dcdf23672de5c465c54b5c52cbd87fdd94954f7e

Contents?: true

Size: 1.6 KB

Versions: 102

Compression:

Stored size: 1.6 KB

Contents

module OpsManagerUiDrivers
  module Version14
    class ProductStatusHelper
      def initialize(product_name:, browser:)
        @product_name = product_name
        @browser      = browser
      end

      def job_status(job_name)
        open_page

        wait_for_loading_indicator_to_disappear

        browser.within "##{product_name}-status" do
          job_row = browser.find(:xpath, ".//tr[@data-ip-name = '#{job_name}']")

          Version14::JobStatusHelper.from_job_row(job_row)
        end
      end

      def job_status_in_az(job_name, az_guid)
        open_page

        wait_for_loading_indicator_to_disappear

        browser.within "##{product_name}-#{az_guid}-status-table" do
          job_row = browser.find(:xpath, ".//tr[@data-ip-name = '#{job_name}']")

          Version14::JobStatusHelper.from_job_row(job_row)
        end
      end

      def resource_pool_for_job_in_az(job_name, az_guid, vsphere_connection)
        job_status = job_status_in_az("#{job_name}-partition-#{az_guid}", az_guid)

        job_ip = job_status.ips.fetch(0)

        vm = vsphere_connection.searchIndex.FindByIp(ip: job_ip, vmSearch: true)
        vm.resourcePool.name
      end

      private

      attr_reader :browser, :product_name

      def open_page
        browser.visit '/'

        browser.click_on "show-#{product_name.dasherize}-configure-action"
        browser.click_on 'show-status-action'
      end

      def wait_for_loading_indicator_to_disappear
        Capybara.using_wait_time 20 do
          browser.all('.status-loading', count: 0) # blocks until there are no spinners
        end
      end
    end
  end
end

Version data entries

102 entries across 102 versions & 1 rubygems

Version Path
ops_manager_ui_drivers-2.31.0 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.30.0 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.29.0 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.28.0 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.27.1 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.27.0 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.26.0 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.25.1 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.25.0 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.24.0 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.23.0 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.22.4 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.22.3 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.22.2 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.22.1 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.22.0 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.21.0 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.20.0 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.19.0 lib/ops_manager_ui_drivers/version14/product_status_helper.rb
ops_manager_ui_drivers-2.18.0 lib/ops_manager_ui_drivers/version14/product_status_helper.rb