Sha256: 4d0d19dc0ddc3c2f6af699ac628186bc329a098a0909ba1a21d7c50842db962d

Contents?: true

Size: 988 Bytes

Versions: 20

Compression:

Stored size: 988 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'

module EhbrsRubyUtils
  module Bga
    class Session < ::SimpleDelegator
      module Login
        LOGIN_PATH = 'account'
        USERNAME_INPUT_ID = 'username_input'
        PASSWORD_INPUT_ID = 'password_input'
        SUBMIT_ID = 'login_button'

        # @return [Boolean]
        def login
          navigate_to_login_page
          input_username
          input_password
          submit_login
          logged?
        end

        def login_url
          build_url(LOGIN_PATH)
        end

        private

        def navigate_to_login_page
          navigate.to(login_url)
        end

        def input_username
          wait_for_element(id: USERNAME_INPUT_ID).send_keys(username)
        end

        def input_password
          wait_for_element(id: PASSWORD_INPUT_ID).send_keys(password)
        end

        def submit_login
          wait_for_click(id: SUBMIT_ID)
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ehbrs_ruby_utils-0.44.2 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.44.1 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.44.0 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.41.1 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.41.0 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.40.0 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.39.0 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.38.0 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.37.0 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.36.1 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.36.0 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.35.0 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.33.0 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.32.0 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.31.0 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.30.0 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.29.0 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.28.0 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.27.1 lib/ehbrs_ruby_utils/bga/session/login.rb
ehbrs_ruby_utils-0.27.0 lib/ehbrs_ruby_utils/bga/session/login.rb