Class: AdminModule::Pages::LoginPage400
- Inherits:
-
Object
- Object
- AdminModule::Pages::LoginPage400
- Includes:
- PageObject
- Defined in:
- lib/admin_module/pages/login_page_400.rb
Instance Method Summary collapse
- #enable_login_button ⇒ Object
- #get_dynamic_url ⇒ Object
- #login_as(username, password) ⇒ Object
- #logout ⇒ Object
Instance Method Details
#enable_login_button ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/admin_module/pages/login_page_400.rb', line 53 def # For 'unsupported' browsers (anything other than IE < v9), the login button # is disabled and hidden. # # Use JS to enable the button and make it visible. # = <<-EOS login_button = document.getElementById('btnLogin'); login_button.disabled = false; login_button.style.visibility = 'visible'; document.getElementById('lblBrowserCheck').textContent = "Automation courtesy of AdminModule" EOS @browser.execute_script() end |
#get_dynamic_url ⇒ Object
18 19 20 |
# File 'lib/admin_module/pages/login_page_400.rb', line 18 def get_dynamic_url AdminModule.configuration.base_url end |
#login_as(username, password) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/admin_module/pages/login_page_400.rb', line 27 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 self.password = password login end |
#logout ⇒ Object
49 50 51 |
# File 'lib/admin_module/pages/login_page_400.rb', line 49 def logout navigate_to get_dynamic_url + '/user/logout.aspx' end |