Class: Booth::Testing::Userland::RegistrationWithPasskey

Inherits:
IncorporationTestCase show all
Defined in:
lib/booth/testing/userland/registration_with_passkey.rb

Instance Method Summary collapse

Methods included from Shortcuts

#assert_logged_in, #assert_logged_out, #assert_userland_view, #create_and_onboard, #login_with_passkey, #register_new_passkey, #soft_reset_session, #virtual_authenticators, #visit_namespaced

Instance Method Details

#callObject



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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/booth/testing/userland/registration_with_passkey.rb', line 7

def call
  before_test&.call

  # Register

  visit_namespaced controller: :registrations, action: :new

  return 'Skipping self-registration tests' if page.has_text?('HTTP ERROR 410') # Chrome Page

  virtual_authenticators.create

  assert_userland_view controller: :registrations, step: :choose_username

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

  visit_namespaced controller: :webauths, action: :new

  assert_userland_view controller: :webauths, step: :register

  click_on :register

  assert_userland_view controller: :webauths, step: :choose_nickname

  fill_in :nickname, with: 'My Yubikey'
  click_on :submit

  assert_userland_view controller: :webauths, step: :confirm
  click_on :test

  # ------------ SIGNIFICANT TEST --------------
  # Registering a Passkey via the Browser works.
  # --------------------------------------------
  assert_userland_view controller: :webauths, step: :completed

  soft_reset_session

  # Login

  visit_namespaced controller: :logins, action: :new

  assert_userland_view controller: :logins, step: :enter_username

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

  # --------------------- SIGNIFICANT TEST -------------------------
  # Without actually logging out, a Session is still regarded alive.
  # ----------------------------------------------------------------
  assert_userland_view controller: :logins, step: :remote_session_available

  click_on :skip

  assert_userland_view controller: :logins, step: :enter_webauth

  # --------------------- SIGNIFICANT TEST --------------------------
  # After registration and adding a Passkey, you can use it to login.
  # -----------------------------------------------------------------
  click_on :authenticate

  visit_namespaced controller: :webauths, action: :index

  assert_userland_view controller: :webauths, step: :index

  # Try to register when already logged in

  visit_namespaced controller: :registrations, action: :new

  assert_userland_view controller: :registrations, step: :already_logged_in

  visit_namespaced controller: :webauths, action: :new

  assert_userland_view controller: :webauths, step: :register

  click_on :register

  assert_userland_view controller: :webauths, step: :register

  # --------------------- SIGNIFICANT TEST ---------------
  # A hardware device cannot be registered multiple times.
  # ------------------------------------------------------
  assert_text 'already registered with the relying party'
end