Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/sentry_js_spec.rb')
-rw-r--r--spec/features/sentry_js_spec.rb57
1 files changed, 46 insertions, 11 deletions
diff --git a/spec/features/sentry_js_spec.rb b/spec/features/sentry_js_spec.rb
index 1d277ba7b3c..d3880011914 100644
--- a/spec/features/sentry_js_spec.rb
+++ b/spec/features/sentry_js_spec.rb
@@ -2,27 +2,62 @@
require 'spec_helper'
-RSpec.describe 'Sentry' do
- let(:sentry_regex_path) { '\/sentry.*\.chunk\.js' }
+RSpec.describe 'Sentry', feature_category: :error_tracking do
+ context 'when enable_new_sentry_clientside_integration is disabled' do
+ before do
+ stub_feature_flags(enable_new_sentry_clientside_integration: false)
+ end
+
+ it 'does not load sentry if sentry is disabled' do
+ allow(Gitlab.config.sentry).to receive(:enabled).and_return(false)
+
+ visit new_user_session_path
+
+ expect(has_requested_legacy_sentry).to eq(false)
+ end
- it 'does not load sentry if sentry is disabled' do
- allow(Gitlab.config.sentry).to receive(:enabled).and_return(false)
- visit new_user_session_path
+ it 'loads legacy sentry if sentry config is enabled', :js do
+ allow(Gitlab.config.sentry).to receive(:enabled).and_return(true)
- expect(has_requested_sentry).to eq(false)
+ visit new_user_session_path
+
+ expect(has_requested_legacy_sentry).to eq(true)
+ expect(evaluate_script('window._Sentry.SDK_VERSION')).to match(%r{^5\.})
+ end
end
- it 'loads sentry if sentry is enabled' do
- stub_sentry_settings
+ context 'when enable_new_sentry_clientside_integration is enabled' do
+ before do
+ stub_feature_flags(enable_new_sentry_clientside_integration: true)
+ end
+
+ it 'does not load sentry if sentry settings are disabled' do
+ allow(Gitlab::CurrentSettings).to receive(:sentry_enabled).and_return(false)
- visit new_user_session_path
+ visit new_user_session_path
- expect(has_requested_sentry).to eq(true)
+ expect(has_requested_sentry).to eq(false)
+ end
+
+ it 'loads sentry if sentry settings are enabled', :js do
+ allow(Gitlab::CurrentSettings).to receive(:sentry_enabled).and_return(true)
+
+ visit new_user_session_path
+
+ expect(has_requested_sentry).to eq(true)
+ expect(evaluate_script('window._Sentry.SDK_VERSION')).to match(%r{^7\.})
+ end
+ end
+
+ def has_requested_legacy_sentry
+ page.all('script', visible: false).one? do |elm|
+ elm[:src] =~ %r{/legacy_sentry.*\.chunk\.js\z}
+ end
end
def has_requested_sentry
page.all('script', visible: false).one? do |elm|
- elm[:src] =~ /#{sentry_regex_path}$/
+ elm[:src] =~ %r{/sentry.*\.chunk\.js\z}
end
end
end