class AdminModule::Pages::LoginPage

Public Instance Methods

allow_password_entry() click to toggle source
# File lib/admin_module/pages/login_page.rb, line 54
  def allow_password_entry
    # We used to have to click on the password mask before the page would let us enter the password itself:
    #
    # # For some unknown reason, we must click on a password mask input before
    # # we can access the password field itself.
    #   password_mask_element.click
    #
    # Now, we have to use javascript to hide the mask and display the password field.
    hide_mask_script = <<EOS
pwdmasks = document.getElementsByClassName('passwordmask');
pwdmasks[0].style.display = 'none';
pwds = document.getElementsByClassName('password');
pwds[0].style.display = 'block';
EOS

    @browser.execute_script(hide_mask_script)
  end
get_dynamic_url() click to toggle source
# File lib/admin_module/pages/login_page.rb, line 19
def get_dynamic_url
  AdminModule.configuration.base_url
end
login_as(username, password) click to toggle source
# File lib/admin_module/pages/login_page.rb, line 28
def login_as(username, password)
  if !self.username? && current_url == AdminModule.configuration.base_url + '/AdminMain.aspx'
    # We're still logged in.
    return
  end

  raise ArgumentError.new("Missing username for login.\nHave you set the $CLIENT_envname_USER environment variable?") if username.nil?

  raise ArgumentError.new("Missing password for login.\nHave you set the $CLIENT_envname_PASSWORD environment variable?") if password.nil?

  unless current_url.downcase.include? get_dynamic_url.downcase
    navigate_to get_dynamic_url
  end

  self.username = username

  allow_password_entry

  self.password = password
  login
end
logout() click to toggle source
# File lib/admin_module/pages/login_page.rb, line 50
def logout
  navigate_to get_dynamic_url + '/user/logout.aspx'
end