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

usage_quotas.rb « settings « group « page « gitlab « lib « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3b31d1c0a1ca90484f5e12123a642a988b12f8d4 (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 Gitlab
  module Page
    module Group
      module Settings
        class UsageQuotas < Chemlab::Page
          link :pipeline_tab, id: 'pipelines-quota'
          link :storage_tab, id: 'storage-quota'
          link :buy_ci_minutes, text: 'Buy additional minutes'
          link :buy_storage, text: /Purchase more storage/
          strong :additional_minutes, text: 'Additional minutes'
          strong :plan_minutes, text: 'Current period usage'
          div :purchased_usage, 'data-testid': 'purchased-usage'
          div(:plan_minutes_usage) { plan_minutes_element.following_sibling.span }
          div(:additional_minutes_usage) { additional_minutes_element.following_sibling.span }
          div :ci_purchase_successful_alert, text: /You have successfully purchased CI minutes/
          div :storage_purchase_successful_alert, text: /You have successfully purchased a storage/
          h4 :storage_available_alert, text: /purchased storage is available/

          def plan_minutes_limits
            plan_minutes_usage[%r{([^/ ]+)$}]
          end

          def additional_limits
            additional_minutes_usage[%r{([^/ ]+)$}]
          end

          # Waits and Checks if storage available alert presents on the page
          #
          # @return [Boolean] True if the alert presents, false if not after 5 second wait
          def purchased_storage_available?
            storage_available_alert_element.wait_until(timeout: 5, &:present?)
          rescue Watir::Wait::TimeoutError
            false
          end

          # Returns total purchased storage value once it's ready on page
          #
          # @return [Float] Total purchased storage value in GiB
          def total_purchased_storage
            storage_available_alert_element.wait_until(&:present?)
            purchased_usage_element.p.spans[3].text.to_f
          end
        end
      end
    end
  end
end