ops_manager_ui_drivers 1.6.3 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ops_manager_ui_drivers/page_helpers.rb +9 -1
  3. data/lib/ops_manager_ui_drivers/version.rb +1 -1
  4. data/lib/ops_manager_ui_drivers/version16/api_1_6.rb +42 -0
  5. data/lib/ops_manager_ui_drivers/version17/available_products.rb +25 -0
  6. data/lib/ops_manager_ui_drivers/version17/bosh_product_sections/advanced_infrastructure_config.rb +18 -0
  7. data/lib/ops_manager_ui_drivers/version17/bosh_product_sections/availability_zones.rb +29 -0
  8. data/lib/ops_manager_ui_drivers/version17/bosh_product_sections/bosh_product_form_section.rb +39 -0
  9. data/lib/ops_manager_ui_drivers/version17/bosh_product_sections/iaas_configuration.rb +17 -0
  10. data/lib/ops_manager_ui_drivers/version17/bosh_product_sections/networks.rb +51 -0
  11. data/lib/ops_manager_ui_drivers/version17/job_availability_zone_mapping_helper.rb +70 -0
  12. data/lib/ops_manager_ui_drivers/version17/job_network_mapping_helper.rb +47 -0
  13. data/lib/ops_manager_ui_drivers/version17/job_status_helper.rb +17 -0
  14. data/lib/ops_manager_ui_drivers/version17/ops_manager_director.rb +188 -0
  15. data/lib/ops_manager_ui_drivers/version17/product_availability_zones.rb +38 -0
  16. data/lib/ops_manager_ui_drivers/version17/product_configuration.rb +38 -0
  17. data/lib/ops_manager_ui_drivers/version17/product_dashboard.rb +191 -0
  18. data/lib/ops_manager_ui_drivers/version17/product_errands.rb +42 -0
  19. data/lib/ops_manager_ui_drivers/version17/product_form.rb +61 -0
  20. data/lib/ops_manager_ui_drivers/version17/product_logs.rb +38 -0
  21. data/lib/ops_manager_ui_drivers/version17/product_resource_configuration.rb +69 -0
  22. data/lib/ops_manager_ui_drivers/version17/product_status_helper.rb +64 -0
  23. data/lib/ops_manager_ui_drivers/version17/settings.rb +136 -0
  24. data/lib/ops_manager_ui_drivers/version17/setup.rb +44 -0
  25. data/lib/ops_manager_ui_drivers/version17/state_change_progress.rb +43 -0
  26. data/lib/ops_manager_ui_drivers/version17/web_ui.rb +110 -0
  27. metadata +25 -2
