diff options
author | Robert Speicher <rspeicher@gmail.com> | 2017-07-07 23:45:53 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-07-07 23:45:53 +0300 |
commit | 75f3f6e1d6a826b28363fba518f7d3cf016c2df6 (patch) | |
tree | e06f8564bbc63e0a21c16849cacd4ea24ad5f848 /spec/features | |
parent | 7d03012f2a950804568f744b433f04ff4a7f1186 (diff) | |
parent | 69e17c225e53feaa7449e468e89aca3f084ab9f9 (diff) |
Merge branch 'master' into rs-sign_in
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/issuables/close_reopen_report_toggle_spec.rb | 116 | ||||
-rw-r--r-- | spec/features/issues/filtered_search/visual_tokens_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/issues/gfm_autocomplete_spec.rb | 12 | ||||
-rw-r--r-- | spec/features/oauth_login_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/user_can_display_performance_bar_spec.rb | 23 |
5 files changed, 144 insertions, 11 deletions
diff --git a/spec/features/issuables/close_reopen_report_toggle_spec.rb b/spec/features/issuables/close_reopen_report_toggle_spec.rb new file mode 100644 index 00000000000..9a99bb705b7 --- /dev/null +++ b/spec/features/issuables/close_reopen_report_toggle_spec.rb @@ -0,0 +1,116 @@ +require 'spec_helper' + +describe 'Issuables Close/Reopen/Report toggle', :feature do + let(:user) { create(:user) } + + shared_examples 'an issuable close/reopen/report toggle' do + let(:container) { find('.issuable-close-dropdown') } + let(:human_model_name) { issuable.model_name.human.downcase } + + it 'shows toggle' do + expect(page).to have_link("Close #{human_model_name}") + expect(page).to have_selector('.issuable-close-dropdown') + end + + it 'opens a dropdown when toggle is clicked' do + container.find('.dropdown-toggle').click + + expect(container).to have_selector('.dropdown-menu') + expect(container).to have_content("Close #{human_model_name}") + expect(container).to have_content('Report abuse') + expect(container).to have_content("Report #{human_model_name.pluralize} that are abusive, inappropriate or spam.") + expect(container).to have_selector('.close-item.droplab-item-selected') + expect(container).to have_selector('.report-item') + expect(container).not_to have_selector('.report-item.droplab-item-selected') + expect(container).not_to have_selector('.reopen-item') + end + + it 'changes the button when an item is selected' do + button = container.find('.issuable-close-button') + + container.find('.dropdown-toggle').click + container.find('.report-item').click + + expect(container).not_to have_selector('.dropdown-menu') + expect(button).to have_content('Report abuse') + + container.find('.dropdown-toggle').click + container.find('.close-item').click + + expect(button).to have_content("Close #{human_model_name}") + end + end + + context 'on an issue' do + let(:project) { create(:empty_project) } + let(:issuable) { create(:issue, project: project) } + + before do + project.add_master(user) + login_as user + end + + context 'when user has permission to update', :js do + before do + visit project_issue_path(project, issuable) + end + + it_behaves_like 'an issuable close/reopen/report toggle' + end + + context 'when user doesnt have permission to update' do + let(:cant_project) { create(:empty_project) } + let(:cant_issuable) { create(:issue, project: cant_project) } + + before do + cant_project.add_guest(user) + + visit project_issue_path(cant_project, cant_issuable) + end + + it 'only shows the `Report abuse` and `New issue` buttons' do + expect(page).to have_link('Report abuse') + expect(page).to have_link('New issue') + expect(page).not_to have_link('Close issue') + expect(page).not_to have_link('Reopen issue') + expect(page).not_to have_link('Edit') + end + end + end + + context 'on a merge request' do + let(:project) { create(:project) } + let(:issuable) { create(:merge_request, source_project: project) } + + before do + project.add_master(user) + login_as user + end + + context 'when user has permission to update', :js do + before do + visit project_merge_request_path(project, issuable) + end + + it_behaves_like 'an issuable close/reopen/report toggle' + end + + context 'when user doesnt have permission to update' do + let(:cant_project) { create(:project) } + let(:cant_issuable) { create(:merge_request, source_project: cant_project) } + + before do + cant_project.add_reporter(user) + + visit project_merge_request_path(cant_project, cant_issuable) + end + + it 'only shows a `Report abuse` button' do + expect(page).to have_link('Report abuse') + expect(page).not_to have_link('Close merge request') + expect(page).not_to have_link('Reopen merge request') + expect(page).not_to have_link('Edit') + end + end + end +end diff --git a/spec/features/issues/filtered_search/visual_tokens_spec.rb b/spec/features/issues/filtered_search/visual_tokens_spec.rb index 0412c186a90..a15c3d1d447 100644 --- a/spec/features/issues/filtered_search/visual_tokens_spec.rb +++ b/spec/features/issues/filtered_search/visual_tokens_spec.rb @@ -133,7 +133,7 @@ describe 'Visual tokens', js: true, feature: true do describe 'editing milestone token' do before do input_filtered_search('milestone:%10.0 author:none', submit: false) - first('.tokens-container .filtered-search-token').double_click + first('.tokens-container .filtered-search-token').click first('#js-dropdown-milestone .filter-dropdown .filter-dropdown-item') end diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index 2193c5fd69c..9b4cc653af5 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -14,6 +14,18 @@ feature 'GFM autocomplete', feature: true, js: true do wait_for_requests end + it 'updates issue descripton with GFM reference' do + find('.issuable-edit').click + + find('#issue-description').native.send_keys("@#{user.name[0...3]}") + + find('.atwho-view .cur').trigger('click') + + click_button 'Save changes' + + expect(find('.description')).to have_content(user.to_reference) + end + it 'opens autocomplete menu when field starts with text' do page.within '.timeline-content-form' do find('#note_note').native.send_keys('') diff --git a/spec/features/oauth_login_spec.rb b/spec/features/oauth_login_spec.rb index 1b6d1f3415f..42764e808e6 100644 --- a/spec/features/oauth_login_spec.rb +++ b/spec/features/oauth_login_spec.rb @@ -13,7 +13,7 @@ feature 'OAuth Login', js: true do end providers = [:github, :twitter, :bitbucket, :gitlab, :google_oauth2, - :facebook, :cas3, :auth0] + :facebook, :cas3, :auth0, :authentiq] before(:all) do # The OmniAuth `full_host` parameter doesn't get set correctly (it gets set to something like `http://localhost` diff --git a/spec/features/user_can_display_performance_bar_spec.rb b/spec/features/user_can_display_performance_bar_spec.rb index 8464bf50cac..670e8dda916 100644 --- a/spec/features/user_can_display_performance_bar_spec.rb +++ b/spec/features/user_can_display_performance_bar_spec.rb @@ -33,22 +33,24 @@ describe 'User can display performance bar', :js do end end + let(:group) { create(:group) } + context 'when user is logged-out' do before do visit root_path end - context 'when the gitlab_performance_bar feature is disabled' do + context 'when the performance_bar feature is disabled' do before do - Feature.disable('gitlab_performance_bar') + stub_application_setting(performance_bar_allowed_group_id: nil) end it_behaves_like 'performance bar is disabled' end - context 'when the gitlab_performance_bar feature is enabled' do + context 'when the performance_bar feature is enabled' do before do - Feature.enable('gitlab_performance_bar') + stub_application_setting(performance_bar_allowed_group_id: group.id) end it_behaves_like 'performance bar is disabled' @@ -57,22 +59,25 @@ describe 'User can display performance bar', :js do context 'when user is logged-in' do before do - sign_in(create(:user)) + user = create(:user) + + sign_in(user) + group.add_guest(user) visit root_path end - context 'when the gitlab_performance_bar feature is disabled' do + context 'when the performance_bar feature is disabled' do before do - Feature.disable('gitlab_performance_bar') + stub_application_setting(performance_bar_allowed_group_id: nil) end it_behaves_like 'performance bar is disabled' end - context 'when the gitlab_performance_bar feature is enabled' do + context 'when the performance_bar feature is enabled' do before do - Feature.enable('gitlab_performance_bar') + stub_application_setting(performance_bar_allowed_group_id: group.id) end it_behaves_like 'performance bar is enabled' |