|
14 | 14 | authenticator.remove! |
15 | 15 | end |
16 | 16 |
|
| 17 | + # rubocop:disable RSpec/MultipleExpectations |
17 | 18 | describe "sign in using passkeys" do |
18 | 19 | before do |
19 | 20 | add_passkey_to_authenticator(authenticator, user) |
|
23 | 24 | visit new_account_session_path |
24 | 25 | click_button "Log in with passkeys" |
25 | 26 |
|
| 27 | + expect(page).to have_current_path(root_path) |
26 | 28 | expect(page).to have_content("Signed in successfully.") |
27 | 29 | end |
28 | 30 |
|
|
34 | 36 |
|
35 | 37 | click_button "Log in" |
36 | 38 |
|
| 39 | + expect(page).to have_current_path(new_account_two_factor_authentication_path) |
37 | 40 | expect(page).to have_content("Two-factor authentication is required to sign in.") |
38 | 41 |
|
39 | 42 | click_button "Use security key" |
40 | 43 |
|
| 44 | + expect(page).to have_current_path(root_path) |
41 | 45 | expect(page).to have_content("Signed in successfully.") |
42 | 46 | end |
43 | 47 | end |
| 48 | + # rubocop:enable RSpec/MultipleExpectations |
44 | 49 |
|
| 50 | + # rubocop:disable RSpec/MultipleExpectations |
45 | 51 | describe "sign in with security keys as second factor" do |
46 | 52 | before do |
47 | 53 | add_security_key_to_authenticator(authenticator, user) |
|
55 | 61 |
|
56 | 62 | click_button "Log in" |
57 | 63 |
|
| 64 | + expect(page).to have_current_path(new_account_two_factor_authentication_path) |
58 | 65 | expect(page).to have_content("Two-factor authentication is required to sign in.") |
59 | 66 |
|
60 | 67 | click_button "Use security key" |
61 | 68 |
|
| 69 | + expect(page).to have_current_path(root_path) |
62 | 70 | expect(page).to have_content("Signed in successfully.") |
63 | 71 | expect(remember_cookie).to be_nil |
64 | 72 | end |
|
77 | 85 |
|
78 | 86 | click_button "Log in" |
79 | 87 |
|
| 88 | + expect(page).to have_current_path(new_account_two_factor_authentication_path) |
80 | 89 | expect(page).to have_content("Two-factor authentication is required to sign in.") |
81 | 90 |
|
82 | 91 | click_button "Use security key" |
83 | 92 |
|
| 93 | + expect(page).to have_current_path(new_account_two_factor_authentication_path) |
84 | 94 | expect(page).to have_content("Webauthn credential verification failed.") |
85 | 95 | expect(page).to have_button("Use security key") |
86 | 96 | end |
|
96 | 106 |
|
97 | 107 | click_button "Log in" |
98 | 108 |
|
| 109 | + expect(page).to have_current_path(new_account_two_factor_authentication_path) |
99 | 110 | expect(page).to have_content("Two-factor authentication is required to sign in.") |
100 | 111 |
|
101 | 112 | click_button "Use security key" |
102 | 113 |
|
| 114 | + expect(page).to have_current_path(root_path) |
103 | 115 | expect(page).to have_content("Signed in successfully.") |
104 | 116 | expect(remember_cookie).to be_present |
105 | 117 | end |
106 | 118 | end |
107 | 119 | end |
| 120 | + # rubocop:enable RSpec/MultipleExpectations |
108 | 121 |
|
109 | 122 | def remember_cookie |
110 | 123 | page.driver.browser.manage.cookie_named("remember_account_token") |
|
0 commit comments