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-11-25 23:54:43 +05:30
|
|
|
# Seats section
|
|
|
|
link :seats_tab
|
2023-01-13 00:05:48 +05:30
|
|
|
div :seats_in_use
|
|
|
|
p :seats_used
|
|
|
|
p :seats_owed
|
|
|
|
table :subscription_users
|
|
|
|
button :remove_user
|
2022-11-25 23:54:43 +05:30
|
|
|
|
|
|
|
# Pipelines section
|
2022-07-23 23:45:48 +05:30
|
|
|
link :pipelines_tab
|
|
|
|
link :buy_ci_minutes
|
2022-01-26 12:08:38 +05:30
|
|
|
div :plan_ci_minutes
|
|
|
|
div :additional_ci_minutes
|
|
|
|
div :ci_purchase_successful_alert, text: /You have successfully purchased CI minutes/
|
2022-11-25 23:54:43 +05:30
|
|
|
|
|
|
|
# Storage section
|
|
|
|
link :storage_tab
|
|
|
|
link :purchase_more_storage
|
2023-05-27 22:25:52 +05:30
|
|
|
div :namespace_usage_total
|
2022-11-25 23:54:43 +05:30
|
|
|
div :group_usage_message
|
|
|
|
div :dependency_proxy_usage
|
|
|
|
span :dependency_proxy_size
|
|
|
|
div :container_registry_usage
|
|
|
|
div :project
|
|
|
|
div :storage_type_legend
|
|
|
|
span :container_registry_size
|
2023-04-23 21:23:45 +05:30
|
|
|
div :purchased_usage_total
|
2022-01-26 12:08:38 +05:30
|
|
|
div :storage_purchase_successful_alert, text: /You have successfully purchased a storage/
|
2023-03-04 22:38:38 +05:30
|
|
|
div :additional_storage_alert, text: /purchase additional storage/
|
2021-11-18 22:05:49 +05:30
|
|
|
|
2022-01-26 12:08:38 +05:30
|
|
|
def plan_ci_limits
|
2023-03-04 22:38:38 +05:30
|
|
|
plan_ci_minutes[/(\d+){2}/]
|
2021-11-18 22:05:49 +05:30
|
|
|
end
|
|
|
|
|
2022-01-26 12:08:38 +05:30
|
|
|
def additional_ci_limits
|
2023-03-04 22:38:38 +05:30
|
|
|
additional_ci_minutes[/(\d+){2}/]
|
2022-01-26 12:08:38 +05:30
|
|
|
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
|
2023-03-04 22:38:38 +05:30
|
|
|
def additional_storage_available?
|
|
|
|
additional_storage_alert_element.wait_until(timeout: 5, &:present?)
|
2022-01-26 12:08:38 +05:30
|
|
|
rescue Watir::Wait::TimeoutError
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
# Waits and Checks if storage project data loaded
|
|
|
|
#
|
|
|
|
# @return [Boolean] True if the alert presents, false if not after 5 second wait
|
|
|
|
def project_storage_data_available?
|
|
|
|
storage_type_legend_element.wait_until(timeout: 3, &:present?)
|
|
|
|
rescue Watir::Wait::TimeoutError
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2022-01-26 12:08:38 +05:30
|
|
|
# Returns total purchased storage value once it's ready on page
|
|
|
|
#
|
|
|
|
# @return [Float] Total purchased storage value in GiB
|
2023-04-23 21:23:45 +05:30
|
|
|
def total_purchased_storage
|
2023-03-04 22:38:38 +05:30
|
|
|
additional_storage_alert_element.wait_until(&:present?)
|
2022-07-23 23:45:48 +05:30
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
purchased_usage_total[/(\d+){2}.\d+/].to_f
|
2021-11-18 22:05:49 +05:30
|
|
|
end
|
2023-03-17 16:20:25 +05:30
|
|
|
|
|
|
|
def additional_ci_minutes_added?
|
|
|
|
# When opening the Usage quotas page, Seats quota tab is opened briefly even when url is to a different tab
|
|
|
|
::QA::Support::WaitForRequests.wait_for_requests
|
|
|
|
additional_ci_minutes?
|
|
|
|
end
|
2021-11-18 22:05:49 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|