diff options
Diffstat (limited to 'spec/features/projects')
14 files changed, 92 insertions, 168 deletions
diff --git a/spec/features/projects/services/user_activates_asana_spec.rb b/spec/features/projects/services/user_activates_asana_spec.rb index b07c77da554..dac60fce6e9 100644 --- a/spec/features/projects/services/user_activates_asana_spec.rb +++ b/spec/features/projects/services/user_activates_asana_spec.rb @@ -3,23 +3,14 @@ require 'spec_helper' describe 'User activates Asana' do - let(:project) { create(:project) } - let(:user) { create(:user) } + include_context 'project service activation' - before do - project.add_maintainer(user) - sign_in(user) - - visit(project_settings_integrations_path(project)) - - click_link('Asana') - end - - it 'activates service' do - check('Active') + it 'activates service', :js do + visit_project_integration('Asana') fill_in('Api key', with: 'verySecret') fill_in('Restrict to branch', with: 'verySecret') - click_button('Save') + + click_test_then_save_integration expect(page).to have_content('Asana activated.') end diff --git a/spec/features/projects/services/user_activates_assembla_spec.rb b/spec/features/projects/services/user_activates_assembla_spec.rb index 56f7beb8f4b..999a95e3e23 100644 --- a/spec/features/projects/services/user_activates_assembla_spec.rb +++ b/spec/features/projects/services/user_activates_assembla_spec.rb @@ -3,22 +3,17 @@ require 'spec_helper' describe 'User activates Assembla' do - let(:project) { create(:project) } - let(:user) { create(:user) } + include_context 'project service activation' before do - project.add_maintainer(user) - sign_in(user) - - visit(project_settings_integrations_path(project)) - - click_link('Assembla') + stub_request(:post, /.*atlas.assembla.com.*/) end - it 'activates service' do - check('Active') + it 'activates service', :js do + visit_project_integration('Assembla') fill_in('Token', with: 'verySecret') - click_button('Save') + + click_test_integration expect(page).to have_content('Assembla activated.') end diff --git a/spec/features/projects/services/user_activates_atlassian_bamboo_ci_spec.rb b/spec/features/projects/services/user_activates_atlassian_bamboo_ci_spec.rb index c694eeb1cc2..28ed08f71b6 100644 --- a/spec/features/projects/services/user_activates_atlassian_bamboo_ci_spec.rb +++ b/spec/features/projects/services/user_activates_atlassian_bamboo_ci_spec.rb @@ -3,31 +3,26 @@ require 'spec_helper' describe 'User activates Atlassian Bamboo CI' do - let(:project) { create(:project) } - let(:user) { create(:user) } + include_context 'project service activation' before do - project.add_maintainer(user) - sign_in(user) - - visit(project_settings_integrations_path(project)) - - click_link('Atlassian Bamboo CI') + stub_request(:get, /.*bamboo.example.com.*/) end - it 'activates service' do - check('Active') + it 'activates service', :js do + visit_project_integration('Atlassian Bamboo CI') fill_in('Bamboo url', with: 'http://bamboo.example.com') fill_in('Build key', with: 'KEY') fill_in('Username', with: 'user') fill_in('Password', with: 'verySecret') - click_button('Save') + + click_test_integration expect(page).to have_content('Atlassian Bamboo CI activated.') # Password field should not be filled in. click_link('Atlassian Bamboo CI') - expect(find_field('Enter new password').value).to be_nil + expect(find_field('Enter new password').value).to be_blank end end diff --git a/spec/features/projects/services/user_activates_emails_on_push_spec.rb b/spec/features/projects/services/user_activates_emails_on_push_spec.rb index 2015b658295..42c069eb29e 100644 --- a/spec/features/projects/services/user_activates_emails_on_push_spec.rb +++ b/spec/features/projects/services/user_activates_emails_on_push_spec.rb @@ -3,22 +3,13 @@ require 'spec_helper' describe 'User activates Emails on push' do - let(:project) { create(:project) } - let(:user) { create(:user) } + include_context 'project service activation' - before do - project.add_maintainer(user) - sign_in(user) - - visit(project_settings_integrations_path(project)) - - click_link('Emails on push') - end - - it 'activates service' do - check('Active') + it 'activates service', :js do + visit_project_integration('Emails on push') fill_in('Recipients', with: 'qa@company.name') - click_button('Save') + + click_test_integration expect(page).to have_content('Emails on push activated.') end diff --git a/spec/features/projects/services/user_activates_flowdock_spec.rb b/spec/features/projects/services/user_activates_flowdock_spec.rb index fc8e75daa0d..4762363b3fe 100644 --- a/spec/features/projects/services/user_activates_flowdock_spec.rb +++ b/spec/features/projects/services/user_activates_flowdock_spec.rb @@ -3,22 +3,19 @@ require 'spec_helper' describe 'User activates Flowdock' do - let(:project) { create(:project) } - let(:user) { create(:user) } + include_context 'project service activation' do + let(:project) { create(:project, :repository) } + end before do - project.add_maintainer(user) - sign_in(user) - - visit(project_settings_integrations_path(project)) - - click_link('Flowdock') + stub_request(:post, /.*api.flowdock.com.*/) end - it 'activates service' do - check('Active') + it 'activates service', :js do + visit_project_integration('Flowdock') fill_in('Token', with: 'verySecret') - click_button('Save') + + click_test_integration expect(page).to have_content('Flowdock activated.') end diff --git a/spec/features/projects/services/user_activates_hipchat_spec.rb b/spec/features/projects/services/user_activates_hipchat_spec.rb index d6b69a5bd68..2fb056f3533 100644 --- a/spec/features/projects/services/user_activates_hipchat_spec.rb +++ b/spec/features/projects/services/user_activates_hipchat_spec.rb @@ -2,37 +2,37 @@ require 'spec_helper' -describe 'User activates HipChat' do - let(:project) { create(:project) } - let(:user) { create(:user) } - - before do - project.add_maintainer(user) - sign_in(user) - - visit(project_settings_integrations_path(project)) - - click_link('HipChat') - end +describe 'User activates HipChat', :js do + include_context 'project service activation' context 'with standart settings' do + before do + stub_request(:post, /.*api.hipchat.com.*/) + end + it 'activates service' do - check('Active') + visit_project_integration('HipChat') fill_in('Room', with: 'gitlab') fill_in('Token', with: 'verySecret') - click_button('Save') + + click_test_integration expect(page).to have_content('HipChat activated.') end end context 'with custom settings' do + before do + stub_request(:post, /.*chat.example.com.*/) + end + it 'activates service' do - check('Active') + visit_project_integration('HipChat') fill_in('Room', with: 'gitlab_custom') fill_in('Token', with: 'secretCustom') fill_in('Server', with: 'https://chat.example.com') - click_button('Save') + + click_test_integration expect(page).to have_content('HipChat activated.') end diff --git a/spec/features/projects/services/user_activates_irker_spec.rb b/spec/features/projects/services/user_activates_irker_spec.rb index 898e16ce835..56df403499c 100644 --- a/spec/features/projects/services/user_activates_irker_spec.rb +++ b/spec/features/projects/services/user_activates_irker_spec.rb @@ -3,23 +3,14 @@ require 'spec_helper' describe 'User activates Irker (IRC gateway)' do - let(:project) { create(:project) } - let(:user) { create(:user) } + include_context 'project service activation' - before do - project.add_maintainer(user) - sign_in(user) - - visit(project_settings_integrations_path(project)) - - click_link('Irker (IRC gateway)') - end - - it 'activates service' do - check('Active') + it 'activates service', :js do + visit_project_integration('Irker (IRC gateway)') check('Colorize messages') fill_in('Recipients', with: 'irc://chat.freenode.net/#commits') - click_button('Save') + + click_test_integration expect(page).to have_content('Irker (IRC gateway) activated.') end diff --git a/spec/features/projects/services/user_activates_jetbrains_teamcity_ci_spec.rb b/spec/features/projects/services/user_activates_jetbrains_teamcity_ci_spec.rb index 9842141285a..8c84a81ac89 100644 --- a/spec/features/projects/services/user_activates_jetbrains_teamcity_ci_spec.rb +++ b/spec/features/projects/services/user_activates_jetbrains_teamcity_ci_spec.rb @@ -3,27 +3,22 @@ require 'spec_helper' describe 'User activates JetBrains TeamCity CI' do - let(:project) { create(:project) } - let(:user) { create(:user) } + include_context 'project service activation' before do - project.add_maintainer(user) - sign_in(user) - - visit(project_settings_integrations_path(project)) - - click_link('JetBrains TeamCity CI') + stub_request(:post, /.*teamcity.example.com.*/) end - it 'activates service' do - check('Active') + it 'activates service', :js do + visit_project_integration('JetBrains TeamCity CI') check('Push') check('Merge request') fill_in('Teamcity url', with: 'http://teamcity.example.com') fill_in('Build type', with: 'GitlabTest_Build') fill_in('Username', with: 'user') fill_in('Password', with: 'verySecret') - click_button('Save') + + click_test_integration expect(page).to have_content('JetBrains TeamCity CI activated.') end diff --git a/spec/features/projects/services/user_activates_packagist_spec.rb b/spec/features/projects/services/user_activates_packagist_spec.rb index 85bd15adbe5..274f293ebf3 100644 --- a/spec/features/projects/services/user_activates_packagist_spec.rb +++ b/spec/features/projects/services/user_activates_packagist_spec.rb @@ -3,23 +3,18 @@ require 'spec_helper' describe 'User activates Packagist' do - let(:project) { create(:project) } - let(:user) { create(:user) } + include_context 'project service activation' before do - project.add_maintainer(user) - sign_in(user) - - visit(project_settings_integrations_path(project)) - - click_link('Packagist') + stub_request(:post, /.*packagist.org.*/) end - it 'activates service' do - check('Active') + it 'activates service', :js do + visit_project_integration('Packagist') fill_in('Username', with: 'theUser') fill_in('Token', with: 'verySecret') - click_button('Save') + + click_test_then_save_integration expect(page).to have_content('Packagist activated.') end diff --git a/spec/features/projects/services/user_activates_pivotaltracker_spec.rb b/spec/features/projects/services/user_activates_pivotaltracker_spec.rb index 67ff99c0295..c81c5081867 100644 --- a/spec/features/projects/services/user_activates_pivotaltracker_spec.rb +++ b/spec/features/projects/services/user_activates_pivotaltracker_spec.rb @@ -3,22 +3,17 @@ require 'spec_helper' describe 'User activates PivotalTracker' do - let(:project) { create(:project) } - let(:user) { create(:user) } + include_context 'project service activation' before do - project.add_maintainer(user) - sign_in(user) - - visit(project_settings_integrations_path(project)) - - click_link('PivotalTracker') + stub_request(:post, /.*www.pivotaltracker.com.*/) end - it 'activates service' do - check('Active') + it 'activates service', :js do + visit_project_integration('PivotalTracker') fill_in('Token', with: 'verySecret') - click_button('Save') + + click_test_integration expect(page).to have_content('PivotalTracker activated.') end diff --git a/spec/features/projects/services/user_activates_prometheus_spec.rb b/spec/features/projects/services/user_activates_prometheus_spec.rb index ab372d532aa..76dc7d1bbc8 100644 --- a/spec/features/projects/services/user_activates_prometheus_spec.rb +++ b/spec/features/projects/services/user_activates_prometheus_spec.rb @@ -3,21 +3,17 @@ require 'spec_helper' describe 'User activates Prometheus' do - let(:project) { create(:project) } - let(:user) { create(:user) } + include_context 'project service activation' before do - project.add_maintainer(user) - sign_in(user) - - visit(project_settings_integrations_path(project)) - - click_link('Prometheus') + stub_request(:get, /.*prometheus.example.com.*/) end - it 'does not activate service and informs about deprecation' do + it 'does not activate service and informs about deprecation', :js do + visit_project_integration('Prometheus') check('Active') fill_in('API URL', with: 'http://prometheus.example.com') + click_button('Save changes') expect(page).not_to have_content('Prometheus activated.') diff --git a/spec/features/projects/services/user_activates_pushover_spec.rb b/spec/features/projects/services/user_activates_pushover_spec.rb index 34e1cf33f36..62e03e68aee 100644 --- a/spec/features/projects/services/user_activates_pushover_spec.rb +++ b/spec/features/projects/services/user_activates_pushover_spec.rb @@ -3,26 +3,21 @@ require 'spec_helper' describe 'User activates Pushover' do - let(:project) { create(:project) } - let(:user) { create(:user) } + include_context 'project service activation' before do - project.add_maintainer(user) - sign_in(user) - - visit(project_settings_integrations_path(project)) - - click_link('Pushover') + stub_request(:post, /.*api.pushover.net.*/) end - it 'activates service' do - check('Active') + it 'activates service', :js do + visit_project_integration('Pushover') fill_in('Api key', with: 'verySecret') fill_in('User key', with: 'verySecret') fill_in('Device', with: 'myDevice') select('High Priority', from: 'Priority') select('Bike', from: 'Sound') - click_button('Save') + + click_test_integration expect(page).to have_content('Pushover activated.') end diff --git a/spec/features/projects/services/user_activates_slack_notifications_spec.rb b/spec/features/projects/services/user_activates_slack_notifications_spec.rb index f23b1d3102a..12f15699e26 100644 --- a/spec/features/projects/services/user_activates_slack_notifications_spec.rb +++ b/spec/features/projects/services/user_activates_slack_notifications_spec.rb @@ -3,32 +3,26 @@ require 'spec_helper' describe 'User activates Slack notifications' do - let(:user) { create(:user) } - let(:service) { SlackService.new } - let(:project) { create(:project, slack_service: service) } - - before do - project.add_maintainer(user) - sign_in(user) - end + include_context 'project service activation' context 'when service is not configured yet' do before do - visit(project_settings_integrations_path(project)) - - click_link('Slack notifications') + visit_project_integration('Slack notifications') end - it 'activates service' do - check('Active') + it 'activates service', :js do fill_in('Webhook', with: 'https://hooks.slack.com/services/SVRWFV0VVAR97N/B02R25XN3/ZBqu7xMupaEEICInN685') - click_button('Save') + + click_test_then_save_integration expect(page).to have_content('Slack notifications activated.') end end context 'when service is already configured' do + let(:service) { SlackService.new } + let(:project) { create(:project, slack_service: service) } + before do service.fields service.update( diff --git a/spec/features/projects/services/user_views_services_spec.rb b/spec/features/projects/services/user_views_services_spec.rb index cf403a131b0..6df0123c30a 100644 --- a/spec/features/projects/services/user_views_services_spec.rb +++ b/spec/features/projects/services/user_views_services_spec.rb @@ -3,17 +3,11 @@ require 'spec_helper' describe 'User views services' do - let(:project) { create(:project) } - let(:user) { create(:user) } - - before do - project.add_maintainer(user) - sign_in(user) - - visit(project_settings_integrations_path(project)) - end + include_context 'project service activation' it 'shows the list of available services' do + visit_project_integrations + expect(page).to have_content('Integrations') expect(page).to have_content('Campfire') expect(page).to have_content('HipChat') |