class OpsManagerUiDrivers::Version17::Setup

Public Instance Methods

import_installation_file(file_path, decryption_passphrase) click to toggle source
# File lib/ops_manager_ui_drivers/version17/setup.rb, line 6
def import_installation_file(file_path, decryption_passphrase)
  browser.visit '/import/new'

  browser.fill_in 'import[passphrase]', with: decryption_passphrase
  browser.attach_file 'import[file]', file_path
  browser.click_on 'Import'

  browser.poll_up_to_mins(3) do
    if browser.current_path == '/import/notes'
      browser.click_on 'Continue'
    end
    fail Capybara::ExpectationNotMet unless browser.current_path == '/uaa/login' || browser.current_path == '/'
  end
end
login(user:, password:) click to toggle source
# File lib/ops_manager_ui_drivers/version17/setup.rb, line 61
def login(user:, password:)
  Timeout.timeout(180) do
    while browser.current_path.include?('ensure_availability')
      sleep 1
    end
  end
  browser.fill_in 'username', with: user, wait: 4
  browser.fill_in 'password', with: password
  browser.click_on 'Sign in'

  unless browser.has_selector?('#main-page-marker', wait: 4)
    fail(RuntimeError, "failed to log in as #{user}/#{password}.")
  end
end
login_saml(username:, password:) click to toggle source
# File lib/ops_manager_ui_drivers/version17/setup.rb, line 45
def login_saml(username:, password:)
  Timeout.timeout(150) do
    while browser.current_path.include?('ensure_availability')
      sleep 1
    end
  end

  browser.fill_in 'username', with: username
  browser.fill_in 'password', with: password
  browser.click_on 'Login'

  unless browser.has_selector?('#main-page-marker', wait: 4)
    fail(RuntimeError, "failed to log in as #{username}/#{password}.")
  end
end
setup_and_login(user:, password:, decryption_passphrase: password) click to toggle source
# File lib/ops_manager_ui_drivers/version17/setup.rb, line 21
def setup_and_login(user:, password:, decryption_passphrase: password)
  browser.visit '/setup'
  browser.click_on 'Internal Authentication'
  browser.fill_in 'setup[admin_user_name]', with: user, wait: 4
  browser.fill_in 'setup[admin_password]', with: password
  browser.fill_in 'setup[admin_password_confirmation]', with: password
  browser.fill_in 'setup[decryption_passphrase]', with: decryption_passphrase
  browser.fill_in 'setup[decryption_passphrase_confirmation]', with: decryption_passphrase
  browser.check 'setup_eula_accepted'
  browser.click_on 'create-setup-internal-action'

  login(user: user, password: password) unless browser.has_selector?('#main-page-marker', wait: 1)
end
setup_or_login(user:, password:, decryption_passphrase: password) click to toggle source
# File lib/ops_manager_ui_drivers/version17/setup.rb, line 76
def setup_or_login(user:, password:, decryption_passphrase: password)
  browser.visit '/'

  if browser.current_path == '/setup'
    setup_and_login(user: user, password: password, decryption_passphrase: decryption_passphrase)
  elsif browser.current_path == '/unlock'
    unlock_and_login(user: user, password: password, decryption_passphrase: decryption_passphrase)
  elsif browser.current_path == '/uaa/login'
    login(user: user, password: password)
  end
end
setup_with_saml_provider(decryption_passphrase:, idp_metadata:) click to toggle source
# File lib/ops_manager_ui_drivers/version17/setup.rb, line 35
def setup_with_saml_provider(decryption_passphrase:, idp_metadata:)
  browser.visit '/setup'
  browser.click_on 'Use an Identity Provider'
  browser.fill_in 'setup[decryption_passphrase]', with: decryption_passphrase
  browser.fill_in 'setup[decryption_passphrase_confirmation]', with: decryption_passphrase
  browser.fill_in 'setup[idp_metadata]', with: idp_metadata
  browser.check 'setup_eula_accepted'
  browser.click_on 'create-setup-saml-action'
end

Private Instance Methods

unlock_and_login(user:, password:, decryption_passphrase: password) click to toggle source
# File lib/ops_manager_ui_drivers/version17/setup.rb, line 90
def unlock_and_login(user:, password:, decryption_passphrase: password)
  browser.fill_in 'login[passphrase]', with: decryption_passphrase
  browser.click_on 'Login'
  login(user: user, password: password) unless browser.has_selector?('#main-page-marker', wait: 1)
end