debian-mirror-gitlab/qa/lib/gitlab/page/group/settings/usage_quotas.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.9 KiB
Ruby
Raw Normal View History

2021-11-18 22:05:49 +05:30
# frozen_string_literal: true
module Gitlab
module Page
module Group
module Settings
class UsageQuotas < Chemlab::Page
2022-07-23 23:45:48 +05:30
# TODO: Supplant with data-qa-selectors
link :pipelines_tab
link :storage_tab
link :buy_ci_minutes
link :buy_storage
2022-01-26 12:08:38 +05:30
div :plan_ci_minutes
div :additional_ci_minutes
span :purchased_usage_total
2022-07-23 23:45:48 +05:30
div :purchased_usage_total_free, 'data-testid': 'purchased-usage-card' # Different UI for free namespace
2022-01-26 12:08:38 +05:30
div :ci_purchase_successful_alert, text: /You have successfully purchased CI minutes/
div :storage_purchase_successful_alert, text: /You have successfully purchased a storage/
2022-07-16 23:28:13 +05:30
h2 :storage_available_alert, text: /purchased storage is available/
2021-11-18 22:05:49 +05:30
2022-01-26 12:08:38 +05:30
def plan_ci_limits
plan_ci_minutes_element.span.text[%r{([^/ ]+)$}]
2021-11-18 22:05:49 +05:30
end
2022-01-26 12:08:38 +05:30
def additional_ci_limits
additional_ci_minutes_element.span.text[%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
2022-07-23 23:45:48 +05:30
def total_purchased_storage(free_name_space = true)
2022-01-26 12:08:38 +05:30
storage_available_alert_element.wait_until(&:present?)
2022-07-23 23:45:48 +05:30
if free_name_space
purchased_usage_total_free.split('/').last.match(/\d+\.\d+/)[0].to_f
else
purchased_usage_total.to_f
end
2021-11-18 22:05:49 +05:30
end
end
end
end
end
end