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

login.rb « page « github « vendor « qa « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ce71fc5f11e1e93a83f7c4dcc2d21eda478d23c6 (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
39
# frozen_string_literal: true

module QA
  module Vendor
    module Github
      module Page
        class Login < Vendor::Page::Base
          def login
            fill_in 'login', with: QA::Runtime::Env.github_username
            fill_in 'password', with: QA::Runtime::Env.github_password
            click_on 'Sign in'

            current_otp = OnePassword::CLI.instance.current_otp

            fill_in 'app_otp', with: current_otp

            if has_text?('Two-factor authentication failed', wait: 2)
              new_otp = OnePassword::CLI.instance.new_otp(otp)

              fill_in 'app_otp', with: new_otp
            end

            authorize_app

            confirm_account_recovery_settings
          end

          def authorize_app
            click_on 'Authorize' if has_button?('Authorize')
          end

          def confirm_account_recovery_settings
            click_on 'Confirm' if has_button?('Confirm')
          end
        end
      end
    end
  end
end