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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-06-16 18:09:59 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-06-16 18:09:59 +0300
commit0c87da93750c6428328a3e3cd2ebd0882f6294e3 (patch)
tree1b6cb32a86a461e592634249db84f34b44d0c2eb /spec/support
parentd87800c3cfa21bde64704542d61a587c5ff4306e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/helpers/metrics_dashboard_url_helpers.rb26
-rw-r--r--spec/support/shared_examples/banzai/filters/inline_embeds_shared_examples.rb64
-rw-r--r--spec/support/shared_examples/banzai/filters/inline_metrics_redactor_shared_examples.rb30
-rw-r--r--spec/support/shared_examples/features/runners_shared_examples.rb2
4 files changed, 1 insertions, 121 deletions
diff --git a/spec/support/helpers/metrics_dashboard_url_helpers.rb b/spec/support/helpers/metrics_dashboard_url_helpers.rb
deleted file mode 100644
index 58b3d1e4d1d..00000000000
--- a/spec/support/helpers/metrics_dashboard_url_helpers.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-module MetricsDashboardUrlHelpers
- # Using the url_helpers available in the test suite uses
- # the sample host, but the urls generated may need to
- # point to the configured host in the :js trait
- def urls
- ::Gitlab::Routing.url_helpers
- end
-
- def clear_host_from_memoized_variables
- [:metrics_regex, :grafana_regex, :clusters_regex, :alert_regex].each do |method_name|
- Gitlab::Metrics::Dashboard::Url.clear_memoization(method_name)
- end
- end
-
- def stub_gitlab_domain
- allow_any_instance_of(Banzai::Filter::InlineEmbedsFilter)
- .to receive(:gitlab_domain)
- .and_return(urls.root_url.chomp('/'))
-
- allow(Gitlab::Metrics::Dashboard::Url)
- .to receive(:gitlab_domain)
- .and_return(urls.root_url.chomp('/'))
- end
-end
diff --git a/spec/support/shared_examples/banzai/filters/inline_embeds_shared_examples.rb b/spec/support/shared_examples/banzai/filters/inline_embeds_shared_examples.rb
deleted file mode 100644
index 8f2f3f89914..00000000000
--- a/spec/support/shared_examples/banzai/filters/inline_embeds_shared_examples.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-# frozen_string_literal: true
-
-# Expects 2 attributes to be defined:
-# trigger_url - Url expected to trigger the insertion of a placeholder.
-# dashboard_url - Url expected to be present in the placeholder.
-RSpec.shared_examples 'a metrics embed filter' do
- let(:input) { %(<a href="#{url}">example</a>) }
- let(:doc) { filter(input) }
-
- before do
- stub_feature_flags(remove_monitor_metrics: false)
- end
-
- context 'when the document has an external link' do
- let(:url) { 'https://foo.com' }
-
- it 'leaves regular non-metrics links unchanged' do
- expect(doc.to_s).to eq(input)
- end
- end
-
- context 'when the document contains an embeddable link' do
- let(:url) { trigger_url }
-
- it 'leaves the original link unchanged' do
- expect(unescape(doc.at_css('a').to_s)).to eq(input)
- end
-
- it 'appends a metrics charts placeholder' do
- node = doc.at_css('.js-render-metrics')
- expect(node).to be_present
-
- expect(node.attribute('data-dashboard-url').to_s).to eq(dashboard_url)
- end
-
- context 'in a paragraph' do
- let(:paragraph) { %(This is an <a href="#{url}">example</a> of metrics.) }
- let(:input) { %(<p>#{paragraph}</p>) }
-
- it 'appends a metrics charts placeholder after the enclosing paragraph' do
- expect(unescape(doc.at_css('p').to_s)).to include(paragraph)
- expect(doc.at_css('.js-render-metrics')).to be_present
- end
- end
-
- context 'when metrics dashboard feature is unavailable' do
- before do
- stub_feature_flags(remove_monitor_metrics: true)
- end
-
- it 'does not append a metrics chart placeholder' do
- node = doc.at_css('.js-render-metrics')
-
- expect(node).not_to be_present
- end
- end
- end
-
- # Nokogiri escapes the URLs, but we don't care about that
- # distinction for the purposes of these filters
- def unescape(html)
- CGI.unescapeHTML(html)
- end
-end
diff --git a/spec/support/shared_examples/banzai/filters/inline_metrics_redactor_shared_examples.rb b/spec/support/shared_examples/banzai/filters/inline_metrics_redactor_shared_examples.rb
deleted file mode 100644
index 07abb86ceb5..00000000000
--- a/spec/support/shared_examples/banzai/filters/inline_metrics_redactor_shared_examples.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.shared_examples 'redacts the embed placeholder' do
- context 'no user is logged in' do
- it 'redacts the placeholder' do
- expect(doc.to_s).to be_empty
- end
- end
-
- context 'the user does not have permission do see charts' do
- let(:doc) { filter(input, current_user: build(:user)) }
-
- it 'redacts the placeholder' do
- expect(doc.to_s).to be_empty
- end
- end
-end
-
-RSpec.shared_examples 'retains the embed placeholder when applicable' do
- context 'the user has requisite permissions' do
- let(:user) { create(:user) }
- let(:doc) { filter(input, current_user: user) }
-
- it 'leaves the placeholder' do
- project.add_maintainer(user)
-
- expect(CGI.unescapeHTML(doc.to_s)).to eq(input)
- end
- end
-end
diff --git a/spec/support/shared_examples/features/runners_shared_examples.rb b/spec/support/shared_examples/features/runners_shared_examples.rb
index 94e5df8c7ae..54a4db0e81d 100644
--- a/spec/support/shared_examples/features/runners_shared_examples.rb
+++ b/spec/support/shared_examples/features/runners_shared_examples.rb
@@ -127,7 +127,7 @@ RSpec.shared_examples 'pauses, resumes and deletes a runner' do
it 'deletes a runner' do
within_modal do
- click_on 'Delete runner'
+ click_on 'Permanently delete runner'
end
expect(page.find('.gl-toast')).to have_text(/Runner .+ deleted/)