ops_manager_ui_drivers 0.16.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6bf20a7d109f80bf1f4c61d27a6da4f17dc2455a
4
- data.tar.gz: 940c542049732a6ede808f2f723d82c9cd95c036
3
+ metadata.gz: 6077d80e46eb38cff09d0120cb6867e8490e3c04
4
+ data.tar.gz: c5adbba698bf03de4747fe69aec4585c29686e74
5
5
  SHA512:
6
- metadata.gz: f2b5bee78c07b7ba79a54c7402f97a4924d221778524b60a5bc47155d5e7352fec5902ecde961b20cf7d0df657952e51b357ba11aaf2f2803c902db2a7bb4625
7
- data.tar.gz: 48406a0ae98d901464d1d287cc331c5fbe7ec78232516dc1de4252340031cbdc1b7629e3d2f44c863ca8760c59baf463194e2cc7355aa16233a85fa766cd9d78
6
+ metadata.gz: 8865b18eb9a16aa2836d1779ebd7681fdd7b88183bfe8b5c2941b0ff906715851eacb11787bfdbd2cc5503b2df62bc1644866a214e5002969691c6de63f9b030
7
+ data.tar.gz: af1010289135d4597d20b3450efc937d47394927e44e98a18735d76f19187e293bd97ec024d4fb500df949186fd239aa9b61a4d0ff68208a526fb4435dc40b8b
@@ -4,10 +4,6 @@ module OpsManagerUiDrivers
4
4
  module PageHelpers
5
5
  include OpsManagerUiDrivers::WaitHelper
6
6
 
7
- def om_1_3(ops_manager_url)
8
- @om_1_3 ||= create_web_ui(ops_manager_url, Version13)
9
- end
10
-
11
7
  def om_1_4(ops_manager_url)
12
8
  @om_1_4 ||= create_web_ui(ops_manager_url, Version14)
13
9
  end
@@ -20,10 +16,6 @@ module OpsManagerUiDrivers
20
16
  @om_1_6 ||= create_web_ui(ops_manager_url, Version16)
21
17
  end
22
18
 
23
- def api_1_3(host:, username:, password:)
24
- Version13::Api.new(host: host, user: username, password: password)
25
- end
26
-
27
19
  def api_1_4(host:, username:, password:)
28
20
  Version14::Api.new(host: host, user: username, password: password)
29
21
  end
@@ -1,3 +1,3 @@
1
1
  module OpsManagerUiDrivers
2
- VERSION = '0.16.0'
2
+ VERSION = '1.0.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ops_manager_ui_drivers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pivotal, Inc.
@@ -156,23 +156,6 @@ files:
156
156
  - lib/ops_manager_ui_drivers.rb
157
157
  - lib/ops_manager_ui_drivers/page_helpers.rb
158
158
  - lib/ops_manager_ui_drivers/version.rb
159
- - lib/ops_manager_ui_drivers/version13/api_1_3.rb
160
- - lib/ops_manager_ui_drivers/version13/availability_zones.rb
161
- - lib/ops_manager_ui_drivers/version13/available_products.rb
162
- - lib/ops_manager_ui_drivers/version13/iaas_configuration.rb
163
- - lib/ops_manager_ui_drivers/version13/install_progress.rb
164
- - lib/ops_manager_ui_drivers/version13/job_availability_zone_mapping_helper.rb
165
- - lib/ops_manager_ui_drivers/version13/job_network_mapping_helper.rb
166
- - lib/ops_manager_ui_drivers/version13/job_status_helper.rb
167
- - lib/ops_manager_ui_drivers/version13/networks.rb
168
- - lib/ops_manager_ui_drivers/version13/ops_manager_director.rb
169
- - lib/ops_manager_ui_drivers/version13/product_availability_zones.rb
170
- - lib/ops_manager_ui_drivers/version13/product_dashboard.rb
171
- - lib/ops_manager_ui_drivers/version13/product_logs.rb
172
- - lib/ops_manager_ui_drivers/version13/product_resource_configuration.rb
173
- - lib/ops_manager_ui_drivers/version13/product_status_helper.rb
174
- - lib/ops_manager_ui_drivers/version13/setup.rb
175
- - lib/ops_manager_ui_drivers/version13/web_ui.rb
176
159
  - lib/ops_manager_ui_drivers/version14/api_1_4.rb
