Class: PortalModule::Pages::LoginPage
- Inherits:
-
Object
- Object
- PortalModule::Pages::LoginPage
- Includes:
- PageObject
- Defined in:
- lib/portal_module/pages/login_page.rb
Instance Method Summary collapse
- #allow_password_entry ⇒ Object
- #get_dynamic_url ⇒ Object
- #login_as(username, password) ⇒ Object
- #logout ⇒ Object
Instance Method Details
#allow_password_entry ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/portal_module/pages/login_page.rb', line 52 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 = "pwdmasks = document.getElementsByClassName('passwordmask');\npwdmasks[0].style.display = 'none';\npwds = document.getElementsByClassName('password');\npwds[0].style.display = 'block';\n" @browser.execute_script(hide_mask_script) end |
#get_dynamic_url ⇒ Object
17 18 19 |
# File 'lib/portal_module/pages/login_page.rb', line 17 def get_dynamic_url PortalModule.configuration.base_url end |
#login_as(username, password) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/portal_module/pages/login_page.rb', line 26 def login_as(username, password) if !self.username? && current_url == PortalModule.configuration.base_url + '/User/AppLogin.aspx' # We're still logged in. return end raise ArgumentError.new("Missing username for login.\nHave you set the HSBC_envname_USER environment variable?") if username.nil? raise ArgumentError.new("Missing password for login.\nHave you set the HSBC_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 ⇒ Object
48 49 50 |
# File 'lib/portal_module/pages/login_page.rb', line 48 def logout navigate_to get_dynamic_url + '/User/AppLogout.aspx' end |