Class: AmsLayout::Pages::LoginPage
- Inherits:
-
Object
- Object
- AmsLayout::Pages::LoginPage
- Includes:
- PageObject
- Defined in:
- lib/ams_layout/pages/login_page.rb
Instance Method Summary collapse
- #allow_password_entry ⇒ Object
- #logged_in? ⇒ Boolean
- #login_as(username, password) ⇒ Object
- #logout ⇒ Object
Instance Method Details
#allow_password_entry ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/ams_layout/pages/login_page.rb', line 50 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 |
#logged_in? ⇒ Boolean
46 47 48 |
# File 'lib/ams_layout/pages/login_page.rb', line 46 def logged_in? !self.username? end |
#login_as(username, password) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ams_layout/pages/login_page.rb', line 28 def login_as(username, password) self.username = username allow_password_entry self.password = password login trys = 0 # Make sure we wait until the (sometimes) slow login is finished. while trys < 10 && !self.text.include?('LOAN PIPELINE') trys += 1 sleep 1 end end |
#logout ⇒ Object
42 43 44 |
# File 'lib/ams_layout/pages/login_page.rb', line 42 def logout navigate_to page_url_value + '/User/AppLogout.aspx' end |