Class: OpsManagerUiDrivers::Version17::Setup

Inherits:
OpsManagerUiDrivers::Version16::Setup show all
Defined in:
lib/ops_manager_ui_drivers/version17/setup.rb

Direct Known Subclasses

OpsManagerUiDrivers::Version18::Setup

Instance Method Summary collapse

Methods inherited from OpsManagerUiDrivers::Version14::Setup

#initialize

Constructor Details

This class inherits a constructor from OpsManagerUiDrivers::Version14::Setup

Instance Method Details

#import_installation_file(file_path, decryption_passphrase) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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:) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/ops_manager_ui_drivers/version17/setup.rb', line 61

def (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:) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/ops_manager_ui_drivers/version17/setup.rb', line 45

def (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) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ops_manager_ui_drivers/version17/setup.rb', line 21

def (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'

  (user: user, password: password) unless browser.has_selector?('#main-page-marker', wait: 1)
end

#setup_or_login(user:, password:, decryption_passphrase: password) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/ops_manager_ui_drivers/version17/setup.rb', line 76

def (user:, password:, decryption_passphrase: password)
  browser.visit '/'

  if browser.current_path == '/setup'
    (user: user, password: password, decryption_passphrase: decryption_passphrase)
  elsif browser.current_path == '/unlock'
    (user: user, password: password, decryption_passphrase: decryption_passphrase)
  elsif browser.current_path == '/uaa/login'
    (user: user, password: password)
  end
end

#setup_with_saml_provider(decryption_passphrase:, idp_metadata:) ⇒ Object



35
36
37
38
39
40
41
42
43
# 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: 
  browser.check 'setup_eula_accepted'
  browser.click_on 'create-setup-saml-action'
end