177
160
  - lib/ops_manager_ui_drivers/version14/availability_zones.rb
178
161
  - lib/ops_manager_ui_drivers/version14/available_products.rb
@@ -1,40 +0,0 @@
1
- require 'net/https'
2
-
3
- module OpsManagerUiDrivers
4
- module Version13
5
- class Api
6
- def initialize(host: nil, user: nil, password: nil)
7
- @host = host
8
- @user = user
9
- @password = password
10
- end
11
-
12
- def export_installation
13
- response = http.request(get('installation_asset_collection'))
14
-
15
- Tempfile.new('installation.zip').tap do |tempfile|
16
- tempfile.write(response.body)
17
- tempfile.close
18
- end
19
- end
20
-
21
- private
22
-
23
- def http
24
- uri = URI(@host)
25
- Net::HTTP.new(uri.host, uri.port).tap do |http|
26
- http.use_ssl = true
27
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
28
- http.read_timeout = 1800
29
- end
30
- end
31
-
32
- def get(endpoint)
33
- uri = URI("#{@host}/api/#{endpoint}")
34
- Net::HTTP::Get.new(uri.request_uri).tap do |get|
35
- get.basic_auth(@user, @password)
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,55 +0,0 @@
1
- module OpsManagerUiDrivers
2
- module Version13
3
- class AvailabilityZones
4
- def initialize(browser:, product:)
5
- @browser = browser
6
- @product = product
7
- end
8
-
9
- def add_az(name, cluster, resource_pool)
10
- open_form('availability_zones')
11
-
12
- browser.click_on 'Add'
13
- set_fields(
14
- fields: {
15
- 'name' => name,
16
- 'cluster' => cluster,
17
- 'resource_pool' => resource_pool,
18
- }
19
- )
20
- save_form
21
- end
22
-
23
- private
24
- attr_reader(
25
- :browser,
26
- :product,
27
- )
28
-
29
- def save_form
30
- browser.click_on 'Save'
31
- browser.expect(browser.page).to browser.have_css('.flash-message.success')
32
- end
33
-
34
- def open_form(form)
35
- browser.visit '/'
36
- browser.click_on "show-#{product}-configure-action"
37
- browser.click_on "show-#{form}-action"
38
- end
39
-
40
- def set_fields(fields:)
41
- fields.each do |field, value|
42
- set_field(field, value)
43
- end
44
- end
45
-
46
- def set_field(field, value)
47
- last_field(field).set(value)
48
- end
49
-
50
- def last_field(field)
51
- browser.all(:field, "availability_zones[availability_zones][][#{field}]").last
52
- end
53
- end
54
- end
55
- end
@@ -1,25 +0,0 @@
1
- module OpsManagerUiDrivers
2
- module Version13
3
- class AvailableProducts
4
- def initialize(browser:)
5
- @browser = browser
6
- end
7
-
8
- def add_product_to_install(product_name)
9
- browser.visit '/'
10
- browser.click_on "add-#{product_name}"
11
- browser.find("#show-#{product_name}-configure-action", wait: 10)
12
- end
13
-
14
- def product_added?(product_name)
15
- browser.visit '/'
16
- browser.all("#show-#{product_name}-configure-action").any?
17
- end
18
-
19
- private
20
-
21
- attr_reader :browser
22
-
23
- end
24
- end
25
- end
@@ -1,65 +0,0 @@
1
- module OpsManagerUiDrivers
2
- module Version13
3
- class IaasConfiguration
4
- def initialize(browser:, product:)
5
- @browser = browser
6
- @product = product
7
- end
8
-
9
- def configure_iaas
10
- open_form('iaas_configuration')
11
-
12
- yield
13
-
14
- save_form
15
- end
16
-
17
- def set_vsphere_credentials(vcenter_ip:, username:, password:)
18
- set_field('vcenter_ip', vcenter_ip)
19
- set_field('vcenter_username', username)
20
- set_field('vcenter_password', password)
21
- end
22
-
23
- def set_vcloud_credentials(vcd_url:, organization:, user:, password:)
24
- set_field('vcd_url', vcd_url)
25
- set_field('organization', organization)
26
- set_field('vcd_username', user)
27
- set_field('vcd_password', password)
28
- end
29
-
30
-
31
- def set_datacenter(datacenter)
32
- set_field('datacenter', datacenter)
33
- end
34
-
35
- def set_datastores(datastores)
36
- set_field('datastores_string', datastores)
37
- end
38
-
39
- def set_storage_profile(storage_profile)
40
- set_field('storage_profile', storage_profile)
41
- end
42
-
43
- private
44
- attr_reader(
45
- :browser,
46
- :product,
47
- )
48
-
49
- def save_form
50
- browser.click_on 'Save'
51
- browser.expect(browser.page).to browser.have_css('.flash-message.success')
52
- end
53
-
54
- def open_form(form)
55
- browser.visit '/'
56
- browser.click_on "show-#{product}-configure-action"
57
- browser.click_on "show-#{form}-action"
58
- end
59
-
60
- def set_field(field, value)
61
- browser.find_field("iaas_configuration[#{field}]").set(value)
62
- end
63
- end
64
- end
65
- end
@@ -1,43 +0,0 @@
1
- module OpsManagerUiDrivers
2
- module Version13
3
- class InstallProgress
4
- def initialize(browser:)
5
- @browser = browser
6
- end
7
-
8
- def install_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 == '/install'
36
- end
37
-
38
- private
39
-
40
- attr_reader :browser
41
- end
42
- end
43
- end
@@ -1,70 +0,0 @@
1
- module OpsManagerUiDrivers
2
- module Version13
3
- class JobAvailabilityZoneMappingHelper
4
- def initialize(product_name: nil, browser: nil)
5
- @product_name = product_name
6
- @browser = browser
7
- end
8
-
9
- SINGLETON_AVAILABILITY_ZONE_INPUT_SELECTOR = "input[name='product[singleton_availability_zone_reference]']"
10
- AVAILABILITY_ZONE_INPUT_SELECTOR = "input[name='product[availability_zone_references][]']"
11
-
12
- def assign_availability_zones!(singleton_availability_zone:, availability_zones:)
13
- open_form
14
-
15
- browser.all(AVAILABILITY_ZONE_INPUT_SELECTOR).each do |checkbox|
16
- checkbox.set(false)
17
- end
18
-
19
- availability_zones.each do |az_name|
20
- browser.check("#{az_name}")
21
- end
22
-
23
- browser.choose("#{singleton_availability_zone}")
24
-
25
- save_form
26
- end
27
-
28
- def singleton_availability_zone
29
- open_form
30
-
31
- selected_options = browser.all("#{SINGLETON_AVAILABILITY_ZONE_INPUT_SELECTOR}[selected='selected']").map do |radio|
32
- browser.find("label[for='#{radio[:id]}']").text
33
- end
34
-
35
- raise ArgumentError, 'availability_zone not selected' if selected_options.empty?
36
- selected_options.first
37
- end
38
-
39
- def availability_zones
40
- open_form
41
-
42
- browser.all("#{AVAILABILITY_ZONE_INPUT_SELECTOR}[checked='checked']").map do |checkbox|
43
- browser.find("label[for='#{checkbox[:id]}']").text
44
- end
45
- end
46
-
47
- private
48
-
49
- attr_reader :browser, :product_name
50
-
51
- def open_form
52
- browser.visit '/'
53
- browser.click_on "show-#{product_name}-configure-action"
54
- browser.click_on "show-#{product_name}-job-availability-zone-assignment-action"
55
- end
56
-
57
- def save_form
58
- browser.click_on 'Save'
59
-
60
- unless browser.has_css?('.flash-message.success')
61
- if browser.has_css?('.flash-message.error')
62
- raise browser.find('.flash-message.error').text
63
- else
64
- raise 'unexpected failure'
65
- end
66
- end
67
- end
68
- end
69
- end
70
- end
@@ -1,47 +0,0 @@
1
- module OpsManagerUiDrivers
2
- module Version13
3
- class JobNetworkMappingHelper
4
- PRODUCT_NETWORK_FIELD_NAME = 'product_network_assignment'
5
-
6
- def initialize(product_name:, browser:)
7
- @product_name = product_name
8
- @browser = browser
9
- end
10
-
11
- def assign_product_to_network(network)
12
- open_form
13
- browser.find_field(PRODUCT_NETWORK_FIELD_NAME).find(:option, text: network).select_option
14
- save_form
15
- end
16
-
17
- def product_network
18
- open_form
19
- selected_options = browser.find_field(PRODUCT_NETWORK_FIELD_NAME).all('option[selected]')
20
- raise ArgumentError, "#{PRODUCT_NETWORK_FIELD_NAME} not selected" if selected_options.empty?
21
- selected_options.first.text
22
- end
23
-
24
- private
25
-
26
- attr_reader :product_name, :browser
27
-
28
- def open_form
29
- browser.visit '/'
30
- browser.click_on "show-#{product_name}-configure-action"
31
- browser.click_on "show-#{product_name}-job-network-assignment-action"
32
- end
33
-
34
- def save_form
35
- browser.click_on 'Save'
36
-
37
- unless browser.has_css?('.flash-message.success')
38
- if browser.has_css?('.flash-message.error')
39
- raise browser.find('.flash-message.error').text
40
- else
41
- raise 'unexpected failure'
42
- end
43
- end
44
- end
45
- end
46
- end
47
- end
@@ -1,17 +0,0 @@
1
- module OpsManagerUiDrivers
2
- module Version13
3
- class JobStatusHelper
4
- def self.from_job_row(job_row)
5
- ips_string = job_row.find('.actual-ips').text
6
- ips = ips_string.split(', ')
7
- new(ips: ips)
8
- end
9
-
10
- def initialize(ips:)
11
- @ips = ips
12
- end
13
-
14
- attr_reader :ips
15
- end
16
- end
17
- end
@@ -1,83 +0,0 @@
1
- module OpsManagerUiDrivers
2
- module Version13
3
- class Networks
4
- def initialize(browser:, product:)
5
- @browser = browser
6
- @product = product
7
-
8
- @allowed_ignorable_errors = []
9
- end
10
-
11
- def add_network(name:, iaas_network_identifier:, subnet:, dns:, gateway:, reserved_ip_ranges:)
12
- open_form('network')
13
-
14
- browser.click_on 'Add'
15
- set_fields(
16
- fields: {
17
- 'name' => name,
18
- 'iaas_network_identifier' => iaas_network_identifier,
19
- 'subnet' => subnet,
20
- 'dns' => dns,
21
- 'gateway' => gateway,
22
- 'reserved_ip_ranges' => reserved_ip_ranges,
23
- }
24
- )
25
-
26
- allow_network_not_found_errors
27
- save_form
28
- end
29
-
30
- private
31
-
32
- attr_reader :browser, :product
33
-
34
- def allow_network_not_found_errors
35
- network_not_found = /not found in datacenter/
36
- return if @allowed_ignorable_errors.include?(network_not_found)
37
-
38
- @allowed_ignorable_errors << network_not_found
39
- end
40
-
41
- def expect_allowed_ignorable_errors
42
- flash_errors = browser.all('.flash-message.error')
43
-
44
- if flash_errors.any?
45
- unexpected_errors = flash_errors.reject do |error|
46
- @allowed_ignorable_errors.select do |expected_error|
47
- error.text =~ expected_error
48
- end.any?
49
- end
50
-
51
- fail "Unexepcted ignorable errors: #{unexpected_errors.map(&:text).inspect}" unless unexpected_errors.empty?
52
- else
53
- browser.expect(browser.page).to browser.have_css('.flash-message.success')
54
- end
55
- end
56
-
57
- def save_form
58
- browser.click_on 'Save'
59
- expect_allowed_ignorable_errors
60
- end
61
-
62
- def open_form(form)
63
- browser.visit '/'
64
- browser.click_on "show-#{product}-configure-action"
65
- browser.click_on "show-#{form}-action"
66
- end
67
-
68
- def set_fields(fields:)
69
- fields.each do |field, value|
70
- set_field(field, value)
71
- end
72
- end
73
-
74
- def set_field(field, value)
75
- last_field(field).set(value)
76
- end
77
-
78
- def last_field(field)
79
- browser.all(:field, "network[networks][][#{field}]").last
80
- end
81
- end
82
- end
83
- end
@@ -1,140 +0,0 @@
1
- module OpsManagerUiDrivers
2
- module Version13
3
- class OpsManagerDirector
4
- def initialize(browser:)
5
- @browser = browser
6
- end
7
-
8
- def configure_microbosh(test_settings)
9
- @product = test_settings.persistent_ops_manager.v13.microbosh_product_name
10
-
11
- configure_iaas(test_settings)
12
-
13
- config_director(ntp_servers: test_settings.ops_manager.ntp_servers)
14
-
15
- add_azs(test_settings.ops_manager.availability_zones)
16
-
17
- assign_availability_zone(test_settings.ops_manager.availability_zones)
18
-
19
- add_networks(test_settings.ops_manager.networks)
20
-
21
- assign_networks(test_settings.ops_manager)
22
- end
23
-
24
- private
25
- attr_reader :browser
26
-
27
- def product
28
- @product || 'microbosh'
29
- end
30
-
31
- def configure_iaas(test_settings)
32
- case test_settings.iaas_type
33
- when OpsManagerUiDrivers::VCLOUD_IAAS_TYPE then
34
- configure_vcloud(
35
- vcd_url: test_settings.ops_manager.vcloud.creds.url,
36
- organization: test_settings.ops_manager.vcloud.creds.organization,
37
- user: test_settings.ops_manager.vcloud.creds.user,
38
- password: test_settings.ops_manager.vcloud.creds.password,
39
- datacenter: test_settings.ops_manager.vcloud.vdc.name,
40
- storage_profile: test_settings.ops_manager.vcloud.vdc.storage_profile,
41
- )
42
- when OpsManagerUiDrivers::VSPHERE_IAAS_TYPE then
43
- configure_vcenter(
44
- ip: test_settings.ops_manager.vcenter.creds.ip,
45
- username: test_settings.ops_manager.vcenter.creds.username,
46
- password: test_settings.ops_manager.vcenter.creds.password,
47
- datacenter: test_settings.ops_manager.vcenter.datacenter,
48
- datastores: test_settings.ops_manager.vcenter.datastore,
49
- )
50
- end
51
- end
52
-
53
- def add_azs(iaas_availability_zones)
54
- iaas_availability_zones && iaas_availability_zones.each do |az|
55
- availability_zones.add_az(az['name'], az['cluster'], az['resource_pool'])
56
- end
57
- end
58
-
59
- def add_networks(iaas_networks)
60
- iaas_networks && iaas_networks.each do |network|
61
- networks.add_network(
62
- name: network['name'],
63
- iaas_network_identifier: network['identifier'],
64
- subnet: network['subnet'],
65
- dns: network['dns'],
66
- gateway: network['gateway'],
67
- reserved_ip_ranges: network['reserved_ips'],
68
- )
69
- end
70
- end
71
-
72
- def config_director(ntp_servers:)
73
- browser.click_on 'Director Config'
74
- browser.fill_in('director_configuration[ntp_servers_string]', with: ntp_servers)
75
- browser.click_on 'Save'
76
- end
77
-
78
- def assign_availability_zone(iaas_availability_zones)
79
- if iaas_availability_zones
80
- browser.click_on 'Assign Availability Zones'
81
- browser.select(iaas_availability_zones.first['name'])
82
- browser.click_on 'Save'
83
- end
84
- end
85
-
86
- def assign_networks(ops_manager)
87
- deployment_network = ops_manager.networks[0]
88
-
89
- infrastructure_network =
90
- ops_manager.networks[1] ? ops_manager.networks[1] : ops_manager.networks[0]
91
-
92
- assign_networks_on_browser(
93
- infrastructure_network: infrastructure_network['name'],
94
- deployment_network: deployment_network['name'],
95
- )
96
- end
97
-
98
- def assign_networks_on_browser(infrastructure_network:, deployment_network:)
99
- browser.click_on 'Assign Networks'
100
-
101
- browser.within browser.find '#director_network_assignments_infrastructure_network' do
102
- browser.select infrastructure_network
103
- end
104
-
105
- browser.within browser.find '#director_network_assignments_deployment_network' do
106
- browser.select deployment_network
107
- end
108
- browser.click_on 'Save'
109
- end
110
-
111
- def configure_vcenter(ip:, username:, password:, datacenter:, datastores:)
112
- iaas_configuration.configure_iaas do
113
- iaas_configuration.set_vsphere_credentials(vcenter_ip: ip, username: username, password: password)
114
- iaas_configuration.set_datacenter(datacenter)
115
- iaas_configuration.set_datastores(datastores)
116
- end
117
- end
118
-
119
- def configure_vcloud(vcd_url:, organization:, user:, password:, datacenter:, storage_profile:)
120
- iaas_configuration.configure_iaas do
121
- iaas_configuration.set_vcloud_credentials(vcd_url: vcd_url, organization: organization, user: user, password: password)
122
- iaas_configuration.set_datacenter(datacenter)
123
- iaas_configuration.set_storage_profile(storage_profile)
124
- end
125
- end
126
-
127
- def iaas_configuration
128
- @iaas_configuration ||= Version13::IaasConfiguration.new(browser: browser, product: product)
129
- end
130
-
131
- def availability_zones
132
- @availability_zones ||= Version13::AvailabilityZones.new(browser: browser, product: product)
133
- end
134
-
135
- def networks
136
- @networks ||= Version13::Networks.new(browser: browser, product: product)
137
- end
138
- end
139
- end
140
- end
@@ -1,38 +0,0 @@
1
- module OpsManagerUiDrivers
2
- module Version13
3
- class WebUi
4
- class ProductAvailabilityZones
5
- def initialize(browser:, product:)
6
- @browser = browser
7
- @product = product
8
- end
9
-
10
- def assign_availability_zones(singleton_availability_zone:, availability_zones:)
11
- open_form
12
- browser.choose(singleton_availability_zone)
13
- # we don't change the assignments in clean install yet,
14
- # otherwise we'd want to clear them out first
15
- availability_zones.each do |az_name|
16
- browser.check(az_name)
17
- end
18
- save_form
19
- end
20
-
21
- private
22
- attr_reader :browser, :product
23
-
24
- def open_form
25
- browser.visit '/'
26
- browser.click_on "show-#{product}-configure-action"
27
- browser.click_on "show-#{product}-job-availability-zone-assignment-action"
28
- end
29
-
30
- def save_form
31
- browser.click_on 'Save'
32
-
33
- browser.expect(browser.page).to browser.have_css('.flash-message.success')
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,157 +0,0 @@
1
- module OpsManagerUiDrivers
2
- module Version13
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
-
16
- ignore_allowable_errors
17
- assert_installation_started
18
- end
19
-
20
- def import_installation_file(file_path)
21
- open_dashboard
22
- browser.click_on 'toggle-installation-dropdown-action'
23
- browser.click_on 'show-import-backup'
24
- browser.attach_file 'import[file]', file_path
25
- browser.click_on 'import-backup'
26
- end
27
-
28
- def upgrade_microbosh
29
- open_dashboard
30
- browser.find('p', text: 'Ops Manager Director').trigger(:mouseover)
31
- browser.click_on 'upgrade-microbosh'
32
- end
33
-
34
- def delete_product(product_name)
35
- open_dashboard
36
- browser.click_on "open-delete-#{product_name}-modal"
37
- wait_for_modal_css_transition_to_complete
38
- browser.click_on "delete-#{product_name}-action"
39
- end
40
-
41
- def import_product_from(full_path)
42
- open_dashboard
43
- browser.attach_file('component_add[file]', full_path, {visible: false})
44
- end
45
-
46
- def product_available?(product_name, product_version)
47
- open_dashboard
48
- browser.all("li.#{product_name} input#component_version[value='#{product_version}']", {visible: false}).any?
49
- end
50
-
51
- def upgrade_product(product_name)
52
- open_dashboard
53
- browser.find(".product.#{product_name} p").trigger(:mouseover)
54
- browser.click_on "upgrade-#{product_name}"
55
- expect_no_flash_errors
56
- end
57
-
58
- def version_for_product(product_name)
59
- open_dashboard
60
- browser.find("#show-#{product_name}-configure-action .version").text
61
- end
62
-
63
- def delete_whole_installation
64
- open_dashboard
65
- browser.click_on 'toggle-installation-dropdown-action'
66
- browser.click_on 'show-delete-installation-modal-action'
67
- wait_for_modal_css_transition_to_complete
68
- browser.click_on 'delete-installation-action'
69
- end
70
-
71
- def delete_installation_available?
72
- open_dashboard
73
- browser.click_on 'toggle-installation-dropdown-action'
74
- browser.all('#show-delete-installation-modal-action').any?
75
- end
76
-
77
- def deletion_in_progress?
78
- open_dashboard
79
- browser.all('#delete-in-progress-marker').any?
80
- end
81
-
82
- def reset_state
83
- revert_pending_changes if revert_available?
84
- delete_whole_installation if delete_installation_available?
85
- end
86
-
87
- def revert_pending_changes
88
- open_dashboard
89
- browser.click_on 'open-revert-installation-modal-action'
90
- wait_for_modal_css_transition_to_complete
91
- browser.click_on 'revert-installation-action'
92
- end
93
-
94
- def revert_available?
95
- browser.all('#open-revert-installation-modal-action').any?
96
- end
97
-
98
- private
99
-
100
- attr_reader :browser
101
-
102
- def assert_installation_started
103
- browser.expect(browser.page).to browser.have_text('Installation in Progress')
104
- end
105
-
106
- def nonignorable_verification_failed?
107
- browser.all('.flash-message.error').any? && browser.all('#ignore-install-action').empty?
108
- end
109
-
110
- def allow_cpu_verification_errors
111
- cpu_verification_regex = /Installation requires \d+ CPU cores/
112
- return if @allowed_ignorable_errors.include?(cpu_verification_regex)
113
-
114
- @allowed_ignorable_errors << cpu_verification_regex
115
- end
116
-
117
- def allow_privilege_verification_errors
118
- priveleges_regex = /privileges are required/i
119
- return if @allowed_ignorable_errors.include?(priveleges_regex)
120
-
121
- @allowed_ignorable_errors << priveleges_regex
122
- end
123
-
124
- def ignore_allowable_errors
125
- flash_errors = browser.all('.flash-message.error')
126
-
127
- if flash_errors.any?
128
- unexpected_errors = flash_errors.reject do |error|
129
- @allowed_ignorable_errors.select do |expected_error|
130
- error.text =~ expected_error
131
- end.any?
132
- end
133
-
134
- if unexpected_errors.empty?
135
- browser.click_on 'ignore-install-action'
136
- else
137
- fail "Unexepcted ignorable errors: #{unexpected_errors.map(&:text).inspect}"
138
- end
139
- end
140
- end
141
-
142
- def expect_no_flash_errors
143
- if (flash_error = browser.all('.flash-message.error').first)
144
- fail flash_error.text
145
- end
146
- end
147
-
148
- def wait_for_modal_css_transition_to_complete
149
- sleep 5 # Have to wait for the CSS shade effect
150
- end
151
-
152
- def open_dashboard
153
- browser.visit '/'
154
- end
155
- end
156
- end
157
- end
@@ -1,53 +0,0 @@
1
- require 'date'
2
-
3
- module OpsManagerUiDrivers
4
- module Version13
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
- visit_product_status_page
13
- browser.find(%Q(a[id^="download-#{job_name}-"][id$="-0-log-action"])).click
14
- end
15
-
16
- def most_recent_log_creation_time
17
- visit_product_logs_page
18
-
19
- most_recent_logs_timestamp
20
- end
21
-
22
- private
23
-
24
- attr_reader :product_name, :browser
25
-
26
- def visit_product_configure_page
27
- browser.visit('/')
28
- browser.click_on("show-#{product_name}-configure-action")
29
- end
30
-
31
- def visit_product_status_page
32
- visit_product_configure_page
33
- browser.click_on('show-status-action')
34
- end
35
-
36
- def visit_product_logs_page
37
- visit_product_configure_page
38
- browser.click_on('show-logs-action')
39
- end
40
-
41
- def most_recent_logs
42
- browser.all('#downloaded_logs tr').select { |e| e.find(%Q(a[href^="/products/#{product_name}"])) }.last
43
- end
44
-
45
- def most_recent_logs_timestamp
46
- return unless (log_row = most_recent_logs)
47
-
48
- date_string = log_row.all('td').last.text
49
- DateTime.parse(date_string)
50
- end
51
- end
52
- end
53
- end
@@ -1,46 +0,0 @@
1
- module OpsManagerUiDrivers
2
- module Version13
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_elb_for_job(job_name, elb_name)
18
- open_form
19
- browser.find_field("product_resources_form[#{job_name}][elb_name]").set(elb_name)
20
- save_form
21
- end
22
-
23
- private
24
-
25
- attr_reader :browser
26
-
27
- def open_form
28
- browser.visit '/'
29
- browser.click_on "show-#{product_name}-configure-action"
30
- browser.click_on "show-#{product_name}-resource-sizes-action"
31
- end
32
-
33
- def save_form
34
- browser.click_on 'Save'
35
-
36
- unless browser.has_css?('.flash-message.success')
37
- if browser.has_css?('.flash-message.error')
38
- raise browser.find('.flash-message.error').text
39
- else
40
- raise 'unexpected failure'
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,64 +0,0 @@
1
- module OpsManagerUiDrivers
2
- module Version13
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
- Version13::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
- Version13::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 10 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
@@ -1,40 +0,0 @@
1
- module OpsManagerUiDrivers
2
- module Version13
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 'user[user_name]', with: user
11
- browser.fill_in 'user[password]', with: password
12
- browser.fill_in 'user[password_confirmation]', with: password
13
- browser.check 'user_eula_accepted'
14
- browser.click_on 'create-user-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
- end
23
-
24
- def setup_or_login(user:, password:)
25
- browser.visit '/'
26
-
27
- if browser.current_path == '/setup'
28
- setup_and_login(user: user, password: password)
29
- elsif browser.current_path == '/login'
30
- login(user: user, password: password)
31
- end
32
- end
33
-
34
- private
35
-
36
- attr_reader :browser
37
-
38
- end
39
- end
40
- end
@@ -1,106 +0,0 @@
1
- require 'net/https'
2
- require 'date'
3
-
4
- module OpsManagerUiDrivers
5
- module Version13
6
- class WebUi
7
- def initialize(browser: nil)
8
- @browser = browser
9
- end
10
-
11
- def setup_page
12
- @setup_page ||= Version13::Setup.new(browser: browser)
13
- end
14
-
15
- def product_dashboard
16
- @product_dashboard ||= Version13::ProductDashboard.new(browser: browser)
17
- end
18
-
19
- def install_progress
20
- @install_progress ||= Version13::InstallProgress.new(browser: browser)
21
- end
22
-
23
- def available_products
24
- @available_products ||= Version13::AvailableProducts.new(browser: browser)
25
- end
26
-
27
- def product_logs_for(product_name)
28
- Version13::ProductLogs.new(browser: browser, product_name: product_name)
29
- end
30
-
31
- def current_time
32
- uri = URI(Capybara.app_host)
33
- uri.path = '/'
34
- Net::HTTP.start(uri.hostname, uri.port, use_ssl: (uri.scheme == 'https'), verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
35
- response = http.request(Net::HTTP::Get.new(uri))
36
- DateTime.parse(response['Date'])
37
- end
38
- end
39
-
40
- def product_status_for(product_name)
41
- Version13::ProductStatusHelper.new(
42
- product_name: product_name,
43
- browser: browser,
44
- )
45
- end
46
-
47
- def job_network_mapping_for(product_name)
48
- Version13::JobNetworkMappingHelper.new(
49
- product_name: product_name,
50
- browser: browser,
51
- )
52
- end
53
-
54
- def assign_availability_zones_for_product(product:, zones:)
55
- if zones
56
- Version13::JobAvailabilityZoneMappingHelper.new(
57
- product_name: product,
58
- browser: browser,
59
- ).assign_availability_zones!(
60
- singleton_availability_zone: zones[0]['name'],
61
- availability_zones: zones.map { |z| z['name'] },
62
- )
63
- end
64
- end
65
-
66
- def ops_manager_director
67
- @ops_manager_director ||= Version13::OpsManagerDirector.new(browser: browser)
68
- end
69
-
70
- def product_availability_zones(product)
71
- @product_availability_zones ||= Version13::ProductAvailabilityZones.new(browser: browser, product: product)
72
- end
73
-
74
- def flash_message
75
- browser.find('.flash-message').text
76
- end
77
-
78
- def availability_zone_guid_for_name(az_name)
79
- browser.visit '/'
80
- browser.click_on 'show-microbosh-configure-action'
81
- browser.click_on 'show-director-availability-zone-assignment-action'
82
-
83
- availability_zone_options = browser.find_field('Singleton Availability Zone').all('option')
84
- availability_zone_options.each do |element|
85
- if element.text == az_name
86
- return element[:value]
87
- end
88
- end
89
- end
90
-
91
- def product_resources_configuration(product_name)
92
- Version13::ProductResourceConfiguration.new(browser: browser, product_name: product_name)
93
- end
94
-
95
- private
96
-
97
- attr_reader :browser
98
-
99
- def guid
100
- # jenkins gives us the job name in an environment variable, otherwise use the hostname
101
- job_name = ENV['JOB_NAME'] || `hostname`.chomp.split(/\./).first
102
- job_name.gsub(/[^[:alnum:]]+/, '_')
103
- end
104
- end
105
- end
106
- end