performance_bar.rb 1.13 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
# frozen_string_literal: true

module QA
  module Page
    module Layout
      class PerformanceBar < Page::Base
        view 'app/assets/javascripts/performance_bar/components/performance_bar_app.vue' do
          element :performance_bar
        end

        view 'app/assets/javascripts/performance_bar/components/detailed_metric.vue' do
12
          element :detailed_metric_content
13 14 15
        end

        view 'app/assets/javascripts/performance_bar/components/request_selector.vue' do
16 17
          element :request_dropdown_option
          element :request_dropdown
18 19 20 21 22 23
        end

        def has_performance_bar?
          has_element?(:performance_bar)
        end

24
        def has_detailed_metrics?(count)
25
          retry_until(sleep_interval: 1) do
26
            all_elements(:detailed_metric_content, count: count).all? do |metric|
27 28
              metric.has_text?(%r{\d+})
            end
29 30 31 32
          end
        end

        def has_request_for?(path)
33 34 35 36
          click_element(:request_dropdown)
          retry_until(sleep_interval: 1) do
            has_element?(:request_dropdown_option, text: path)
          end
37 38 39 40 41
        end
      end
    end
  end
end