diff options
Diffstat (limited to 'spec/features')
22 files changed, 509 insertions, 118 deletions
diff --git a/spec/features/merge_requests/widget_spec.rb b/spec/features/merge_requests/widget_spec.rb index fd991293ee9..443b596b3c6 100644 --- a/spec/features/merge_requests/widget_spec.rb +++ b/spec/features/merge_requests/widget_spec.rb @@ -142,6 +142,24 @@ describe 'Merge request', :js do end end + context 'view merge request where project has CI setup but no CI status' do + before do + pipeline = create(:ci_pipeline, project: project, + sha: merge_request.diff_head_sha, + ref: merge_request.source_branch) + create(:ci_build, pipeline: pipeline) + + visit project_merge_request_path(project, merge_request) + end + + it 'has pipeline error text' do + # Wait for the `ci_status` and `merge_check` requests + wait_for_requests + + expect(page).to have_text('Could not connect to the CI server. Please check your settings and try again') + end + end + context 'view merge request with MWPS enabled but automatically merge fails' do before do merge_request.update( diff --git a/spec/features/projects/diffs/diff_show_spec.rb b/spec/features/projects/diffs/diff_show_spec.rb index a6f52c9ef58..c1307ab640f 100644 --- a/spec/features/projects/diffs/diff_show_spec.rb +++ b/spec/features/projects/diffs/diff_show_spec.rb @@ -62,13 +62,43 @@ feature 'Diff file viewer', :js do end context 'Image file' do - before do - visit_commit('2f63565e7aac07bcdadb654e253078b727143ec4') + context 'Replaced' do + before do + visit_commit('2f63565e7aac07bcdadb654e253078b727143ec4') + end + + it 'shows a rendered image' do + within('.diff-file[id="e986451b8f7397b617dbb6fffcb5539328c56921"]') do + expect(page).to have_css('img[alt="files/images/6049019_460s.jpg"]') + end + end + + it 'shows view replaced and view file links' do + expect(page.all('.file-actions a').length).to eq 2 + expect(page.all('.file-actions a')[0]).to have_content 'View replaced file @' + expect(page.all('.file-actions a')[1]).to have_content 'View file @' + end + end + + context 'Added' do + before do + visit_commit('33f3729a45c02fc67d00adb1b8bca394b0e761d9') + end + + it 'shows view file link' do + expect(page.all('.file-actions a').length).to eq 1 + expect(page.all('.file-actions a')[0]).to have_content 'View file @' + end end - it 'shows a rendered image' do - within('.diff-file[id="e986451b8f7397b617dbb6fffcb5539328c56921"]') do - expect(page).to have_css('img[alt="files/images/6049019_460s.jpg"]') + context 'Deleted' do + before do + visit_commit('7fd7a459706ee87be6f855fd98ce8c552b15529a') + end + + it 'shows view file link' do + expect(page.all('.file-actions a').length).to eq 1 + expect(page.all('.file-actions a')[0]).to have_content 'View file @' end end end diff --git a/spec/features/projects/services/slack_service_spec.rb b/spec/features/projects/services/slack_service_spec.rb deleted file mode 100644 index c10ec5e2987..00000000000 --- a/spec/features/projects/services/slack_service_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -require 'spec_helper' - -feature 'Projects > Slack service > Setup events' do - let(:user) { create(:user) } - let(:service) { SlackService.new } - let(:project) { create(:project, slack_service: service) } - - background do - service.fields - service.update_attributes(push_channel: 1, issue_channel: 2, merge_request_channel: 3, note_channel: 4, tag_push_channel: 5, pipeline_channel: 6, wiki_page_channel: 7) - project.team << [user, :master] - sign_in(user) - end - - scenario 'user can filter events by channel' do - visit edit_project_service_path(project, service) - - expect(page.find_field("service_push_channel").value).to have_content '1' - expect(page.find_field("service_issue_channel").value).to have_content '2' - expect(page.find_field("service_merge_request_channel").value).to have_content '3' - expect(page.find_field("service_note_channel").value).to have_content '4' - expect(page.find_field("service_tag_push_channel").value).to have_content '5' - expect(page.find_field("service_pipeline_channel").value).to have_content '6' - expect(page.find_field("service_wiki_page_channel").value).to have_content '7' - end -end diff --git a/spec/features/projects/services/user_activates_asana_spec.rb b/spec/features/projects/services/user_activates_asana_spec.rb new file mode 100644 index 00000000000..db836d2985c --- /dev/null +++ b/spec/features/projects/services/user_activates_asana_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe 'User activates Asana' do + let(:project) { create(:project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(project_settings_integrations_path(project)) + + click_link('Asana') + end + + it 'activates service' do + check('Active') + fill_in('Api key', with: 'verySecret') + fill_in('Restrict to branch', with: 'verySecret') + click_button('Save') + + expect(page).to have_content('Asana activated.') + end +end diff --git a/spec/features/projects/services/user_activates_assembla_spec.rb b/spec/features/projects/services/user_activates_assembla_spec.rb new file mode 100644 index 00000000000..f099b332785 --- /dev/null +++ b/spec/features/projects/services/user_activates_assembla_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe 'User activates Assembla' do + let(:project) { create(:project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(project_settings_integrations_path(project)) + + click_link('Assembla') + end + + it 'activates service' do + check('Active') + fill_in('Token', with: 'verySecret') + click_button('Save') + + expect(page).to have_content('Assembla activated.') + end +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 new file mode 100644 index 00000000000..a00c2e0ad99 --- /dev/null +++ b/spec/features/projects/services/user_activates_atlassian_bamboo_ci_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +describe 'User activates Atlassian Bamboo CI' do + let(:project) { create(:project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(project_settings_integrations_path(project)) + + click_link('Atlassian Bamboo CI') + end + + it 'activates service' do + check('Active') + 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') + + 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 + 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 new file mode 100644 index 00000000000..3769875b29c --- /dev/null +++ b/spec/features/projects/services/user_activates_emails_on_push_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe 'User activates Emails on push' do + let(:project) { create(:project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(project_settings_integrations_path(project)) + + click_link('Emails on push') + end + + it 'activates service' do + check('Active') + fill_in('Recipients', with: 'qa@company.name') + click_button('Save') + + expect(page).to have_content('Emails on push activated.') + end +end diff --git a/spec/features/projects/services/user_activates_flowdock_spec.rb b/spec/features/projects/services/user_activates_flowdock_spec.rb new file mode 100644 index 00000000000..5298d8acaf5 --- /dev/null +++ b/spec/features/projects/services/user_activates_flowdock_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe 'User activates Flowdock' do + let(:project) { create(:project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(project_settings_integrations_path(project)) + + click_link('Flowdock') + end + + it 'activates service' do + check('Active') + fill_in('Token', with: 'verySecret') + click_button('Save') + + expect(page).to have_content('Flowdock activated.') + end +end diff --git a/spec/features/projects/services/user_activates_hipchat_spec.rb b/spec/features/projects/services/user_activates_hipchat_spec.rb new file mode 100644 index 00000000000..a9bf16642c7 --- /dev/null +++ b/spec/features/projects/services/user_activates_hipchat_spec.rb @@ -0,0 +1,38 @@ +require 'spec_helper' + +describe 'User activates HipChat' do + let(:project) { create(:project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(project_settings_integrations_path(project)) + + click_link('HipChat') + end + + context 'with standart settings' do + it 'activates service' do + check('Active') + fill_in('Room', with: 'gitlab') + fill_in('Token', with: 'verySecret') + click_button('Save') + + expect(page).to have_content('HipChat activated.') + end + end + + context 'with custom settings' do + it 'activates service' do + check('Active') + fill_in('Room', with: 'gitlab_custom') + fill_in('Token', with: 'secretCustom') + fill_in('Server', with: 'https://chat.example.com') + click_button('Save') + + expect(page).to have_content('HipChat activated.') + end + end +end diff --git a/spec/features/projects/services/user_activates_irker_spec.rb b/spec/features/projects/services/user_activates_irker_spec.rb new file mode 100644 index 00000000000..435663c818f --- /dev/null +++ b/spec/features/projects/services/user_activates_irker_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe 'User activates Irker (IRC gateway)' do + let(:project) { create(:project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(project_settings_integrations_path(project)) + + click_link('Irker (IRC gateway)') + end + + it 'activates service' do + check('Active') + check('Colorize messages') + fill_in('Recipients', with: 'irc://chat.freenode.net/#commits') + click_button('Save') + + expect(page).to have_content('Irker (IRC gateway) activated.') + end +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 new file mode 100644 index 00000000000..1048803fde8 --- /dev/null +++ b/spec/features/projects/services/user_activates_jetbrains_teamcity_ci_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe 'User activates JetBrains TeamCity CI' do + let(:project) { create(:project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(project_settings_integrations_path(project)) + + click_link('JetBrains TeamCity CI') + end + + it 'activates service' do + check('Active') + 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') + + expect(page).to have_content('JetBrains TeamCity CI activated.') + end +end diff --git a/spec/features/projects/services/jira_service_spec.rb b/spec/features/projects/services/user_activates_jira_spec.rb index 65e3a487d4b..0a86292ae6c 100644 --- a/spec/features/projects/services/jira_service_spec.rb +++ b/spec/features/projects/services/user_activates_jira_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Setup Jira service', :js do +describe 'User activates Jira', :js do let(:user) { create(:user) } let(:project) { create(:project) } let(:service) { project.create_jira_service } diff --git a/spec/features/projects/services/mattermost_slash_command_spec.rb b/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb index 95d5e8b14b9..95d5e8b14b9 100644 --- a/spec/features/projects/services/mattermost_slash_command_spec.rb +++ b/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb diff --git a/spec/features/projects/services/user_activates_pivotaltracker_spec.rb b/spec/features/projects/services/user_activates_pivotaltracker_spec.rb new file mode 100644 index 00000000000..d5d109ba48b --- /dev/null +++ b/spec/features/projects/services/user_activates_pivotaltracker_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe 'User activates PivotalTracker' do + let(:project) { create(:project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(project_settings_integrations_path(project)) + + click_link('PivotalTracker') + end + + it 'activates service' do + check('Active') + fill_in('Token', with: 'verySecret') + click_button('Save') + + expect(page).to have_content('PivotalTracker activated.') + end +end diff --git a/spec/features/projects/services/user_activates_pushover_spec.rb b/spec/features/projects/services/user_activates_pushover_spec.rb new file mode 100644 index 00000000000..9b7e8d62792 --- /dev/null +++ b/spec/features/projects/services/user_activates_pushover_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe 'User activates Pushover' do + let(:project) { create(:project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(project_settings_integrations_path(project)) + + click_link('Pushover') + end + + it 'activates service' do + check('Active') + 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') + + expect(page).to have_content('Pushover activated.') + end +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 new file mode 100644 index 00000000000..fae9ebd1bd6 --- /dev/null +++ b/spec/features/projects/services/user_activates_slack_notifications_spec.rb @@ -0,0 +1,54 @@ +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_master(user) + sign_in(user) + end + + context 'when service is not configured yet' do + before do + visit(project_settings_integrations_path(project)) + + click_link('Slack notifications') + end + + it 'activates service' do + check('Active') + fill_in('Webhook', with: 'https://hooks.slack.com/services/SVRWFV0VVAR97N/B02R25XN3/ZBqu7xMupaEEICInN685') + click_button('Save') + + expect(page).to have_content('Slack notifications activated.') + end + end + + context 'when service is already configured' do + before do + service.fields + service.update_attributes( + push_channel: 1, + issue_channel: 2, + merge_request_channel: 3, + note_channel: 4, + tag_push_channel: 5, + pipeline_channel: 6, + wiki_page_channel: 7) + + visit(edit_project_service_path(project, service)) + end + + it 'filters events by channel' do + expect(page.find_field('service_push_channel').value).to have_content('1') + expect(page.find_field('service_issue_channel').value).to have_content('2') + expect(page.find_field('service_merge_request_channel').value).to have_content('3') + expect(page.find_field('service_note_channel').value).to have_content('4') + expect(page.find_field('service_tag_push_channel').value).to have_content('5') + expect(page.find_field('service_pipeline_channel').value).to have_content('6') + expect(page.find_field('service_wiki_page_channel').value).to have_content('7') + end + end +end diff --git a/spec/features/projects/services/slack_slash_command_spec.rb b/spec/features/projects/services/user_activates_slack_slash_command_spec.rb index a8baf126269..a8baf126269 100644 --- a/spec/features/projects/services/slack_slash_command_spec.rb +++ b/spec/features/projects/services/user_activates_slack_slash_command_spec.rb diff --git a/spec/features/projects/services/user_views_services_spec.rb b/spec/features/projects/services/user_views_services_spec.rb new file mode 100644 index 00000000000..f86591c2633 --- /dev/null +++ b/spec/features/projects/services/user_views_services_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +describe 'User views services' do + let(:project) { create(:project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(project_settings_integrations_path(project)) + end + + it 'shows the list of available services' do + expect(page).to have_content('Project services') + expect(page).to have_content('Campfire') + expect(page).to have_content('HipChat') + expect(page).to have_content('Assembla') + expect(page).to have_content('Pushover') + expect(page).to have_content('Atlassian Bamboo') + expect(page).to have_content('JetBrains TeamCity') + expect(page).to have_content('Asana') + expect(page).to have_content('Irker (IRC gateway)') + end +end diff --git a/spec/features/projects/shortcuts_spec.rb b/spec/features/projects/shortcuts_spec.rb deleted file mode 100644 index bf18c444c3d..00000000000 --- a/spec/features/projects/shortcuts_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'spec_helper' - -feature 'Project shortcuts' do - let(:project) { create(:project, name: 'Victorialand') } - let(:user) { create(:user) } - - describe 'On a project', js: true do - before do - project.team << [user, :master] - sign_in user - visit project_path(project) - end - - describe 'pressing "i"' do - it 'redirects to new issue page' do - find('body').native.send_key('i') - expect(page).to have_content('Victorialand') - end - end - end -end diff --git a/spec/features/projects/user_edits_files_spec.rb b/spec/features/projects/user_edits_files_spec.rb index 3129aad8473..19954313c23 100644 --- a/spec/features/projects/user_edits_files_spec.rb +++ b/spec/features/projects/user_edits_files_spec.rb @@ -20,8 +20,7 @@ describe 'User edits files' do it 'inserts a content of a file', js: true do click_link('.gitignore') find('.js-edit-blob').click - - wait_for_requests + find('.file-editor', match: :first) execute_script("ace.edit('editor').setValue('*.rbca')") @@ -38,8 +37,7 @@ describe 'User edits files' do it 'commits an edited file', js: true do click_link('.gitignore') find('.js-edit-blob').click - - wait_for_requests + find('.file-editor', match: :first) execute_script("ace.edit('editor').setValue('*.rbca')") fill_in(:commit_message, with: 'New commit message', visible: true) @@ -56,7 +54,7 @@ describe 'User edits files' do click_link('.gitignore') find('.js-edit-blob').click - wait_for_requests + find('.file-editor', match: :first) execute_script("ace.edit('editor').setValue('*.rbca')") fill_in(:commit_message, with: 'New commit message', visible: true) @@ -67,15 +65,13 @@ describe 'User edits files' do click_link('Changes') - wait_for_requests expect(page).to have_content('*.rbca') end it 'shows the diff of an edited file', js: true do click_link('.gitignore') find('.js-edit-blob').click - - wait_for_requests + find('.file-editor', match: :first) execute_script("ace.edit('editor').setValue('*.rbca')") click_link('Preview changes') @@ -104,7 +100,7 @@ describe 'User edits files' do "A fork of this project has been created that you can make changes in, so you can submit a merge request." ) - wait_for_requests + find('.file-editor', match: :first) execute_script("ace.edit('editor').setValue('*.rbca')") @@ -120,7 +116,7 @@ describe 'User edits files' do click_link('Fork') - wait_for_requests + find('.file-editor', match: :first) execute_script("ace.edit('editor').setValue('*.rbca')") fill_in(:commit_message, with: 'New commit message', visible: true) diff --git a/spec/features/projects/user_uses_shortcuts_spec.rb b/spec/features/projects/user_uses_shortcuts_spec.rb new file mode 100644 index 00000000000..fb0d8c766fe --- /dev/null +++ b/spec/features/projects/user_uses_shortcuts_spec.rb @@ -0,0 +1,108 @@ +require 'spec_helper' + +describe 'User uses shortcuts', :js do + let(:project) { create(:project, :repository) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(project_path(project)) + end + + context 'when navigating to the Overview pages' do + it 'redirects to the details page' do + find('body').native.send_key('g') + find('body').native.send_key('p') + + expect(page).to have_active_navigation('Overview') + expect(page).to have_active_sub_navigation('Details') + end + + it 'redirects to the activity page' do + find('body').native.send_key('g') + find('body').native.send_key('e') + + expect(page).to have_active_navigation('Overview') + expect(page).to have_active_sub_navigation('Activity') + end + end + + context 'when navigating to the Repository pages' do + it 'redirects to the repository files page' do + find('body').native.send_key('g') + find('body').native.send_key('f') + + expect(page).to have_active_navigation('Repository') + expect(page).to have_active_sub_navigation('Files') + end + + it 'redirects to the repository commits page' do + find('body').native.send_key('g') + find('body').native.send_key('c') + + expect(page).to have_active_navigation('Repository') + expect(page).to have_active_sub_navigation('Commits') + end + + it 'redirects to the repository graph page' do + find('body').native.send_key('g') + find('body').native.send_key('n') + + expect(page).to have_active_navigation('Repository') + expect(page).to have_active_sub_navigation('Graph') + end + + it 'redirects to the repository charts page' do + find('body').native.send_key('g') + find('body').native.send_key('d') + + expect(page).to have_active_navigation('Repository') + expect(page).to have_active_sub_navigation('Charts') + end + end + + context 'when navigating to the Issues pages' do + it 'redirects to the issues list page' do + find('body').native.send_key('g') + find('body').native.send_key('i') + + expect(page).to have_active_navigation('Issues') + expect(page).to have_active_sub_navigation('List') + end + + it 'redirects to the new issue page' do + find('body').native.send_key('i') + + expect(page).to have_content(project.title) + end + end + + context 'when navigating to the Merge Requests pages' do + it 'redirects to the merge requests page' do + find('body').native.send_key('g') + find('body').native.send_key('m') + + expect(page).to have_active_navigation('Merge Requests') + end + end + + context 'when navigating to the Snippets pages' do + it 'redirects to the snippets page' do + find('body').native.send_key('g') + find('body').native.send_key('s') + + expect(page).to have_active_navigation('Snippets') + end + end + + context 'when navigating to the Wiki pages' do + it 'redirects to the wiki page' do + find('body').native.send_key('g') + find('body').native.send_key('w') + + expect(page).to have_active_navigation('Wiki') + end + end +end diff --git a/spec/features/user_callout_spec.rb b/spec/features/user_callout_spec.rb deleted file mode 100644 index 37d66b618af..00000000000 --- a/spec/features/user_callout_spec.rb +++ /dev/null @@ -1,55 +0,0 @@ -require 'spec_helper' - -describe 'User Callouts', js: true do - let(:user) { create(:user) } - let(:another_user) { create(:user) } - let(:project) { create(:project, path: 'gitlab', name: 'sample') } - - before do - sign_in(user) - project.team << [user, :master] - end - - it 'takes you to the profile preferences when the link is clicked' do - visit dashboard_projects_path - click_link 'Check it out' - expect(current_path).to eq profile_preferences_path - end - - it 'does not show when cookie is set' do - visit dashboard_projects_path - - within('.user-callout') do - find('.close').trigger('click') - end - - visit dashboard_projects_path - - expect(page).not_to have_selector('.user-callout') - end - - describe 'user callout should appear in two routes' do - it 'shows up on the user profile' do - visit user_path(user) - expect(find('.user-callout')).to have_content 'Customize your experience' - end - - it 'shows up on the dashboard projects' do - visit dashboard_projects_path - expect(find('.user-callout')).to have_content 'Customize your experience' - end - end - - it 'hides the user callout when click on the dismiss icon' do - visit user_path(user) - within('.user-callout') do - find('.close').click - end - expect(page).not_to have_selector('.user-callout') - end - - it 'does not show callout on another users profile' do - visit user_path(another_user) - expect(page).not_to have_selector('.user-callout') - end -end |