diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-22 15:08:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-22 15:08:40 +0300 |
commit | be3e24ea3c9f497efde85900df298ce9bc42fce8 (patch) | |
tree | fd0de9443253a1b21ca9a2741dc34ba3aef795be /spec/features/error_tracking | |
parent | 001243986195143c395a9811d8254bbf1b9ebfa1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/error_tracking')
-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..0d23df31e29 --- /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 details 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 |