Welcome to mirror list, hosted at ThFree Co, Russian Federation.

custom_metric.rb « component « page « qa « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 094979f5e18e53b36d27f167d0064654bf32502c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# frozen_string_literal: true

module QA
  module Page
    module Component
      module CustomMetric
        extend QA::Page::PageConcern

        def self.included(base)
          super

          base.view 'app/assets/javascripts/custom_metrics/components/custom_metrics_form_fields.vue' do
            element :custom_metric_prometheus_title_field
            element :custom_metric_prometheus_query_field
            element :custom_metric_prometheus_y_label_field
            element :custom_metric_prometheus_unit_label_field
            element :custom_metric_prometheus_legend_label_field
          end
        end

        def add_custom_metric
          fill_element :custom_metric_prometheus_title_field, 'HTTP Requests Total'
          fill_element :custom_metric_prometheus_query_field, 'rate(http_requests_total[5m])'
          fill_element :custom_metric_prometheus_y_label_field, 'Requests/second'
          fill_element :custom_metric_prometheus_unit_label_field, 'req/sec'
          fill_element :custom_metric_prometheus_legend_label_field, 'HTTP requests'

          save_changes
        end

        def save_changes
          click_button(class: 'btn-success')
        end

        def delete_custom_metric
          click_button(class: 'btn-danger')
          within('.modal-content') { click_button(class: 'btn-danger') }
        end

        def edit_custom_metric
          fill_element :custom_metric_prometheus_title_field, ''
          fill_element :custom_metric_prometheus_title_field, 'Throughput'

          save_changes
        end
      end
    end
  end
end