prof 0.30.9 → 0.31.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/lib/prof/environment/pcf_drinks.rb +17 -51
  3. data/lib/prof/external_spec/helpers/capybara.rb +5 -0
  4. data/lib/prof/external_spec/helpers/file_helper.rb +3 -9
  5. data/lib/prof/external_spec/spec_helper.rb +11 -6
  6. data/lib/prof/ops_manager.rb +35 -109
  7. data/lib/prof/version.rb +1 -1
  8. metadata +6 -24
  9. data/lib/prof/external_spec/helpers/debug.rb +0 -53
  10. data/lib/prof/ops_manager/rails_500_error.rb +0 -15
  11. data/lib/prof/ops_manager/web_app_internals/page/checkbox_field.rb +0 -38
  12. data/lib/prof/ops_manager/web_app_internals/page/click_field.rb +0 -40
  13. data/lib/prof/ops_manager/web_app_internals/page/dashboard.rb +0 -100
  14. data/lib/prof/ops_manager/web_app_internals/page/flash_message.rb +0 -53
  15. data/lib/prof/ops_manager/web_app_internals/page/form.rb +0 -130
  16. data/lib/prof/ops_manager/web_app_internals/page/form_error.rb +0 -43
  17. data/lib/prof/ops_manager/web_app_internals/page/form_field.rb +0 -51
  18. data/lib/prof/ops_manager/web_app_internals/page/form_fields.rb +0 -35
  19. data/lib/prof/ops_manager/web_app_internals/page/installation_progress.rb +0 -149
  20. data/lib/prof/ops_manager/web_app_internals/page/login.rb +0 -83
  21. data/lib/prof/ops_manager/web_app_internals/page/modal.rb +0 -85
  22. data/lib/prof/ops_manager/web_app_internals/page/rails_500.rb +0 -41
  23. data/lib/prof/ops_manager/web_app_internals/page/select_field.rb +0 -27
  24. data/lib/prof/ops_manager/web_app_internals/page/tile_settings.rb +0 -105
  25. data/lib/prof/ops_manager/web_app_internals.rb +0 -63
  26. data/lib/prof/ops_manager_log_fetcher.rb +0 -30
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11815a7256e98b3cafa2457002ca2ec8be15cc3c
4
- data.tar.gz: 5ca41a9f3b2d136c69b12474cc120e1134a1857c
3
+ metadata.gz: b3f721a22a15e1e43787f06eca04043967708dbf
4
+ data.tar.gz: b103d0f59b6c348a6ca73bd41e1586ae4cacc422
5
5
  SHA512:
6
- metadata.gz: cda6f663a1679a7dbdf6860dce69633f7e63bfd848ba8276842cb75237af79aafd797749caef085ffe53c0959be407bb443e961d8c9fa3bd8fe35f5dfab610cb
7
- data.tar.gz: 50b59b5892d19370606f44df2c2c0a334e5f1d3ae818f7e7990e4dcb242a3cc42ece04024f9afbc28bf1f2fb624b7ed604961ea135c91da07eab95186792bc8b
6
+ metadata.gz: 1bcf83b410f896d6fcdf9b761dd5f5d740fc937d0a809eb5bf8f3cb4030a24f40c73d18505cb07ef8d279803f1f1765297a4b19db12dcecc186159fd3cecefcf
7
+ data.tar.gz: 77e87a6b300443b961d43802e7a49e1c4648735b9cfd780ebd618d59c8f1263710f0c9b68ba5fd5a3e668119f32fb026a620c3aef009f76b37088301488e3c4b
@@ -14,7 +14,6 @@ require 'capybara'
14
14
 
15
15
  require 'prof/cloud_foundry'
16
16
  require 'prof/ops_manager'
17
- require 'prof/ops_manager_log_fetcher'
18
17
  require 'prof/ssh_gateway'
19
18
  require 'prof/uaa_client'
20
19
 
@@ -23,41 +22,40 @@ module Prof
23
22
  class NoDirectorVm < StandardError; end
24
23
 
25
24
  class PcfDrinks
26
- def initialize(tempest_config, page: default_capybara_session)
25
+ def initialize(tempest_config)
27
26
  @tempest_config = tempest_config
28
- @page = page
29
27
  end
30
28
 
31
29
  def ops_manager
