Class: OpsManagerUiDrivers::Version17::JobAzAndNetworkMappingHelper
- Inherits:
-
Object
- Object
- OpsManagerUiDrivers::Version17::JobAzAndNetworkMappingHelper
show all
- Defined in:
- lib/ops_manager_ui_drivers/version17/job_az_and_network_mapping_helper.rb
Constant Summary
collapse
- SINGLETON_AVAILABILITY_ZONE_INPUT_SELECTOR =
"input[name='product[singleton_availability_zone_reference]']"
- AVAILABILITY_ZONE_INPUT_SELECTOR =
"input[name='product[availability_zone_references][]']"
- NETWORK_FIELD_NAME =
"product_network_reference"
Instance Method Summary
collapse
Constructor Details
Returns a new instance of JobAzAndNetworkMappingHelper.
4
5
6
7
|
# File 'lib/ops_manager_ui_drivers/version17/job_az_and_network_mapping_helper.rb', line 4
def initialize(product_name:, browser:)
@product_name = product_name
@browser = browser
end
|
Instance Method Details
#assign_azs_and_network(singleton_availability_zone: nil, availability_zones: [], network:) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/ops_manager_ui_drivers/version17/job_az_and_network_mapping_helper.rb', line 13
def assign_azs_and_network(singleton_availability_zone: nil, availability_zones: [], network:)
open_form
got_azs = false
browser.all(AVAILABILITY_ZONE_INPUT_SELECTOR).each do |checkbox|
got_azs = true
checkbox.set(false)
end
availability_zones.each { |az_name| browser.check("#{az_name}") } if got_azs
browser.choose("#{singleton_availability_zone}") if got_azs
browser.find_field(NETWORK_FIELD_NAME).find(:option, text: network).select_option
save_form
end
|
#availability_zones ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/ops_manager_ui_drivers/version17/job_az_and_network_mapping_helper.rb', line 42
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
|
#product_network ⇒ Object
50
51
52
53
54
55
|
# File 'lib/ops_manager_ui_drivers/version17/job_az_and_network_mapping_helper.rb', line 50
def product_network
open_form
selected_options = browser.find_field(NETWORK_FIELD_NAME).all('option[selected]')
raise ArgumentError, "#{NETWORK_FIELD_NAME} not selected" if selected_options.empty?
selected_options.first.text
end
|
#singleton_availability_zone ⇒ Object
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/ops_manager_ui_drivers/version17/job_az_and_network_mapping_helper.rb', line 31
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
|