Class: Booth::Test::Userland::Logins::UsernameAndWebauth

Inherits:
Object
  • Object
show all
Includes:
MethodObject, Helpers
Defined in:
lib/booth/test/userland/logins/username_and_webauth.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



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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/booth/test/userland/logins/username_and_webauth.rb', line 15

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

  onboarding = ::Booth::Models::Onboarding.create!(
    credential_id: credential.id,
    mode: :username_and_webauth
  )

  page.visit show_onboarding_path.sub('ID', onboarding.secret_key)
  create_virtual_authenticator

  assert_userland_partial controller: :onboarding, step: :register_webauth

  page.click_on :register

  assert_userland_partial controller: :onboarding, step: :choose_webauth_nickname

  page.fill_in :nickname, with: 'Yubikey'
  page.click_on :submit

  assert_userland_partial controller: :onboarding, step: :confirm_webauth

  page.click_on :authenticate

  assert_userland_partial controller: :onboarding, step: :completed
  assert_logged_in credential: credential

  soft_reset_session
  assert_logged_out

  # Login

  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: :remote_session_available

  page.click_on :skip

  assert_userland_partial controller: :login, step: :enter_webauth

  page.click_on :authenticate

  assert_logged_in credential:
end