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

user_filters_errors_by_status_spec.rb « error_tracking « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d5dbe259159d6c16dd203d6ee9912d319809f189 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'When a user filters Sentry errors by status', :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(:filtered_errors_by_status_response) { Gitlab::Json.parse(issues_response_body).filter { |error| error['status'] == 'ignored' }.to_json }

  let(:issues_api_url) { "#{sentry_api_urls.issues_url}?limit=20&query=is:unresolved" }
  let(:issues_api_url_filter) { "#{sentry_api_urls.issues_url}?limit=20&query=is:ignored" }
  let(:auth_token) {{ 'Authorization' => 'Bearer access_token_123' }}
  let(:return_header) {{ 'Content-Type' => 'application/json' }}

  before do
    stub_request(:get, issues_api_url).with(headers: auth_token)
      .to_return(status: 200, body: issues_response_body, headers: return_header)

    stub_request(:get, issues_api_url_filter).with(headers: auth_token)
    .to_return(status: 200, body: filtered_errors_by_status_response, headers: return_header)
  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('.status-dropdown .dropdown-toggle').click
    find('.dropdown-item', text: 'Ignored').click

    page.within(find('.gl-table')) do
      results = page.all('.table-row')
      expect(results.count).to be(1)
      expect(results.first).to have_content(filtered_errors_by_status_response[0]['title'])
    end
  end
end