class OpsManagerUiDrivers::Version16::JobAvailabilityZoneMappingHelper
Constants
- AVAILABILITY_ZONE_INPUT_SELECTOR
- SINGLETON_AVAILABILITY_ZONE_INPUT_SELECTOR
Attributes
browser[R]
product_name[R]
Public Class Methods
new(product_name:, browser:)
click to toggle source
# File lib/ops_manager_ui_drivers/version16/job_availability_zone_mapping_helper.rb, line 4 def initialize(product_name:, browser:) @product_name = product_name @browser = browser end
Public Instance Methods
assign_availability_zones!(singleton_availability_zone:, availability_zones:)
click to toggle source
# File lib/ops_manager_ui_drivers/version16/job_availability_zone_mapping_helper.rb, line 12 def assign_availability_zones!(singleton_availability_zone:, availability_zones:) open_form browser.all(AVAILABILITY_ZONE_INPUT_SELECTOR).each do |checkbox| checkbox.set(false) end availability_zones.each do |az_name| browser.check("#{az_name}") end browser.choose("#{singleton_availability_zone}") save_form end
availability_zones()
click to toggle source
# File lib/ops_manager_ui_drivers/version16/job_availability_zone_mapping_helper.rb, line 39 def availability_zones open_form browser.all("#{AVAILABILITY_ZONE_INPUT_SELECTOR}[checked='checked']").map do |checkbox| browser.find("label[for='#{checkbox[:id]}']").text end end
singleton_availability_zone()
click to toggle source
# File lib/ops_manager_ui_drivers/version16/job_availability_zone_mapping_helper.rb, line 28 def singleton_availability_zone open_form selected_options = browser.all("#{SINGLETON_AVAILABILITY_ZONE_INPUT_SELECTOR}[selected='selected']").map do |radio| browser.find("label[for='#{radio[:id]}']").text end raise ArgumentError, 'availability_zone not selected' if selected_options.empty? selected_options.first end
Private Instance Methods
open_form()
click to toggle source
# File lib/ops_manager_ui_drivers/version16/job_availability_zone_mapping_helper.rb, line 51 def open_form browser.visit '/' browser.click_on "show-#{product_name}-configure-action" browser.click_on "show-#{product_name}-availability-zone-assignment-action" end
save_form()
click to toggle source
# File lib/ops_manager_ui_drivers/version16/job_availability_zone_mapping_helper.rb, line 57 def save_form browser.click_on 'Save' unless browser.has_css?('.flash-message.success') if browser.has_css?('.flash-message.error') raise browser.find('.flash-message.error').text else raise 'unexpected failure' end end end