@@ -0,0 +1,191 @@
1
+ module OpsManagerUiDrivers
2
+ module Version17
3
+ class ProductDashboard
4
+ def initialize(browser:)
5
+ @browser = browser
6
+ @allowed_ignorable_errors = []
7
+ end
8
+
9
+ def apply_updates
10
+ open_dashboard
11
+ browser.click_on 'install-action'
12
+ fail 'Install failed verification' if nonignorable_verification_failed?
13
+ allow_cpu_verification_errors
14
+ allow_privilege_verification_errors
15
+ allow_icmp_verification_errors #this is only for AWS; consider moving out
16
+
17
+ ignore_allowable_errors
18
+ assert_installation_started
19
+ end
20
+
21
+ def import_installation_file(file_path)
22
+ open_dashboard
23
+ browser.click_on 'toggle-installation-dropdown-action'
24
+ browser.click_on 'show-settings'
25
+ browser.click_on 'close-warning'
26
+ browser.attach_file 'import[file]', file_path
27
+ browser.click_on 'import-settings'
28
+ browser.wait { browser.assert_text('Successfully imported installation.') }
29
+ end
30
+
31
+ def delete_product(product_name)
32
+ open_dashboard
33
+ browser.click_on "open-delete-#{product_name}-modal"
34
+ wait_for_modal_css_transition_to_complete
35
+ browser.click_on "delete-#{product_name}-action"
36
+ end
37
+
38
+ def product_on_dashboard?(product_name)
39
+ open_dashboard
40
+ browser.all("a#show-#{product_name}-configure-action").any?
41
+ end
42
+
43
+ def import_product_from(full_path)
44
+ open_dashboard
45
+ browser.attach_file('component_add[file]', full_path, {visible: false})
46
+ end
47
+
48
+ def product_available?(product_name, product_version)
49
+ open_dashboard
50
+ browser.all("li.#{product_name} input#component_version[value='#{product_version}']", {visible: false}).any?
51
+ end
52
+
53
+ def product_complete?(product_name)
54
+ open_dashboard
55
+ browser.all("a#show-#{product_name}-configure-action[data-progress='100']").any?
56
+ end
57
+
58
+ def upgrade_product(product_name)
59
+ open_dashboard
60
+ browser.find(".product.#{product_name} p").trigger(:mouseover)
61
+ browser.click_on "upgrade-#{product_name}"
62
+ expect_no_flash_errors
63
+ end
64
+
65
+ def version_for_product(product_name)
66
+ open_dashboard
67
+ browser.find("#show-#{product_name}-configure-action .version").text
68
+ end
69
+
70
+ def delete_whole_installation
71
+ open_dashboard
72
+ browser.click_on 'toggle-installation-dropdown-action'
73
+ browser.click_on 'show-delete-installation-modal-action'
74
+ wait_for_modal_css_transition_to_complete
75
+ browser.click_on 'delete-installation-action'
76
+ apply_updates
77
+ end
78
+
79
+ def wait_for_installation_to_be_deleted
80
+ browser.poll_up_to_mins(10) do
81
+ open_dashboard
82
+ assert_install_action_disabled
83
+ end
84
+ end
85
+
86
+ def delete_installation_available?
87
+ open_dashboard
88
+ browser.click_on 'toggle-installation-dropdown-action'
89
+ browser.all('#show-delete-installation-modal-action').any?
90
+ end
91
+
92
+ def deletion_in_progress?
93
+ open_dashboard
94
+ browser.all('#delete-in-progress-marker').any?
95
+ end
96
+
97
+ def reset_state(ops_manager)
98
+ revert_pending_changes if revert_available?
99
+ if delete_installation_available?
100
+ delete_whole_installation
101
+ browser.poll_up_to_mins(15) do
102
+ browser.expect(ops_manager.state_change_progress).to browser.be_state_change_success
103
+ end
104
+ end
105
+ end
106
+
107
+ def most_recent_install_log
108
+ open_dashboard
109
+ if browser.all('#installation-logs li a', visible: false).any?
110
+ base_url = browser.first('#installation-logs li a', visible: false)[:href]
111
+ browser.visit "#{base_url}.text"
112
+ browser.source
113
+ end
114
+ end
115
+
116
+ def revert_pending_changes
117
+ open_dashboard
118
+ browser.click_on 'open-revert-installation-modal-action'
119
+ wait_for_modal_css_transition_to_complete
120
+ browser.click_on 'revert-installation-action'
121
+ end
122
+
123
+ def revert_available?
124
+ open_dashboard
125
+ browser.all('#open-revert-installation-modal-action').any?
126
+ end
127
+
128
+ private
129
+
130
+ attr_reader :browser
131
+
132
+ def assert_install_action_disabled
133
+ browser.expect(browser.page).to browser.have_css('#install-action.disabled')
134
+ end
135
+
136
+ def assert_installation_started
137
+ browser.expect(browser.page).to browser.have_text('Applying Changes')
138
+ end
139
+
140
+ def nonignorable_verification_failed?
141
+ browser.all('.flash-message.error').any? && browser.all('#ignore-install-action').empty?
142
+ end
143
+
144
+ def allow_cpu_verification_errors
145
+ return if @allowed_ignorable_errors.include?(/Installation requires \d+ CPU cores/)
146
+
147
+ @allowed_ignorable_errors << /Installation requires \d+ CPU cores/
148
+ end
149
+
150
+ def allow_privilege_verification_errors
151
+ return if @allowed_ignorable_errors.include?(/required datacenter privileges/i)
152
+
153
+ @allowed_ignorable_errors << /required datacenter privileges/i
154
+ end
155
+
156
+ def allow_icmp_verification_errors
157
+ return if @allowed_ignorable_errors.include?(/ignorable if ICMP is disabled/i)
158
+
159
+ @allowed_ignorable_errors << /ignorable if ICMP is disabled/i
160
+ end
161
+
162
+ def ignore_allowable_errors
163
+ flash_errors = browser.all('.flash-message.error')
164
+
165
+ if flash_errors.any?
166
+ unexpected_errors = flash_errors.reject do |error|
167
+ @allowed_ignorable_errors.select do |expected_error|
168
+ error.text =~ expected_error
169
+ end.any?
170
+ end
171
+
172
+ browser.click_on 'ignore-install-action' if unexpected_errors.empty?
173
+ end
174
+ end
175
+
176
+ def expect_no_flash_errors
177
+ if (flash_error = browser.all('.flash-message.error').first)
178
+ fail flash_error.text
179
+ end
180
+ end
181
+
182
+ def wait_for_modal_css_transition_to_complete
183
+ sleep 5 # Have to wait for the CSS shade effect
184
+ end
185
+
186
+ def open_dashboard
187
+ browser.visit '/'
188
+ end
189
+ end
190
+ end
191
+ end
@@ -0,0 +1,42 @@
1
+ module OpsManagerUiDrivers
2
+ module Version17
3
+ class ProductErrands
4
+ def initialize(browser:, product_name:)
5
+ @browser = browser
6
+ @product_name = product_name
7
+ end
8
+
9
+ def enable_errand(errand_name)
10
+ open_form
11
+ browser.find_field("errands_collection_enabled_names_#{errand_name}").set(true)
12
+ save_form
13
+ end
14
+
15
+ def disable_errand(errand_name)
16
+ open_form
17
+ browser.find_field("errands_collection_enabled_names_#{errand_name}").set(false)
18
+ save_form
19
+ end
20
+
21
+ def save_form(validate: true)
22
+ browser.click_on 'Save'
23
+
24
+ fail('unexpected failure') unless browser.has_css?('.flash-message')
25
+
26
+ if validate
27
+ fail(browser.find('.flash-message.error').text) unless browser.has_css?('.flash-message.success')
28
+ end
29
+ end
30
+
31
+ def open_form
32
+ browser.visit '/'
33
+ browser.click_on "show-#{product_name}-configure-action"
34
+ browser.click_on "show-product-errands-action"
35
+ end
36
+
37
+ private
38
+
39
+ attr_reader :browser, :product_name
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,61 @@
1
+ module OpsManagerUiDrivers
2
+ module Version17
3
+ class ProductForm
4
+ def initialize(browser:, product_name:, form_name:)
5
+ @browser = browser
6
+ @product_name = product_name
7
+ @form_name = form_name
8
+ end
9
+
10
+ def property(property_reference)
11
+ browser.find_field("#{form_name}[#{property_reference}]")
12
+ end
13
+
14
+ def nested_property(property_reference, nested_reference)
15
+ browser.find_field("#{form_name}[#{property_reference}][#{nested_reference}]")
16
+ end
17
+
18
+ def generate_self_signed_cert(wildcard_domain)
19
+ browser.click_on 'Generate Self-Signed RSA Certificate'
20
+ browser.within '#rsa-certificate-form' do
21
+ browser.fill_in 'rsa_certificate[domains]', with: wildcard_domain
22
+ browser.click_on 'save-rsa-certificate-action'
23
+ end
24
+ end
25
+
26
+ def fill_in_selector_property(selector_input_reference:, selector_name:, selector_value:, sub_field_answers:)
27
+ radio = browser.first(%Q(input[type="radio"][name="#{form_name}[#{selector_input_reference}][value]"][value="#{selector_value}"]))
28
+ radio.click
29
+ sub_field_answers.each do |label, value|
30
+ selector_string = "#{form_name}[#{selector_input_reference}][#{selector_name}][#{label}]"
31
+
32
+ if value[:attribute_name]
33
+ selector_string += "[#{value[:attribute_name]}]"
34
+ end
35
+
36
+ browser.find_field(selector_string).set(value[:attribute_value])
37
+ end
38
+ end
39
+
40
+ def save_form(validate: true)
41
+ browser.click_on 'Save'
42
+
43
+ fail('unexpected failure') unless browser.has_css?('.flash-message')
44
+
45
+ if validate
46
+ fail(browser.find('.flash-message.error').text) unless browser.has_css?('.flash-message.success')
47
+ end
48
+ end
49
+
50
+ def open_form
51
+ browser.visit '/'
52
+ browser.click_on "show-#{product_name}-configure-action"
53
+ browser.click_on "show-#{form_name}-action"
54
+ end
55
+
56
+ private
57
+
58
+ attr_reader :browser, :product_name, :form_name
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,38 @@
1
+ require 'date'
2
+
3
+ module OpsManagerUiDrivers
4
+ module Version17
5
+ class ProductLogs
6
+ def initialize(browser:, product_name:)
7
+ @browser = browser
8
+ @product_name = product_name
9
+ end
10
+
11
+ def request_job_logs(job_name)
12
+ browser.visit('/')
13
+ browser.click_on("show-#{product_name}-configure-action")
14
+ browser.click_on('show-status-action')
15
+ browser.find(%Q(a[id^="download-#{job_name}-"][id$="-0-log-action"])).click
16
+ end
17
+
18
+ def most_recent_log_creation_time
19
+ browser.visit('/')
20
+ browser.click_on("show-#{product_name}-configure-action")
21
+ browser.click_on('show-logs-action')
22
+
23
+ log_row = browser.all('#downloaded_logs tr').
24
+ select { |e| e.find(%Q(a[href^="/products/#{product_name}"])) }.
25
+ last
26
+
27
+ return unless log_row
28
+
29
+ date_string = log_row.all('td').last.text
30
+ DateTime.parse(date_string)
31
+ end
32
+
33
+ private
34
+
35
+ attr_reader :product_name, :browser
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,69 @@
1
+ module OpsManagerUiDrivers
2
+ module Version17
3
+ class ProductResourceConfiguration
4
+ attr_reader :product_name
5
+
6
+ def initialize(browser:, product_name:)
7
+ @browser = browser
8
+ @product_name = product_name
9
+ end
10
+
11
+ def set_instances_for_job(job_name, instance_count)
12
+ open_form
13
+ browser.find_field("product_resources_form[#{job_name}][instances][value]").set(instance_count)
14
+ save_form
15
+ end
16
+
17
+ def set_instance_type_for_job(job_name, instance_type)
18
+ open_form
19
+ browser.
20
+ find("select[name='product_resources_form[#{job_name}][instance_type_id]']").
21
+ find("option[value='#{instance_type}']").
22
+ select_option
23
+ save_form
24
+ end
25
+
26
+ def set_elb_names_for_job(job_name, comma_delimited_elb_names)
27
+ open_form
28
+ browser.find_field("product_resources_form[#{job_name}][elb_names]").set(comma_delimited_elb_names)
29
+ save_form
30
+ end
31
+
32
+ def set_floating_ips_for_job(job_name, comma_delimited_floating_ips)
33
+ open_form
34
+ browser.find_field("product_resources_form[#{job_name}][floating_ips]").set(comma_delimited_floating_ips)
35
+ save_form
36
+ end
37
+
38
+ def set_resources_for_jobs(resources_by_job, validate: true)
39
+ open_form
40
+ resources_by_job.each do |job, resources|
41
+ resources.each do |resource_or_instance, value|
42
+ browser.fill_in("product_resources_form[#{job}][#{resource_or_instance}][value]", with: value)
43
+ end
44
+ end
45
+ save_form(validate: validate)
46
+ end
47
+
48
+ private
49
+
50
+ attr_reader :browser
51
+
52
+ def open_form
53
+ browser.visit '/'
54
+ browser.click_on "show-#{product_name}-configure-action"
55
+ browser.click_on "show-#{product_name}-resource-sizes-action"
56
+ end
57
+
58
+ def save_form(validate: true)
59
+ browser.click_on 'Save'
60
+
61
+ fail('unexpected failure') unless browser.has_css?('.flash-message')
62
+
63
+ if validate
64
+ fail(browser.find('.flash-message.error').text) unless browser.has_css?('.flash-message.success')
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,64 @@
1
+ module OpsManagerUiDrivers
2
+ module Version17
3
+ class ProductStatusHelper
4
+ def initialize(product_name:, browser:)
5
+ @product_name = product_name
6
+ @browser = browser
7
+ end
8
+
9
+ def job_status(job_name)
10
+ open_page
11
+
12
+ wait_for_loading_indicator_to_disappear
13
+
14
+ browser.within "##{product_name}-status" do
15
+ job_row = browser.find(:xpath, ".//tr[@data-ip-name = '#{job_name}']")
16
+
17
+ Version17::JobStatusHelper.from_job_row(job_row)
18
+ end
19
+ end
20
+
21
+ def job_status_in_az(job_name, az_guid)
22
+ open_page
23
+
24
+ wait_for_loading_indicator_to_disappear
25
+
26
+ browser.within "##{product_name}-#{az_guid}-status-table" do
27
+ job_row = browser.find(:xpath, ".//tr[@data-ip-name = '#{job_name}']")
28
+
29
+ Version17::JobStatusHelper.from_job_row(job_row)
30
+ end
31
+ end
32
+
33
+ def resource_pool_for_job_in_az(job_name, az_guid, vsphere_connection)
34
+ job_status = job_status_in_az("#{job_name}-partition-#{az_guid}", az_guid)
35
+
36
+ job_ip = job_status.ips.fetch(0)
37
+
38
+ vm = vsphere_connection.searchIndex.FindByIp(ip: job_ip, vmSearch: true)
39
+ vm.resourcePool.name
40
+ end
41
+
42
+ private
43
+
44
+ attr_reader :browser, :product_name
45
+
46
+ def open_page
47
+ browser.visit '/'
48
+
49
+ browser.click_on "show-#{dasherized_product_name}-configure-action"
50
+ browser.click_on 'show-status-action'
51
+ end
52
+
53
+ def wait_for_loading_indicator_to_disappear
54
+ Capybara.using_wait_time 20 do
55
+ browser.all('.status-loading', count: 0) # blocks until there are no spinners
56
+ end
57
+ end
58
+
59
+ def dasherized_product_name
60
+ product_name.to_s.gsub(/[_]/, '-')
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,136 @@
1
+ module OpsManagerUiDrivers
2
+ module Version17
3
+ module Settings
4
+ def self.for(test_settings)
5
+ settings_class = [Vcloud, Vsphere, AWS, OpenStack].find do |klass|
6
+ klass.works_with?(test_settings.iaas_type)
7
+ end or raise("Unsupported IaaS: #{test_settings.iaas_type.inspect}")
8
+ settings_class.new(test_settings)
9
+ end
10
+
11
+ class Vcloud
12
+ def self.works_with?(iaas_type)
13
+ iaas_type == 'vcloud'
14
+ end
15
+
16
+ def initialize(test_settings)
17
+ @test_settings = test_settings
18
+ end
19
+
20
+ def iaas_configuration_fields
21
+ {
22
+ 'vcd_url' => test_settings.ops_manager.vcloud.creds.url,
23
+ 'organization' => test_settings.ops_manager.vcloud.creds.organization,
24
+ 'vcd_username' => test_settings.ops_manager.vcloud.creds.user,
25
+ 'vcd_password' => test_settings.ops_manager.vcloud.creds.password,
26
+ 'datacenter' => test_settings.ops_manager.vcloud.vdc.name,
27
+ 'storage_profile' => test_settings.ops_manager.vcloud.vdc.storage_profile,
28
+ 'catalog_name' => test_settings.ops_manager.vcloud.vdc.catalog_name,
29
+ }
30
+ end
31
+
32
+ def advanced_infrastructure_config_fields
33
+ { }
34
+ end
35
+
36
+ private
37
+
38
+ attr_reader :test_settings
39
+ end
40
+
41
+ class Vsphere
42
+ def self.works_with?(iaas_type)
43
+ iaas_type == 'vsphere'
44
+ end
45
+
46
+ def initialize(test_settings)
47
+ @test_settings = test_settings
48
+ end
49
+
50
+ def iaas_configuration_fields
51
+ {
52
+ 'vcenter_ip' => test_settings.ops_manager.vcenter.creds.ip,
53
+ 'vcenter_username' => test_settings.ops_manager.vcenter.creds.username,
54
+ 'vcenter_password' => test_settings.ops_manager.vcenter.creds.password,
55
+ 'datacenter' => test_settings.ops_manager.vcenter.datacenter,
56
+ 'datastores_string' => test_settings.ops_manager.vcenter.datastore,
57
+ 'bosh_vm_folder' => test_settings.ops_manager.vcenter.bosh_vm_folder,
58
+ 'bosh_template_folder' => test_settings.ops_manager.vcenter.bosh_template_folder,
59
+ 'bosh_disk_path' => test_settings.ops_manager.vcenter.bosh_disk_path,
60
+ }
61
+ end
62
+
63
+ def advanced_infrastructure_config_fields
64
+ { }
65
+ end
66
+
67
+ private
68
+
69
+ attr_reader :test_settings
70
+ end
71
+
72
+ class AWS
73
+ def self.works_with?(iaas_type)
74
+ iaas_type == 'aws'
75
+ end
76
+
77
+ def initialize(test_settings)
78
+ @test_settings = test_settings
79
+ end
80
+
81
+ def iaas_configuration_fields
82
+ {
83
+ 'access_key_id' => test_settings.ops_manager.aws.aws_access_key,
84
+ 'secret_access_key' => test_settings.ops_manager.aws.aws_secret_key,
85
+ 'vpc_id' => test_settings.ops_manager.aws.vpc_id,
86
+ 'security_group' => test_settings.ops_manager.aws.security_group,
87
+ 'key_pair_name' => test_settings.ops_manager.aws.key_pair_name,
88
+ 'ssh_private_key' => test_settings.ops_manager.aws.ssh_key,
89
+ 'region' => test_settings.ops_manager.aws.region,
90
+ 'encrypted' => test_settings.ops_manager.aws.encrypt_disk,
91
+ }
92
+ end
93
+
94
+ def advanced_infrastructure_config_fields
95
+ { }
96
+ end
97
+
98
+ private
99
+
100
+ attr_reader :test_settings
101
+ end
102
+
103
+ class OpenStack
104
+ def self.works_with?(iaas_type)
105
+ iaas_type == 'openstack'
106
+ end
107
+
108
+ def initialize(test_settings)
109
+ @test_settings = test_settings
110
+ end
111
+
112
+ def iaas_configuration_fields
113
+ {
114
+ 'identity_endpoint' => test_settings.ops_manager.openstack.identity_endpoint,
115
+ 'username' => test_settings.ops_manager.openstack.username,
116
+ 'password' => test_settings.ops_manager.openstack.password,
117
+ 'tenant' => test_settings.ops_manager.openstack.tenant,
118
+ 'security_group' => test_settings.ops_manager.openstack.security_group_name,
119
+ 'key_pair_name' => test_settings.ops_manager.openstack.key_pair_name,
120
+ 'ssh_private_key' => test_settings.ops_manager.openstack.ssh_private_key,
121
+ 'region' => test_settings.ops_manager.openstack.region,
122
+ 'disable_dhcp' => test_settings.ops_manager.openstack.disable_dhcp,
123
+ }
124
+ end
125
+
126
+ def advanced_infrastructure_config_fields
127
+ { 'connection_options' => test_settings.ops_manager.openstack.connection_options }
128
+ end
129
+
130
+ private
131
+
132
+ attr_reader :test_settings
133
+ end
134
+ end
135
+ end
136
+ end
@@ -0,0 +1,44 @@
1
+ module OpsManagerUiDrivers
2
+ module Version17
3
+ class Setup
4
+ def initialize(browser: nil)
5
+ @browser = browser
6
+ end
7
+
8
+ def setup_and_login(user:, password:)
9
+ browser.visit '/setup'
10
+ browser.fill_in 'setup[user_name]', with: user
11
+ browser.fill_in 'setup[password]', with: password
12
+ browser.fill_in 'setup[password_confirmation]', with: password
13
+ browser.check 'setup_eula_accepted'
14
+ browser.click_on 'create-setup-action'
15
+ end
16
+
17
+ def login(user: nil, password: nil)
18
+ browser.visit '/login'
19
+ browser.fill_in 'login[user_name]', with: user
20
+ browser.fill_in 'login[password]', with: password
21
+ browser.click_on 'login-action'
22
+
23
+ unless browser.first('#main-page-marker')
24
+ fail RuntimeError.new("failed to log in as #{user}/#{password}.")
25
+ end
26
+ end
27
+
28
+ def setup_or_login(user:, password:)
29
+ browser.visit '/'
30
+
31
+ if browser.current_path == '/setup'
32
+ setup_and_login(user: user, password: password)
33
+ elsif browser.current_path == '/login'
34
+ login(user: user, password: password)
35
+ end
36
+ end
37
+
38
+ private
39
+
40
+ attr_reader :browser
41
+
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,43 @@
1
+ module OpsManagerUiDrivers
2
+ module Version17
3
+ class StateChangeProgress
4
+ def initialize(browser:)
5
+ @browser = browser
6
+ end
7
+
8
+ def state_change_success?
9
+ open_install_progress
10
+ browser.all('#install-success-modal').any?
11
+ end
12
+
13
+ def errand_ran?(errand_name)
14
+ open_install_progress
15
+ browser.find('#install-output .output', visible: false).text(:all).
16
+ include?("Errand `#{errand_name}' completed successfully (exit code 0)")
17
+ end
18
+
19
+ def errand_ran_with_text?(errand_name)
20
+ {
21
+ errand_ran: errand_ran?(errand_name),
22
+ output: browser.find('#install-output .output', {visible: false}).text(:all),
23
+ }
24
+ end
25
+
26
+ private
27
+
28
+ def open_install_progress
29
+ browser.visit '/install' unless install_progress_open?
30
+ browser.fail_early('Install probably aborted immediately') unless install_progress_open?
31
+ browser.fail_early('Install failed') if browser.all('#install-failure-modal').any?
32
+ end
33
+
34
+ def install_progress_open?
35
+ browser.current_path =~ %r(^/+install)
36
+ end
37
+
38
+ private
39
+
40
+ attr_reader :browser
41
+ end
42
+ end
43
+ end