diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-23 12:08:38 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-23 12:08:38 +0000 |
commit | 5ad0cf26551baff8f08af8562a8d45e6ec14d71a (patch) | |
tree | 57f1a6bad31bcd11efacd3fdfb9cc92f88fb6a86 /spec/features | |
parent | f47c768fad17d4c876e96524f83f8306f071db66 (diff) | |
download | gitlab-ce-5ad0cf26551baff8f08af8562a8d45e6ec14d71a.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/error_tracking/user_sees_error_details_spec.rb | 32 | ||||
-rw-r--r-- | spec/features/error_tracking/user_sees_error_index_spec.rb | 69 |
2 files changed, 101 insertions, 0 deletions
diff --git a/spec/features/error_tracking/user_sees_error_details_spec.rb b/spec/features/error_tracking/user_sees_error_details_spec.rb new file mode 100644 index 00000000000..6f72c44c689 --- /dev/null +++ b/spec/features/error_tracking/user_sees_error_details_spec.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'View error details page', :js, :use_clean_rails_memory_store_caching, :sidekiq_inline do + include_context 'sentry error tracking context feature' + + context 'with current user as project owner' do + before do + sign_in(project.owner) + + visit details_project_error_tracking_index_path(project, issue_id: issue_id) + end + + it_behaves_like 'error tracking show page' + end + + context 'with current user as project guest' do + let_it_be(:user) { create(:user) } + + before do + project.add_guest(user) + sign_in(user) + + visit details_project_error_tracking_index_path(project, issue_id: issue_id) + end + + it 'renders not found' do + expect(page).to have_content('Page Not Found') + end + end +end diff --git a/spec/features/error_tracking/user_sees_error_index_spec.rb b/spec/features/error_tracking/user_sees_error_index_spec.rb new file mode 100644 index 00000000000..842e4a2e8b5 --- /dev/null +++ b/spec/features/error_tracking/user_sees_error_index_spec.rb @@ -0,0 +1,69 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'View error index page', :js, :use_clean_rails_memory_store_caching, :sidekiq_inline do + include_context 'sentry error tracking context feature' + + let_it_be(:issues_response_body) { fixture_file('sentry/issues_sample_response.json') } + let_it_be(:issues_response) { JSON.parse(issues_response_body) } + let(:issues_api_url) { "#{sentry_api_urls.issues_url}?limit=20&query=is:unresolved" } + + before do + stub_request(:get, issues_api_url).with( + headers: { 'Authorization' => 'Bearer access_token_123' } + ).to_return(status: 200, body: issues_response_body, headers: { 'Content-Type' => 'application/json' }) + end + + context 'with current user as project owner' do + before do + sign_in(project.owner) + + visit project_error_tracking_index_path(project) + end + + it_behaves_like 'error tracking index page' + end + + # A bug caused the detail link to be broken for all users but the project owner + context 'with current user as project maintainer' do + let_it_be(:user) { create(:user) } + + before do + project.add_maintainer(user) + sign_in(user) + + visit project_error_tracking_index_path(project) + end + + it_behaves_like 'error tracking index page' + end + + context 'with error tracking settings disabled' do + before do + project_error_tracking_settings.update(enabled: false) + sign_in(project.owner) + + visit project_error_tracking_index_path(project) + end + + it 'renders call to action' do + expect(page).to have_content('Enable error tracking') + end + end + + context 'with current user as project guest' do + let_it_be(:user) { create(:user) } + + before do + project.add_guest(user) + sign_in(user) + + visit project_error_tracking_index_path(project) + end + + it 'renders not found' do + expect(page).to have_content('Page Not Found') + end + end +end |