diff options
| author | Gabriel Mazetto <brodock@gmail.com> | 2018-10-02 20:17:08 -0300 |
|---|---|---|
| committer | Gabriel Mazetto <brodock@gmail.com> | 2018-11-22 03:53:46 +0100 |
| commit | 84ce9b2edb420479c8b69c4e6ff4881303087fa5 (patch) | |
| tree | 348b289507b22127f2db651c10bf2273077705ec /spec | |
| parent | 11c6596c057b675a846ff6eeff46c12f49372180 (diff) | |
| download | gitlab-ce-update-test-gems.tar.gz | |
Update Test related gemsupdate-test-gems
Upgrade to latest version the following gems:
* capybara
* capybara-screenshot
* selenium-webdriver
Updated specs to fix inconsistencies with capybara 3.x
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/features/admin/admin_hooks_spec.rb | 12 | ||||
| -rw-r--r-- | spec/features/projects/members/user_requests_access_spec.rb | 2 | ||||
| -rw-r--r-- | spec/features/u2f_spec.rb | 10 | ||||
| -rw-r--r-- | spec/support/capybara.rb | 2 | ||||
| -rw-r--r-- | spec/support/shared_examples/features/master_manages_access_requests_shared_example.rb | 9 | ||||
| -rw-r--r-- | spec/views/projects/commit/show.html.haml_spec.rb | 5 |
6 files changed, 33 insertions, 7 deletions
diff --git a/spec/features/admin/admin_hooks_spec.rb b/spec/features/admin/admin_hooks_spec.rb index 25ed3bdc88e..370077771d0 100644 --- a/spec/features/admin/admin_hooks_spec.rb +++ b/spec/features/admin/admin_hooks_spec.rb @@ -81,14 +81,22 @@ describe 'Admin::Hooks' do it 'from hooks list page' do visit admin_hooks_path - expect { accept_confirm { find(:link, 'Remove').send_keys(:return) } }.to change(SystemHook, :count).by(-1) + expect do + accept_confirm { find(:link, 'Remove').send_keys(:return) } + + wait_for_requests + end.to change(SystemHook, :count).by(-1) end it 'from hook edit page' do visit admin_hooks_path click_link 'Edit' - expect { accept_confirm { find(:link, 'Remove').send_keys(:return) } }.to change(SystemHook, :count).by(-1) + expect do + accept_confirm { find(:link, 'Remove').send_keys(:return) } + + wait_for_requests + end.to change(SystemHook, :count).by(-1) end end end diff --git a/spec/features/projects/members/user_requests_access_spec.rb b/spec/features/projects/members/user_requests_access_spec.rb index 50ba67f0ffc..d3b9002d92c 100644 --- a/spec/features/projects/members/user_requests_access_spec.rb +++ b/spec/features/projects/members/user_requests_access_spec.rb @@ -62,6 +62,8 @@ describe 'Projects > Members > User requests access', :js do accept_confirm { click_link 'Withdraw Access Request' } + wait_for_requests + expect(project.requesters.exists?(user_id: user)).to be_falsey expect(page).to have_content 'Your access request to the project has been withdrawn.' end diff --git a/spec/features/u2f_spec.rb b/spec/features/u2f_spec.rb index ae9b65d1a39..2d31e2dca0f 100644 --- a/spec/features/u2f_spec.rb +++ b/spec/features/u2f_spec.rb @@ -75,7 +75,13 @@ describe 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do first_u2f_device = register_u2f_device second_u2f_device = register_u2f_device(name: 'My other device') - accept_confirm { click_on "Delete", match: :first } + accept_confirm do + within('table.u2f-registrations') do + find('tr', text: first_u2f_device.name).click_link('Delete') + end + end + + wait_for_requests expect(page).to have_content('Successfully deleted') expect(page.body).not_to match(first_u2f_device.name) @@ -263,6 +269,8 @@ describe 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do visit profile_two_factor_auth_path expect do accept_confirm { click_on "Disable" } + + wait_for_requests end.to change { U2fRegistration.count }.by(-1) end end diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index 18a7a392c12..fe2483e0567 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -51,6 +51,8 @@ end Capybara.javascript_driver = :chrome Capybara.default_max_wait_time = timeout Capybara.ignore_hidden_elements = true +Capybara.server = :webrick +Capybara.default_normalize_ws = true # Keep only the screenshots generated from the last failing test suite Capybara::Screenshot.prune_strategy = :keep_last_run diff --git a/spec/support/shared_examples/features/master_manages_access_requests_shared_example.rb b/spec/support/shared_examples/features/master_manages_access_requests_shared_example.rb index 75ad948e42c..1b2caef405e 100644 --- a/spec/support/shared_examples/features/master_manages_access_requests_shared_example.rb +++ b/spec/support/shared_examples/features/master_manages_access_requests_shared_example.rb @@ -1,10 +1,11 @@ RSpec.shared_examples 'Maintainer manages access requests' do - let(:user) { create(:user) } let(:maintainer) { create(:user) } + let(:user) { create(:user) } before do entity.request_access(user) entity.respond_to?(:add_owner) ? entity.add_owner(maintainer) : entity.add_maintainer(maintainer) + sign_in(maintainer) end @@ -19,7 +20,7 @@ RSpec.shared_examples 'Maintainer manages access requests' do expect_visible_access_request(entity, user) - accept_confirm { click_on 'Grant access' } + click_on 'Grant access' expect_no_visible_access_request(entity, user) @@ -43,9 +44,13 @@ RSpec.shared_examples 'Maintainer manages access requests' do 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 user.name + + WaitForRequests.wait_for_requests end def expect_no_visible_access_request(entity, user) + WaitForRequests.wait_for_requests + expect(entity.requesters.exists?(user_id: user)).to be_falsy expect(page).not_to have_content "Users requesting access to #{entity.name}" end diff --git a/spec/views/projects/commit/show.html.haml_spec.rb b/spec/views/projects/commit/show.html.haml_spec.rb index a9c32122600..c8b597de37c 100644 --- a/spec/views/projects/commit/show.html.haml_spec.rb +++ b/spec/views/projects/commit/show.html.haml_spec.rb @@ -54,9 +54,10 @@ describe 'projects/commit/show.html.haml' do end it 'shows that it is in the context of a merge request' do - merge_request_url = diffs_project_merge_request_url(project, merge_request, commit_id: commit.id) + merge_request_url = diffs_project_merge_request_path(project, merge_request, commit_id: commit.id) + expect(rendered).to have_content("This commit is part of merge request") - expect(rendered).to have_link(merge_request.to_reference, merge_request_url) + expect(rendered).to have_link(merge_request.to_reference, href: merge_request_url) end end end |
