Welcome to mirror list, hosted at ThFree Co, Russian Federation.

login.rb « main « page « gitlab « lib « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: de05df1a086bef468cb0fb76fae1ff212590d89f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 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

        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)
          self.login_field = username
          self.password_field = password

          sign_in_button
          self.accept_terms if accept_terms && accept_terms?
        end
      end
    end
  end
end