blob: 17a7471e25158947233d7208f91686c5421ea5e0 (
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
|
# frozen_string_literal: true
require 'capybara/dsl'
require 'benchmark'
module QA
module Vendor
module Github
module Page
class Login < 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
end
def authorize_app
click_on 'Authorize' if has_button?('Authorize')
end
end
end
end
end
end
|