Class: Booth::Test::Userland::Logins::UsernamePasswordAndOtp

Inherits:
Object
  • Object
show all
Includes:
MethodObject, Helpers
Defined in:
lib/booth/test/userland/logins/username_password_and_otp.rb

Instance Method Summary collapse

Methods included from Helpers

#assert_logged_in, #assert_logged_out, #assert_userland_partial, #create_virtual_authenticator, #extract_otp_secret_key_and_generate_code, #setup_virtual_authenticator_environment, #soft_reset_session

Methods included from MethodObject

included

Instance Method Details

#callObject



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
40
# File 'lib/booth/test/userland/logins/username_password_and_otp.rb', line 13

def call
  credential = ::Booth::Models::Credential.create!(
    username: 'alice',
    password: 'qwrasfyxv',
    scope:,
    mode: :username_password_and_otp,
    allowed_modes: [:username_password_and_otp]
  )

  page.visit 

  assert_userland_partial controller: :login, step: :enter_username

  page.fill_in :username, with: 'alice'
  page.click_on :submit

  assert_userland_partial controller: :login, step: :enter_password

  page.fill_in :password, with: 'qwrasfyxv'
  page.click_on :submit

  assert_userland_partial controller: :login, step: :enter_otp

  page.fill_in :code, with: credential.otp_code
  page.click_on :submit

  assert_logged_in credential:
end