Sha256: 057aa964047ca49774046a58fe9ed7848a11c06f76fad0e723dc0bc47d17a857

Contents?: true

Size: 1.19 KB

Versions: 13

Compression:

Stored size: 1.19 KB

Contents

module OpsManagerUiDrivers
  module Version16
    class Setup
      def initialize(browser: nil)
        @browser = browser
      end

      def setup_and_login(user:, password:)
        browser.visit '/setup'
        browser.fill_in 'setup[user_name]', with: user
        browser.fill_in 'setup[password]', with: password
        browser.fill_in 'setup[password_confirmation]', with: password
        browser.check 'setup_eula_accepted'
        browser.click_on 'create-setup-action'
      end

      def login(user: nil, password: nil)
        browser.visit '/login'
        browser.fill_in 'login[user_name]', with: user
        browser.fill_in 'login[password]', with: password
        browser.click_on 'login-action'

        unless browser.first('#main-page-marker')
          fail RuntimeError.new("failed to log in as #{user}/#{password}.")
        end
      end

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

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

      private

      attr_reader :browser

    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ops_manager_ui_drivers-1.8.0 lib/ops_manager_ui_drivers/version16/setup.rb
ops_manager_ui_drivers-1.7.3 lib/ops_manager_ui_drivers/version16/setup.rb
ops_manager_ui_drivers-1.7.1 lib/ops_manager_ui_drivers/version16/setup.rb
ops_manager_ui_drivers-1.7.0 lib/ops_manager_ui_drivers/version16/setup.rb
ops_manager_ui_drivers-1.6.3 lib/ops_manager_ui_drivers/version16/setup.rb
ops_manager_ui_drivers-1.6.2 lib/ops_manager_ui_drivers/version16/setup.rb
ops_manager_ui_drivers-1.5.1 lib/ops_manager_ui_drivers/version16/setup.rb
ops_manager_ui_drivers-1.6.1 lib/ops_manager_ui_drivers/version16/setup.rb
ops_manager_ui_drivers-1.6.0 lib/ops_manager_ui_drivers/version16/setup.rb
ops_manager_ui_drivers-1.5.0 lib/ops_manager_ui_drivers/version16/setup.rb
ops_manager_ui_drivers-1.4.0 lib/ops_manager_ui_drivers/version16/setup.rb
ops_manager_ui_drivers-1.3.1 lib/ops_manager_ui_drivers/version16/setup.rb
ops_manager_ui_drivers-1.3.0 lib/ops_manager_ui_drivers/version16/setup.rb