Sha256: fdc59362d06ae93d49a6f46c40c7b13a77ec55f3f23e99df7cdc6a2944e0ebd6

Contents?: true

Size: 1.69 KB

Versions: 36

Compression:

Stored size: 1.69 KB

Contents

module OpsManagerUiDrivers
  module Version15
    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}']")

          Version15::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}']")

          Version15::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-#{dasherized_product_name}-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

      def dasherized_product_name
        product_name.to_s.gsub(/[_]/, '-')
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
ops_manager_ui_drivers-1.8.3 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.23.0 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.22.0 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.21.1 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.21.0 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.20.0 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.19.0 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.18.0 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.17.0 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.16.0 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.15.0 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.14.0 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.13.0 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.12.0 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.11.0 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.10.0 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.9.5 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.9.4 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.9.3 lib/ops_manager_ui_drivers/version15/product_status_helper.rb
ops_manager_ui_drivers-1.9.2 lib/ops_manager_ui_drivers/version15/product_status_helper.rb