2021-10-27 15:23:28 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Page
|
|
|
|
module Main
|
|
|
|
class Login < Chemlab::Page
|
|
|
|
path '/users/sign_in'
|
|
|
|
|
|
|
|
text_field :login_field
|
|
|
|
text_field :password_field
|
|
|
|
button :sign_in_button
|
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
button :accept_terms, text: 'Accept terms'
|
|
|
|
|
|
|
|
# password change tab
|
|
|
|
text_field :password_confirmation_field
|
|
|
|
button :change_password_button
|
|
|
|
|
|
|
|
# Sign in using a given username and password
|
|
|
|
# @note this will also automatically accept terms if prompted
|
|
|
|
# @param [String] username the username to sign in with
|
|
|
|
# @param [String] password the password to sign in with
|
|
|
|
# @example
|
|
|
|
# Page::Main::Login.perform do |login|
|
|
|
|
# login.sign_in_as(username: 'username', password: 'password')
|
|
|
|
# login.sign_in_as(username: 'username', password: 'password', accept_terms: false)
|
|
|
|
# end
|
|
|
|
def sign_in_as(username:, password:, accept_terms: true)
|
2021-10-27 15:23:28 +05:30
|
|
|
self.login_field = username
|
|
|
|
self.password_field = password
|
|
|
|
|
|
|
|
sign_in_button
|
2021-11-18 22:05:49 +05:30
|
|
|
self.accept_terms if accept_terms && accept_terms?
|
2021-10-27 15:23:28 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|