debian-mirror-gitlab/spec/features/markdown/observability_spec.rb

78 lines
2.1 KiB
Ruby
Raw Normal View History

2023-03-04 22:38:38 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-05-27 22:25:52 +05:30
RSpec.describe 'Observability rendering', :js, feature_category: :metrics do
2023-03-04 22:38:38 +05:30
let_it_be(:group) { create(:group, :public) }
let_it_be(:project) { create(:project, :repository, group: group) }
let_it_be(:user) { create(:user) }
2023-05-27 22:25:52 +05:30
let_it_be(:observable_url) { "https://www.gitlab.com/groups/#{group.path}/-/observability/explore?observability_path=/explore?foo=bar" }
let_it_be(:expected_observable_url) { "https://observe.gitlab.com/-/#{group.id}/explore?foo=bar" }
2023-03-04 22:38:38 +05:30
before do
2023-05-27 22:25:52 +05:30
stub_config_setting(url: "https://www.gitlab.com")
group.add_developer(user)
2023-03-04 22:38:38 +05:30
sign_in(user)
end
2023-05-27 22:25:52 +05:30
context 'when user is a developer of the embedded group' do
context 'when embedding in an issue' do
let(:issue) do
create(:issue, project: project, description: observable_url)
2023-03-04 22:38:38 +05:30
end
2023-05-27 22:25:52 +05:30
before do
visit project_issue_path(project, issue)
wait_for_requests
2023-03-04 22:38:38 +05:30
end
2023-05-27 22:25:52 +05:30
it_behaves_like 'embeds observability'
2023-03-04 22:38:38 +05:30
end
2023-05-27 22:25:52 +05:30
context 'when embedding in an MR' do
let(:merge_request) do
create(:merge_request, source_project: project, target_project: project, description: observable_url)
2023-03-04 22:38:38 +05:30
end
2023-05-27 22:25:52 +05:30
before do
visit merge_request_path(merge_request)
wait_for_requests
2023-03-04 22:38:38 +05:30
end
2023-05-27 22:25:52 +05:30
it_behaves_like 'embeds observability'
2023-03-04 22:38:38 +05:30
end
end
2023-03-17 16:20:25 +05:30
context 'when feature flag is disabled' do
before do
stub_feature_flags(observability_group_tab: false)
end
context 'when embedding in an issue' do
let(:issue) do
create(:issue, project: project, description: observable_url)
end
before do
visit project_issue_path(project, issue)
wait_for_requests
end
2023-05-27 22:25:52 +05:30
it_behaves_like 'does not embed observability'
2023-03-17 16:20:25 +05:30
end
context 'when embedding in an MR' do
let(:merge_request) do
create(:merge_request, source_project: project, target_project: project, description: observable_url)
end
before do
visit merge_request_path(merge_request)
wait_for_requests
end
2023-05-27 22:25:52 +05:30
it_behaves_like 'does not embed observability'
2023-03-17 16:20:25 +05:30
end
end
2023-03-04 22:38:38 +05:30
end