diff options
author | Sarah Yasonik <syasonik@gitlab.com> | 2019-08-16 00:38:29 +0300 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2019-08-16 00:38:29 +0300 |
commit | caa361b703bcd08f242368d11b66be38d9f1e383 (patch) | |
tree | 4c5437663a923ac5e686fbfe9fa2fd26cf603809 /spec/features/markdown/metrics_spec.rb | |
parent | e6c0f6b0ce0c7de1bcd2e133ecb8c973a6642bf6 (diff) |
Support query parameters in metrics embeds
https://gitlab.com/gitlab-org/gitlab-ce/issues/62971
Adds support for embedding specific charts from the
metrics dashboard. Expected parameters are dashboard,
title, group, and y_label.
Diffstat (limited to 'spec/features/markdown/metrics_spec.rb')
-rw-r--r-- | spec/features/markdown/metrics_spec.rb | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/spec/features/markdown/metrics_spec.rb b/spec/features/markdown/metrics_spec.rb index aa53ac50c78..4de67cfcdbe 100644 --- a/spec/features/markdown/metrics_spec.rb +++ b/spec/features/markdown/metrics_spec.rb @@ -26,13 +26,31 @@ describe 'Metrics rendering', :js, :use_clean_rails_memory_store_caching do restore_host end - context 'with deployments and related deployable present' do - it 'shows embedded metrics' do + it 'shows embedded metrics' do + visit project_issue_path(project, issue) + + expect(page).to have_css('div.prometheus-graph') + expect(page).to have_text('Memory Usage (Total)') + expect(page).to have_text('Core Usage (Total)') + end + + context 'when dashboard params are in included the url' do + let(:metrics_url) { metrics_project_environment_url(project, environment, **chart_params) } + + let(:chart_params) do + { + group: 'System metrics (Kubernetes)', + title: 'Memory Usage (Pod average)', + y_label: 'Memory Used per Pod (MB)' + } + end + + it 'shows embedded metrics for the specifiec chart' do visit project_issue_path(project, issue) expect(page).to have_css('div.prometheus-graph') - expect(page).to have_text('Memory Usage (Total)') - expect(page).to have_text('Core Usage (Total)') + expect(page).to have_text(chart_params[:title]) + expect(page).to have_text(chart_params[:y_label]) end end |