32
- @ops_manager ||= OpsManager.new(ops_manager_config.merge(page: page))
30
+ @ops_manager ||= OpsManager.new(environment_name: ENV.fetch('TEMPEST_ENVIRONMENT'), version: ENV.fetch('OM_VERSION'))
33
31
  end
34
32
 
35
- def cloud_foundry(credentials_identifier="admin_credentials")
33
+ def cloud_foundry
36
34
  @cloud_foundry ||= CloudFoundry.new(
37
35
  domain: cloud_foundry_domain,
38
- username: cloud_foundry_credentials(credentials_identifier).username,
39
- password: cloud_foundry_credentials(credentials_identifier).password
36
+ username: ops_manager.cf_admin_credentials.username,
37
+ password: ops_manager.cf_admin_credentials.password
40
38
  )
41
39
  end
42
40
 
43
41
  def cloud_foundry_domain
44
- tempest_config.fetch(:cloudfoundry).fetch(:domain)
42
+ tempest_config.fetch('cloudfoundry').fetch('domain')
45
43
  end
46
44
 
47
45
  def bosh_director
48
46
  @bosh_director ||= Hula::BoshDirector.new(
49
47
  target_url: bosh_director_url,
50
- username: bosh_credentials.fetch('identity'),
48
+ username: ops_manager.bosh_credentials.fetch('identity'),
51
49
  password: bosh_credentials.fetch('password')
52
50
  )
53
51
  end
54
52
 
55
53
  def ssh_gateway
56
54
  SshGateway.new(
57
- gateway_host: ssh_gateway_config.fetch(:host),
58
- gateway_username: ssh_gateway_config.fetch(:username),
59
- gateway_password: ssh_gateway_config[:password],
60
- ssh_key: ssh_gateway_config[:ssh_key]
55
+ gateway_host: ssh_gateway_config.fetch('host'),
56
+ gateway_username: ssh_gateway_config.fetch('username'),
57
+ gateway_password: ssh_gateway_config['password'],
58
+ ssh_key: ssh_gateway_config['ssh_key']
61
59
  )
62
60
  end
63
61
 
@@ -77,15 +75,6 @@ module Prof
77
75
  Capybara::Session.new(Capybara.default_driver)
78
76
  end
79
77
 
80
- def log_fetcher
81
- OpsManagerLogFetcher.new(
82
- ssh_gateway: ssh_gateway,
83
- host: ops_manager_hostname,
84
- username: ops_manager_vm_config.fetch(:username),
85
- password: ops_manager_vm_config.fetch(:password)
86
- )
87
- end
88
-
89
78
  def cloud_controller_client_credentials
90
79
  @cloud_controller_client_credentials ||= ops_manager.cc_client_credentials
91
80
  end
@@ -109,47 +98,24 @@ module Prof
109
98
  end
110
99
 
111
100
  def ops_manager_hostname
112
- URI.parse(ops_manager_config.fetch(:url)).hostname
101
+ URI.parse(ops_manager_config.fetch('url')).hostname
113
102
  end
114
103
 
115
104
  def ops_manager_config
116
- tempest_config.fetch(:tempest)
117
- end
118
-
119
- def ops_manager_vm_config
120
- tempest_config.fetch(:tempest_vm)
105
+ tempest_config.fetch('tempest')
121
106
  end
122
107
 
123
108
  def ssh_gateway_config
124
- tempest_config.fetch(:proxy)
109
+ tempest_config.fetch('proxy')
125
110
  end
126
111
 
127
- def bosh_director_url
128
- return URI("https://127.0.0.1:#{forwarded_bosh_port}").to_s if !tempest_config[:proxy].nil?
112
+ def bosh_director_urlo
113
+ return URI("https://127.0.0.1:#{forwarded_bosh_port}").to_s if !tempest_config['proxy'].nil?
129
114
  return director.hostname
130
115
  end
131
116
 
132
- def bosh_product
133
- # old versions of OpsMan (< v1.6 RC4)
134
- @bosh_product ||= ops_manager
135
- .send(:opsmanager_client)
136
- .send(:product, 'microbosh')
137
-
138
- # newer versions of OpsMan (>= v1.6 RC4)
139
- @bosh_product ||= ops_manager
140
- .send(:opsmanager_client)
141
- .send(:product, 'p-bosh')
142
- end
143
-
144
117
  def bosh_credentials
