Class: LoginPage
- Inherits:
-
Object
- Object
- LoginPage
- Defined in:
- lib/leap_salesforce_ui/login_page.rb
Constant Summary collapse
- DISABLE_2STEP_URL =
"https://gitlab.com/leap-dojo/leap_salesforce_ui/-/wikis/Disable-2-step-authentication-and-allow-IP-range"
Class Method Summary collapse
- .browser ⇒ Watir::Browser
- .error_message ⇒ Object
- .error_message? ⇒ Boolean
- .error_message_element ⇒ Object
- .login ⇒ Object
-
.login_manually ⇒ Object
Could be used if a user wants to login through UI for login specific tests which should not be necessary.
Class Method Details
.browser ⇒ Watir::Browser
8 9 10 |
# File 'lib/leap_salesforce_ui/login_page.rb', line 8 def browser LeapSalesforce.browser end |
.error_message ⇒ Object
16 17 18 |
# File 'lib/leap_salesforce_ui/login_page.rb', line 16 def .text end |
.error_message? ⇒ Boolean
20 21 22 |
# File 'lib/leap_salesforce_ui/login_page.rb', line 20 def .present? end |
.error_message_element ⇒ Object
12 13 14 |
# File 'lib/leap_salesforce_ui/login_page.rb', line 12 def browser.div(id: "error") end |
.login ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/leap_salesforce_ui/login_page.rb', line 43 def login raise "Need to set LeapSalesforce.ui_user" unless LeapSalesforce.ui_user LeapSalesforce.logger.info "Logging in as user '#{LeapSalesforce.ui_user}'" if LeapSalesforce.login_through_session browser.goto SoqlHandler.instance_url user = LeapSalesforce::Users.where username: LeapSalesforce.ui_user session = LeapSalesforce::Session.new user.username, LeapSalesforce.password, user.security_token browser..add "sid", session.session_id browser..add "sidClient", session.user_id browser.goto SoqlHandler.instance_url else browser.goto "#{LeapSalesforce.general_url}/?un=#{LeapSalesforce.ui_user}&pw=#{LeapSalesforce.password}" end = browser.(id: "thePage:inputForm:continue") if .exists? browser.checkbox(id: "thePage:inputForm:remember").set .click end end |
.login_manually ⇒ Object
Could be used if a user wants to login through UI for login specific tests which should not be necessary
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/leap_salesforce_ui/login_page.rb', line 26 def login_manually browser.goto LeapSalesforce.general_url browser.text_field(id: "username").set(LeapSalesforce.ui_user) browser.text_field(id: "password").set(LeapSalesforce.password) browser.(id: "Login").click Watir::Wait.until(timeout: 60, message: "Did not login within the expected time") do raise "Cannot Login. #{}" if if browser.url.include? "_ui/identity/verification/" raise LeapSalesforce::SetupError, "2 step verification page appears. Go to #{DISABLE_2STEP_URL} to learn how to disable it" end !browser.url.include? LeapSalesforce.general_url end end |