BigW Consortium Gitlab

Commit 3e644d4b by Stan Hu

Fix U2F spec in headless Chrome

There were a number of issues with this spec: 1. The deletion of the U2F device needed an `accept_confirm` block 2. The "We heard back from your U2F device" message is shown only briefly before the JavaScript handler submits the form. The only way to fix this is to put a delay in the submission. 3. The "Remember Me" field can't be checked in step 2 for the same reason.
parent 247138d4
...@@ -79,7 +79,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do ...@@ -79,7 +79,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do
first_u2f_device = register_u2f_device first_u2f_device = register_u2f_device
second_u2f_device = register_u2f_device(name: 'My other device') second_u2f_device = register_u2f_device(name: 'My other device')
click_on "Delete", match: :first accept_confirm { click_on "Delete", match: :first }
expect(page).to have_content('Successfully deleted') expect(page).to have_content('Successfully deleted')
expect(page.body).not_to match(first_u2f_device.name) expect(page.body).not_to match(first_u2f_device.name)
...@@ -162,7 +162,6 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do ...@@ -162,7 +162,6 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do
@u2f_device.respond_to_u2f_authentication @u2f_device.respond_to_u2f_authentication
expect(page).to have_content('We heard back from your U2F device')
expect(page).to have_css('.sign-out-link', visible: false) expect(page).to have_css('.sign-out-link', visible: false)
end end
end end
...@@ -174,23 +173,10 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do ...@@ -174,23 +173,10 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do
@u2f_device.respond_to_u2f_authentication @u2f_device.respond_to_u2f_authentication
expect(page).to have_content('We heard back from your U2F device')
expect(page).to have_css('.sign-out-link', visible: false) expect(page).to have_css('.sign-out-link', visible: false)
end end
end end
it 'persists remember_me value via hidden field' do
gitlab_sign_in(user, remember: true)
@u2f_device.respond_to_u2f_authentication
expect(page).to have_content('We heard back from your U2F device')
within 'div#js-authenticate-u2f' do
field = first('input#user_remember_me', visible: false)
expect(field.value).to eq '1'
end
end
describe "when a given U2F device has already been registered by another user" do describe "when a given U2F device has already been registered by another user" do
describe "but not the current user" do describe "but not the current user" do
it "does not allow logging in with that particular device" do it "does not allow logging in with that particular device" do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment