|
20 | 20 | add_passkey_to_authenticator(authenticator, user) |
21 | 21 | end |
22 | 22 |
|
23 | | - it "allows to create a passkey and then sign in with it" do |
| 23 | + it "allows to sign in with it and does not set the remember cookie when remember me is not checked" do |
24 | 24 | visit new_account_session_path |
25 | 25 | click_button "Log in with passkeys" |
26 | 26 |
|
27 | 27 | expect(page).to have_current_path(root_path) |
28 | 28 | expect(page).to have_content("Signed in successfully.") |
| 29 | + expect(remember_cookie).to be_nil |
| 30 | + end |
| 31 | + |
| 32 | + it "allows to sign in with it and sets the remember cookie when remember me is checked" do |
| 33 | + visit new_account_session_path |
| 34 | + |
| 35 | + within "#passkey-login" do |
| 36 | + check "Remember me" |
| 37 | + click_button "Log in with passkeys" |
| 38 | + end |
| 39 | + |
| 40 | + expect(page).to have_current_path(root_path) |
| 41 | + expect(page).to have_content("Signed in successfully.") |
| 42 | + expect(remember_cookie).to be_present |
29 | 43 | end |
30 | 44 |
|
31 | 45 | it "can use them as second factor authentication" do |
|
100 | 114 | it "sets remember cookie when remember me is checked" do |
101 | 115 | visit new_account_session_path |
102 | 116 |
|
103 | | - fill_in "Email", with: user.email |
104 | | - fill_in "Password", with: "$3cretp@ssword123" |
105 | | - check "Remember me" |
| 117 | + within "#password-login" do |
| 118 | + fill_in "Email", with: user.email |
| 119 | + fill_in "Password", with: "$3cretp@ssword123" |
| 120 | + check "Remember me" |
106 | 121 |
|
107 | | - click_button "Log in" |
| 122 | + click_button "Log in" |
| 123 | + end |
108 | 124 |
|
109 | 125 | expect(page).to have_current_path(new_account_two_factor_authentication_path) |
110 | 126 | expect(page).to have_content("Two-factor authentication is required to sign in.") |
|
0 commit comments