Class: OpsManagerUiDrivers::Version16::ProductDashboard

Inherits:
Object
  • Object
show all
Defined in:
lib/ops_manager_ui_drivers/version16/product_dashboard.rb

Instance Method Summary collapse

Constructor Details

#initialize(browser:) ⇒ ProductDashboard

Returns a new instance of ProductDashboard.



4
5
6
7
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 4

def initialize(browser:)
  @browser = browser
  @allowed_ignorable_errors = []
end

Instance Method Details

#apply_updatesObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 9

def apply_updates
  open_dashboard
  browser.click_on 'install-action'
  fail 'Install failed verification' if nonignorable_verification_failed?
  allow_cpu_verification_errors
  allow_privilege_verification_errors
  allow_icmp_verification_errors #this is only for AWS; consider moving out

  ignore_allowable_errors
  assert_installation_started
end

#delete_installation_available?Boolean

Returns:

  • (Boolean)


92
93
94
95
96
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 92

def delete_installation_available?
  open_dashboard
  browser.click_on 'toggle-installation-dropdown-action'
  browser.all('#show-delete-installation-modal-action').any?
end

#delete_product(product_name) ⇒ Object



37
38
39
40
41
42
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 37

def delete_product(product_name)
  open_dashboard
  browser.click_on "open-delete-#{product_name}-modal"
  wait_for_modal_css_transition_to_complete
  browser.click_on "delete-#{product_name}-action"
end

#delete_whole_installationObject



76
77
78
79
80
81
82
83
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 76

def delete_whole_installation
  open_dashboard
  browser.click_on 'toggle-installation-dropdown-action'
  browser.click_on 'show-delete-installation-modal-action'
  wait_for_modal_css_transition_to_complete
  browser.click_on 'delete-installation-action'
  apply_updates
end

#deletion_in_progress?Boolean

Returns:

  • (Boolean)


98
99
100
101
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 98

def deletion_in_progress?
  open_dashboard
  browser.all('#delete-in-progress-marker').any?
end

#import_installation_file(file_path) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 21

def import_installation_file(file_path)
  open_dashboard
  browser.click_on 'toggle-installation-dropdown-action'
  browser.click_on 'show-settings'
  browser.click_on 'close-warning'
  browser.attach_file 'import[file]', file_path
  browser.click_on 'import-settings'
  browser.wait { browser.assert_text('Successfully imported installation.') }
end

#import_product_from(full_path) ⇒ Object



49
50
51
52
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 49

def import_product_from(full_path)
  open_dashboard
  browser.attach_file('component_add[file]', full_path, {visible: false})
end

#most_recent_install_logObject



113
114
115
116
117
118
119
120
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 113

def most_recent_install_log
  open_dashboard
  if browser.all('#installation-logs li a', visible: false).any?
    base_url = browser.first('#installation-logs li a', visible: false)[:href]
    browser.visit "#{base_url}.text"
    browser.source
  end
end

#product_available?(product_name, product_version) ⇒ Boolean

Returns:

  • (Boolean)


54
55
56
57
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 54

def product_available?(product_name, product_version)
  open_dashboard
  browser.all("li.#{product_name} input#component_version[value='#{product_version}']", {visible: false}).any?
end

#product_complete?(product_name) ⇒ Boolean

Returns:

  • (Boolean)


59
60
61
62
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 59

def product_complete?(product_name)
  open_dashboard
  browser.all("a#show-#{product_name}-configure-action[data-progress='100']").any?
end

#product_on_dashboard?(product_name) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
47
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 44

def product_on_dashboard?(product_name)
  open_dashboard
  browser.all("a#show-#{product_name}-configure-action").any?
end

#reset_state(ops_manager) ⇒ Object



103
104
105
106
107
108
109
110
111
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 103

def reset_state(ops_manager)
  revert_pending_changes if revert_available?
  if delete_installation_available?
    delete_whole_installation
    browser.poll_up_to_mins(15) do
      browser.expect(ops_manager.state_change_progress).to browser.be_state_change_success
    end
  end
end

#revert_available?Boolean

Returns:

  • (Boolean)


129
130
131
132
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 129

def revert_available?
  open_dashboard
  browser.all('#open-revert-installation-modal-action').any?
end

#revert_pending_changesObject



122
123
124
125
126
127
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 122

def revert_pending_changes
  open_dashboard
  browser.click_on 'open-revert-installation-modal-action'
  wait_for_modal_css_transition_to_complete
  browser.click_on 'revert-installation-action'
end

#upgrade_microboshObject



31
32
33
34
35
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 31

def upgrade_microbosh
  open_dashboard
  browser.find('p', text: 'Ops Manager Director').trigger(:mouseover)
  browser.click_on 'upgrade-microbosh'
end

#upgrade_product(product_name) ⇒ Object



64
65
66
67
68
69
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 64

def upgrade_product(product_name)
  open_dashboard
  browser.find(".product.#{product_name} p").trigger(:mouseover)
  browser.click_on "upgrade-#{product_name}"
  expect_no_flash_errors
end

#version_for_product(product_name) ⇒ Object



71
72
73
74
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 71

def version_for_product(product_name)
  open_dashboard
  browser.find("#show-#{product_name}-configure-action .version").text
end

#wait_for_installation_to_be_deletedObject



85
86
87
88
89
90
# File 'lib/ops_manager_ui_drivers/version16/product_dashboard.rb', line 85

def wait_for_installation_to_be_deleted
  browser.poll_up_to_mins(10) do
    open_dashboard
    assert_install_action_disabled
  end
end