File: user_searches_sentry_errors_spec.rb

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (42 lines) | stat: -rw-r--r-- 1,692 bytes parent folder | download
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'When a user searches for Sentry errors', :js, :use_clean_rails_memory_store_caching, :sidekiq_inline,
  feature_category: :observability do
  include_context 'sentry error tracking context feature'

  let_it_be(:issues_response_body) { fixture_file('sentry/issues_sample_response.json') }
  let_it_be(:error_search_response_body) { fixture_file('sentry/error_list_search_response.json') }

  let(:issues_api_url) { "#{sentry_api_urls.issues_url}?limit=20&query=is:unresolved" }
  let(:issues_api_url_search) { "#{sentry_api_urls.issues_url}?limit=20&query=is:unresolved%20NotFound" }

  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' })

    stub_request(:get, issues_api_url_search).with(
      headers: { 'Authorization' => 'Bearer access_token_123', 'Content-Type' => 'application/json' }
    ).to_return(status: 200, body: error_search_response_body, headers: { 'Content-Type' => 'application/json' })
  end

  it 'displays the results' do
    sign_in(project.first_owner)
    visit project_error_tracking_index_path(project)

    page.within(find('.gl-table')) do
      results = page.all('.table-row')
      expect(results.count).to be(3)
    end

    find('.filtered-search-input-container .gl-form-input').set('NotFound').native.send_keys(:return)

    page.within(find('.gl-table')) do
      results = page.all('.table-row')
      expect(results.count).to be(1)
      expect(results.first).to have_content('NotFound')
    end
  end
end