summaryrefslogtreecommitdiff
path: root/spec/features/sentry_js_spec.rb
blob: aa0ad17340ab8ae05077cbe4bdbb8087d78cf83a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Sentry' do
  let(:sentry_regex_path) { '\/sentry.*\.chunk\.js' }

  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_sentry).to eq(false)
  end

  xit 'loads sentry if sentry is enabled' do
    stub_sentry_settings

    visit new_user_session_path

    expect(has_requested_sentry).to eq(true)
  end

  def has_requested_sentry
    page.all('script', visible: false).one? do |elm|
      elm[:src] =~ /#{sentry_regex_path}$/
    end
  end
end