Commit 5e943fd1 authored by Jennifer Louie's avatar Jennifer Louie Committed by Dan Davison

Add missing argument to page object method

Add count argument to has_detailed_specs method
Refactor performance_bar_spec
parent 966d7eb3
...@@ -21,7 +21,7 @@ module QA ...@@ -21,7 +21,7 @@ module QA
has_element?(:performance_bar) has_element?(:performance_bar)
end end
def has_detailed_metrics? def has_detailed_metrics?(count)
retry_until(sleep_interval: 1) do retry_until(sleep_interval: 1) do
all_elements(:detailed_metric_content, count: count).all? do |metric| all_elements(:detailed_metric_content, count: count).all? do |metric|
metric.has_text?(%r{\d+}) metric.has_text?(%r{\d+})
......
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
context 'Performance bar' do context 'Non-devops' do
context 'when logged in as an admin user', :requires_admin, quarantine: 'https://gitlab.com/gitlab-org/gitlab/issues/196141' do describe 'Performance bar display', :requires_admin, quarantine: 'https://gitlab.com/gitlab-org/gitlab/issues/196141' do
before do context 'when logged in as an admin user' do
Flow::Login.sign_in_as_admin # 4 metrics: pg, gitaly, redis, total
Page::Main::Menu.perform(&:go_to_admin_area) let(:metrics_count) { 4 }
Page::Admin::Menu.perform(&:go_to_metrics_and_profiling_settings)
Page::Admin::Settings::MetricsAndProfiling.perform do |setting| before do
setting.expand_performance_bar do |page| Flow::Login.sign_in_as_admin
page.enable_performance_bar Page::Main::Menu.perform(&:go_to_admin_area)
page.save_settings Page::Admin::Menu.perform(&:go_to_metrics_and_profiling_settings)
Page::Admin::Settings::MetricsAndProfiling.perform do |setting|
setting.expand_performance_bar do |page|
page.enable_performance_bar
page.save_settings
end
end end
end end
end
it 'shows results for the original request and AJAX requests' do it 'shows results for the original request and AJAX requests' do
# Issue pages always make AJAX requests # Issue pages always make AJAX requests
Resource::Issue.fabricate_via_browser_ui! do |issue| Resource::Issue.fabricate_via_browser_ui! do |issue|
issue.title = 'Performance bar test' issue.title = 'Performance bar test'
end end
Page::Layout::PerformanceBar.perform do |bar_component| Page::Layout::PerformanceBar.perform do |bar_component|
expect(bar_component).to have_performance_bar expect(bar_component).to have_performance_bar
expect(bar_component).to have_detailed_metrics(4) expect(bar_component).to have_detailed_metrics(metrics_count)
expect(bar_component).to have_request_for('realtime_changes') # Always requested on issue pages expect(bar_component).to have_request_for('realtime_changes') # Always requested on issue pages
end
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment