Commit 5f36bb92 authored by Rémy Coutable's avatar Rémy Coutable

Fix a few specs after updating capybara and selenium-webdriver

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent f766f7af
...@@ -73,22 +73,26 @@ describe 'Admin::Hooks' do ...@@ -73,22 +73,26 @@ describe 'Admin::Hooks' do
end end
describe 'Remove existing hook', :js do describe 'Remove existing hook', :js do
let(:hook_url) { generate(:url) }
before do before do
create(:system_hook) create(:system_hook, url: hook_url)
end end
context 'removes existing hook' do context 'removes existing hook' do
it 'from hooks list page' do it 'from hooks list page' do
visit admin_hooks_path visit admin_hooks_path
expect { accept_confirm { find(:link, 'Remove').send_keys(:return) } }.to change(SystemHook, :count).by(-1) accept_confirm { click_link 'Remove' }
expect(page).not_to have_content(hook_url)
end end
it 'from hook edit page' do it 'from hook edit page' do
visit admin_hooks_path visit admin_hooks_path
click_link 'Edit' click_link 'Edit'
expect { accept_confirm { find(:link, 'Remove').send_keys(:return) } }.to change(SystemHook, :count).by(-1) accept_confirm { click_link 'Remove' }
expect(page).not_to have_content(hook_url)
end end
end end
end end
......
...@@ -62,8 +62,9 @@ describe 'Projects > Members > User requests access', :js do ...@@ -62,8 +62,9 @@ describe 'Projects > Members > User requests access', :js do
accept_confirm { click_link 'Withdraw Access Request' } accept_confirm { click_link 'Withdraw Access Request' }
expect(project.requesters.exists?(user_id: user)).to be_falsey
expect(page).to have_content 'Your access request to the project has been withdrawn.' expect(page).to have_content 'Your access request to the project has been withdrawn.'
expect(page).not_to have_content 'Withdraw Access Request'
expect(page).to have_content 'Request Access'
end end
def open_project_settings_menu def open_project_settings_menu
......
...@@ -246,26 +246,6 @@ describe 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do ...@@ -246,26 +246,6 @@ describe 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do
end end
end end
end end
describe "when two-factor authentication is disabled" do
let(:user) { create(:user) }
before do
user = gitlab_sign_in(:user)
user.update_attribute(:otp_required_for_login, true)
visit profile_account_path
manage_two_factor_authentication
expect(page).to have_content("Your U2F device needs to be set up.")
register_u2f_device
end
it "deletes u2f registrations" do
visit profile_two_factor_auth_path
expect do
accept_confirm { click_on "Disable" }
end.to change { U2fRegistration.count }.by(-1)
end
end
end end
describe 'fallback code authentication' do describe 'fallback code authentication' do
......
...@@ -19,7 +19,7 @@ RSpec.shared_examples 'Maintainer manages access requests' do ...@@ -19,7 +19,7 @@ RSpec.shared_examples 'Maintainer manages access requests' do
expect_visible_access_request(entity, user) expect_visible_access_request(entity, user)
accept_confirm { click_on 'Grant access' } click_on 'Grant access'
expect_no_visible_access_request(entity, user) expect_no_visible_access_request(entity, user)
...@@ -40,13 +40,11 @@ RSpec.shared_examples 'Maintainer manages access requests' do ...@@ -40,13 +40,11 @@ RSpec.shared_examples 'Maintainer manages access requests' do
end end
def expect_visible_access_request(entity, user) def expect_visible_access_request(entity, user)
expect(entity.requesters.exists?(user_id: user)).to be_truthy
expect(page).to have_content "Users requesting access to #{entity.name} 1" expect(page).to have_content "Users requesting access to #{entity.name} 1"
expect(page).to have_content user.name expect(page).to have_content user.name
end end
def expect_no_visible_access_request(entity, user) def expect_no_visible_access_request(entity, user)
expect(entity.requesters.exists?(user_id: user)).to be_falsy
expect(page).not_to have_content "Users requesting access to #{entity.name}" expect(page).not_to have_content "Users requesting access to #{entity.name}"
end end
end end
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