145
- # TODO: push this code into ops manager
146
- @bosh_credentials ||= bosh_product
147
- .job_of_type('director')
148
- .properties.fetch('director_credentials')
149
- end
150
-
151
- def cloud_foundry_credentials(credentials_identifier)
152
- @cloud_foundry_credentials ||= ops_manager.cf_uaa_credentials(credentials_identifier)
118
+ @bosh_credentials = ops_manager.bosh_credentials
153
119
  end
154
120
  end
155
121
  end
@@ -24,6 +24,7 @@ module Prof
24
24
  ::Capybara.default_driver = driver
25
25
  ::Capybara.javascript_driver = driver
26
26
 
27
+
27
28
  ::Capybara.register_driver :poltergeist do |app|
28
29
  ::Capybara::Poltergeist::Driver.new(
29
30
  app,
@@ -37,6 +38,10 @@ module Prof
37
38
  end
38
39
 
39
40
  ::Capybara.register_driver :webkit do |app|
41
+ ::Capybara::Webkit.configure do |config|
42
+ config.block_unknown_urls
43
+ end
44
+
40
45
  ::Capybara::Webkit::Driver.new(app).tap do |d|
41
46
  d.browser.ignore_ssl_errors
42
47
  d.browser.allow_url('*')
@@ -14,20 +14,14 @@ module Prof
14
14
  module ExternalSpec
15
15
  module Helpers
16
16
  module FileHelper
17
- def root_path
18
- defined?(ROOT_PATH) ? ROOT_PATH : Dir.pwd
19
- end
20
17
 
21
18
  def file_path(relative_to_root)
22
- File.expand_path(relative_to_root, root_path)
19
+ root_path = defined?(ROOT_PATH) ? ROOT_PATH : Dir.pwd
20
+ File.expand_path(relative_to_root, )
23
21
  end
24
22
 
25
23
  def json_contents(relative_to_root)
26
- JSON.parse(file_contents(relative_to_root), symbolize_names: true)
27
- end
28
-
29
- def file_contents(relative_to_root)
30
- File.read(file_path(relative_to_root))
24
+ raise 'Please use YAML.load_file() instead. See example in p-rabbitmq'
31
25
  end
32
26
  end
33
27
  end
@@ -8,28 +8,33 @@
8
8
  # USE OR OTHER DEALINGS IN THE SOFTWARE.
9
9
  #
10
10
 
11
+ require 'opsmgr/ui_helpers/config_helper'
11
12
  require 'prof/external_spec/helpers/capybara'
12
- require 'prof/external_spec/helpers/debug'
13
13
  require 'prof/external_spec/helpers/file_helper'
14
14
  require 'prof/external_spec/helpers/product_path'
15
15
 
16
16
  require 'rspec_junit_formatter'
17
+ require 'capybara/webkit'
18
+ require 'opsmgr/log'
19
+ require 'pry'
20
+
21
+ Opsmgr::Log.stdout_mode!
17
22
 
18
23
  RSpec.configure do |config|
24
+ config.formatter = :documentation
25
+ config.filter_run :focus
26
+ config.run_all_when_everything_filtered = true
27
+
19
28
  config.include Prof::ExternalSpec::Helpers::Capybara
20
- config.include Prof::ExternalSpec::Helpers::Debug
21
29
  config.include Prof::ExternalSpec::Helpers::FileHelper
22
30
  config.include Prof::ExternalSpec::Helpers::ProductPath
23
31
 
24
32
  config.add_formatter RSpecJUnitFormatter, 'rspec.xml'
25
33
 
26
34
  config.full_backtrace = true
35
+ config.fail_fast = false
27
36
 
28
37
  config.before(:all) do
29
38
  setup_browser(:webkit)
30
39
  end
31
-
32
- config.after(:each) do |example|
33
- save_exception_output(example)
34
- end
35
40
  end
@@ -7,136 +7,62 @@
7
7
  # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8
8
  # USE OR OTHER DEALINGS IN THE SOFTWARE.
9
9
  #
10
-
11
- require 'capybara'
12
- require 'opsmanager_client/client'
13
- require 'forwardable'
14
-
15
- require 'prof/ops_manager/web_app_internals'
16
- require 'prof/ops_manager/rails_500_error'
17
- require 'prof/tile'
18
- require 'json'
10
+ require 'opsmgr/api/client'
11
+ require 'opsmgr/environments'
12
+ require 'ostruct'
19
13
 
20
14
  module Prof
21
15
  class OpsManager
22
- extend Forwardable
16
+ def initialize(environment_name:, version: "1.7")
17
+ @api = Opsmgr::Api::Client.new(
18
+ Opsmgr::Environments.for(environment_name),
19
+ version
20
+ )
23
21
 
24
- def initialize(url:, username:, password:, page: default_capybara_session, log_fetcher: null_log_fetcher, version: "1.6")
25
- @url = url
26
- @username = username
27
- @password = password
28
- @page = page
29
- @log_fetcher = log_fetcher
30
- @version = Gem::Version.new(version)
22
+ @api_installation_settings = @api.installation_settings
31
23
  end
32
24
 
33
25
  attr_reader :url
34
26
 
35
- def_delegators :web_app_internals,
36
- :apply_changes
37
-
38
- def_delegators :opsmanager_client,
39
- :cc_client_credentials,
40
- :cf_admin_credentials,
41
- :cf_uaa_credentials,
42
- :cf_installed?,
43
- :delete_unused_products,
44
- :system_domain,
45
- :upgrade_product,
46
- :vms_for_job_type
47
-
48
- def_delegators :dashboard,
49
- :apply_setting,
50
- :tile,
51
- :tile_configuration,
52
- :tile_configure
53
-
54
- # Add ability to get hold of the capybara session
55
- # while transitioning code over to page objects
56
- def browser(&_block)
57
- yield page, url
58
- end
59
-
60
- def uninstall_tile(*tile_or_tiles)
61
- tiles = Array(tile_or_tiles).flatten
62
- return if tiles.empty?
63
-
64
- tiles.each { |t| web_app_internals.tile_uninstall(t) }
65
- web_app_internals.apply_changes
27
+ def cf_admin_credentials
28
+ OpenStruct.new({
29
+ 'username' => 'admin',
30
+ 'password' => @api_installation_settings.uaa_admin_password
31
+ })
66
32
  end
67
- alias_method :uninstall_tiles, :uninstall_tile
68
33
 
69
- def setup_tile(tile)
70
- puts "Adding #{tile.name}"
71
- add_tile(tile)
72
-
73
- puts "Installing update"
74
- apply_changes
75
- rescue Rails500Error => e
76
- puts "FAILED: '#{e.message}'\n"
77
- logs = log_fetcher.fetch_logs('production.log', 500)
78
- raise Rails500Error, "#{e.message}\n---------------\n#{logs}"
34
+ def bosh_credentials
35
+ {
36
+ 'identity' => 'director',
37
+ 'password' => @api_installation_settings.director_password
38
+ }
79
39
  end
80
40
 
81
- def add_tile(tile)
82
- opsmanager_client.add_product(tile)
41
+ def system_domain
42
+ @api_installation_settings.system_domain
83
43
  end
84
44
 
85
- def upload_product(product)
86
- puts "Uploading product #{product.name}"
87
- opsmanager_client.upload_product(product)
88
- Tile.new(name: product.name, version: product.version)
89
- end
45
+ def vms_for_job_type(job_type)
46
+ manifest = @api_installation_settings.as_hash
90
47
 
91
- def product_tiles
92
- tiles.reject{|t| ['cf', 'microbosh', 'p-bosh'].include?(t.name) }
93
- end
48
+ product = get_product_for_job(manifest, job_type)
49
+ ips = @api_installation_settings.ips_for_job(product_name: product['identifier'], job_name: job_type)
50
+ vm_credentials = product["jobs"].detect { |job| job["installation_name"] == job_type }['vm_credentials']
94
51
 
95
- def tiles
96
- opsmanager_client.send(:installed_products).map {|tempest_product|
97
- Tile.new(
98
- name: tempest_product.type,
99
- version: tempest_product.version,
100
- guid: tempest_product.guid
52
+ ips.map do |ip|
53
+ OpenStruct.new(
54
+ :hostname => ip,
55
+ :username => vm_credentials.fetch("identity"),
56
+ :password => vm_credentials.fetch("password")
101
57
  )
102
- }
103
- end
104
-
105
- def vms_for_job_type(job_type)
106
- opsmanager_client.vms_for_job_type(job_type)
58
+ end
107
59
  end
108
60
 
109
61
  private
110
62
 
111
- attr_reader :username, :password, :page, :log_fetcher, :version
112
-
113
- def default_capybara_session
114
- Capybara::Session.new(Capybara.default_driver)
115
- end
116
-
117
- def web_app_internals
118
- @web_app_internals ||= WebAppInternals.new(dashboard, opsmanager_client, page, url)
119
- end
120
-
121
- def opsmanager_client
122
- @opsmanager_client ||= ::OpsmanagerClient::Client.new(url, username, password)
123
- end
124
-
125
- def dashboard
126
- @dashboard ||= login_page.login.tap { page.visit(url) unless page.current_url == url }
127
- end
128
-
129
- def login_page
130
- @login_page ||= WebAppInternals::Page::Login.new(page: page, url: url, username: username, password: password, version: version)
131
- end
132
-
133
- def null_log_fetcher
134
- NullLogFetcher.new
135
- end
136
-
137
- class NullLogFetcher
138
- def fetch_logs(_, _)
139
- return 'No Log fetcher configured.'
63
+ def get_product_for_job(manifest, job_type)
64
+ manifest["products"].detect do |product|
65
+ product['jobs'].any? { |job| job['identifier'] == job_type }
140
66
  end
141
67
  end
142
68
  end
data/lib/prof/version.rb CHANGED
@@ -9,5 +9,5 @@
9
9
  #
10
10
 
11
11
  module Prof
12
- VERSION = '0.30.9'
12
+ VERSION = '0.31.0'
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prof
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.9
4
+ version: 0.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - CF London
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-30 00:00:00.000000000 Z
11
+ date: 2016-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem-release
@@ -305,19 +305,19 @@ dependencies:
305
305
  - !ruby/object:Gem::Version
306
306
  version: '1.1'
307
307
  - !ruby/object:Gem::Dependency
308
- name: opsmanager_client
308
+ name: opsmgr
309
309
  requirement: !ruby/object:Gem::Requirement
310
310
  requirements:
311
311
  - - "~>"
312
312
  - !ruby/object:Gem::Version
313
- version: 0.8.5
313
+ version: 0.34.17
314
314
  type: :runtime
315
315
  prerelease: false
316
316
  version_requirements: !ruby/object:Gem::Requirement
317
317
  requirements:
318
318
  - - "~>"
319
319
  - !ruby/object:Gem::Version
320
- version: 0.8.5
320
+ version: 0.34.17
321
321
  description: A gem to test Cloud Foundry service brokers
322
322
  email:
323
323
  - cf-london@pivotallabs.com
@@ -331,7 +331,6 @@ files:
331
331
  - lib/prof/environment/pcf_drinks.rb
332
332
  - lib/prof/environment_manager.rb
333
333
  - lib/prof/external_spec/helpers/capybara.rb
334
- - lib/prof/external_spec/helpers/debug.rb
335
334
  - lib/prof/external_spec/helpers/file_helper.rb
336
335
  - lib/prof/external_spec/helpers/product_path.rb
337
336
  - lib/prof/external_spec/shared_examples/deployment.rb
@@ -345,23 +344,6 @@ files:
345
344
  - lib/prof/matchers/ssl.rb
346
345
  - lib/prof/matchers/tile_configuration.rb
347
346
  - lib/prof/ops_manager.rb
348
- - lib/prof/ops_manager/rails_500_error.rb
349
- - lib/prof/ops_manager/web_app_internals.rb
350
- - lib/prof/ops_manager/web_app_internals/page/checkbox_field.rb
351
- - lib/prof/ops_manager/web_app_internals/page/click_field.rb
352
- - lib/prof/ops_manager/web_app_internals/page/dashboard.rb
353
- - lib/prof/ops_manager/web_app_internals/page/flash_message.rb
354
- - lib/prof/ops_manager/web_app_internals/page/form.rb
355
- - lib/prof/ops_manager/web_app_internals/page/form_error.rb
356
- - lib/prof/ops_manager/web_app_internals/page/form_field.rb
357
- - lib/prof/ops_manager/web_app_internals/page/form_fields.rb
358
- - lib/prof/ops_manager/web_app_internals/page/installation_progress.rb
359
- - lib/prof/ops_manager/web_app_internals/page/login.rb
360
- - lib/prof/ops_manager/web_app_internals/page/modal.rb
361
- - lib/prof/ops_manager/web_app_internals/page/rails_500.rb
362
- - lib/prof/ops_manager/web_app_internals/page/select_field.rb
363
- - lib/prof/ops_manager/web_app_internals/page/tile_settings.rb
364
- - lib/prof/ops_manager_log_fetcher.rb
365
347
  - lib/prof/product.rb
366
348
  - lib/prof/pushed_test_app.rb
367
349
  - lib/prof/service_instance.rb
@@ -396,7 +378,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
396
378
  version: '0'
397
379
  requirements: []
398
380
  rubyforge_project:
399
- rubygems_version: 2.4.5
381
+ rubygems_version: 2.5.1
400
382
  signing_key:
401
383
  specification_version: 4
402
384
  summary: A gem to test CF service brokers
@@ -1,53 +0,0 @@
1
- # Copyright (c) 2014-2015 Pivotal Software, Inc.
2
- # All rights reserved.
3
- # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
4
- # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
5
- # PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
6
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
7
- # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8
- # USE OR OTHER DEALINGS IN THE SOFTWARE.
9
- #
10
-
11
- module Prof
12
- module ExternalSpec
13
- module Helpers
14
- module Debug
15
-
16
- def recording_exceptions
17
- yield
18
- rescue Exception => ex
19
- @recorded_exception = ex
20
- raise
21
- end
22
-
23
- def save_exceptions
24
- yield
25
- rescue Exception => ex
26
- ops_manager.browser do |page|
27
- name = "failure"
28
- puts "Saving failure data for '#{name}'"
29
- page.save_page("#{name}.html")
30
- page.save_screenshot("#{name}.png")
31
- end
32
- raise
33
- end
34
-
35
- def save_exception_output(example)
36
- unless @recorded_exception
37
- return unless example.respond_to?(:exception)
38
- return unless example.respond_to?(:full_description)
39
- return unless respond_to?(:ops_manager)
40
- return unless example.exception
41
- end
42
-
43
- ops_manager.browser do |page|
44
- name = example.full_description.gsub(/\W/, '_')
45
- puts "Saving failure data for '#{name}'"
46
- page.save_page("#{name}.html")
47
- page.save_screenshot("#{name}.png")
48
- end
49
- end
50
- end
51
- end
52
- end
53
- end
@@ -1,15 +0,0 @@
1
- # Copyright (c) 2014-2015 Pivotal Software, Inc.
2
- # All rights reserved.
3
- # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
4
- # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
5
- # PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
6
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
7
- # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8
- # USE OR OTHER DEALINGS IN THE SOFTWARE.
9
- #
10
-
11
- module Prof
12
- class OpsManager
13
- class Rails500Error < StandardError; end
14
- end
15
- end
@@ -1,38 +0,0 @@
1
- # Copyright (c) 2014-2015 Pivotal Software, Inc.
2
- # All rights reserved.
3
- # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
4
- # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
5
- # PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
6
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
7
- # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8
- # USE OR OTHER DEALINGS IN THE SOFTWARE.
9
- #
10
-
11
- require 'prof/ops_manager/web_app_internals/page/form_field'
12
-
13
- module Prof
14
- class OpsManager
15
- class WebAppInternals
16
- module Page
17
- class CheckboxField < FormField
18
- def initialize(name:, value:, checked:)
19
- super(name: name, value: value)
20
- @checked = checked
21
- end
22
-
23
- private
24
-
25
- attr_reader :checked
26
-
27
- def selector
28
- super + "[value$='#{value}']"
29
- end
30
-
31
- def set_value(field)
32
- field.set(checked)
33
- end
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,40 +0,0 @@
1
- # Copyright (c) 2014-2015 Pivotal Software, Inc.
2
- # All rights reserved.
3
- # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
4
- # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
5
- # PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
6
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
7
- # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
8
- # USE OR OTHER DEALINGS IN THE SOFTWARE.
9
- #
10
-
11
- require 'prof/ops_manager/web_app_internals/page/form_field'
12
-
13
- module Prof
14
- class OpsManager
15
- class WebAppInternals
16
- module Page
17
- class ClickField < FormField
18
- def initialize(name:, expected_state: )
19
- super(name: name, value: nil)
20
- @expected_state = expected_state
21
- end
22
-
23
- private
24
-
25
- attr_reader :expected_state
26
-
27
- def selector
28
- super + ":not([type=hidden])"
29
- end
30
-
31
- def set_value(field)
32
- unless field.checked? == expected_state
33
- field.click
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end