Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7bf72abd
Commit
7bf72abd
authored
Nov 26, 2021
by
Chloe Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Storage purchase e2e tests for new purchase route
Update CI test to use Helper module
parent
14b2909c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
134 additions
and
13 deletions
+134
-13
qa/lib/gitlab/page/group/settings/usage_quotas.rb
qa/lib/gitlab/page/group/settings/usage_quotas.rb
+21
-1
qa/qa/specs/features/ee/browser_ui/fulfillment/purchase/purchase_ci_spec.rb
...es/ee/browser_ui/fulfillment/purchase/purchase_ci_spec.rb
+4
-12
qa/qa/specs/features/ee/browser_ui/fulfillment/purchase/purchase_storage_spec.rb
.../browser_ui/fulfillment/purchase/purchase_storage_spec.rb
+109
-0
No files found.
qa/lib/gitlab/page/group/settings/usage_quotas.rb
View file @
7bf72abd
...
...
@@ -10,8 +10,11 @@ module Gitlab
link
:buy_ci_minutes
,
text:
'Buy additional minutes'
link
:buy_storage
,
text:
/Purchase more storage/
strong
:additional_minutes
,
text:
'Additional minutes'
div
:purchased_usage
,
'data-testid'
:
'purchased-usage'
div
(
:additional_minutes_usage
)
{
additional_minutes_element
.
following_sibling
.
span
}
div
:purchase_successful_alert
,
text:
/You have successfully purchased CI minutes/
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{([^/ ]+)$}
]
...
...
@@ -20,6 +23,23 @@ module Gitlab
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
...
...
qa/qa/specs/features/ee/browser_ui/fulfillment/purchase/purchase_ci_spec.rb
View file @
7bf72abd
# frozen_string_literal: true
module
QA
include
QA
::
Support
::
Helpers
::
Plan
RSpec
.
describe
'Fulfillment'
,
:requires_admin
,
only:
{
subdomain: :staging
}
do
context
'Purchase CI minutes'
do
# the quantity of products to purchase
...
...
@@ -71,9 +73,9 @@ module QA
end
Gitlab
::
Page
::
Group
::
Settings
::
UsageQuotas
.
perform
do
|
usage_quota
|
expected_minutes
=
ci_product
[
:
minutes
]
*
purchase_quantity
expected_minutes
=
CI_MINUTES
[
:ci_
minutes
]
*
purchase_quantity
expect
{
usage_quota
.
purchase_successful_alert?
}.
to
eventually_be_truthy
.
within
(
max_duration:
120
,
max_attempts:
6
0
)
expect
{
usage_quota
.
ci_purchase_successful_alert?
}.
to
eventually_be_truthy
.
within
(
max_duration:
60
,
max_attempts:
3
0
)
expect
{
usage_quota
.
additional_minutes?
}.
to
eventually_be_truthy
.
within
(
max_duration:
120
,
max_attempts:
60
,
reload_page:
page
)
expect
(
usage_quota
.
additional_limits
).
to
eq
(
expected_minutes
.
to_s
)
end
...
...
@@ -81,16 +83,6 @@ module QA
private
# Hash presentation of CI minutes addon
# @return [Hash] CI Minutes addon
def
ci_product
{
name:
'CI Minutes'
,
# the name as it appears to purchase in GitLab
price:
10
,
# unit price in USD
minutes:
1000
# additional CI minutes per pack
}.
freeze
end
def
credit_card_info
{
name:
'QA Test'
,
...
...
qa/qa/specs/features/ee/browser_ui/fulfillment/purchase/purchase_storage_spec.rb
0 → 100644
View file @
7bf72abd
# frozen_string_literal: true
module
QA
include
QA
::
Support
::
Helpers
::
Plan
RSpec
.
describe
'Fulfillment'
,
:requires_admin
,
only:
{
subdomain: :staging
}
do
context
'Purchase Storage'
do
# the quantity of products to purchase
let
(
:purchase_quantity
)
{
5
}
let
(
:hash
)
{
SecureRandom
.
hex
(
4
)
}
let
(
:user
)
do
Resource
::
User
.
fabricate_via_api!
do
|
user
|
user
.
email
=
"test-user-
#{
hash
}
@gitlab.com"
user
.
api_client
=
Runtime
::
API
::
Client
.
as_admin
user
.
hard_delete_on_api_removal
=
true
end
end
let
(
:group
)
do
Resource
::
Sandbox
.
fabricate!
do
|
sandbox
|
sandbox
.
path
=
"gitlab-qa-group-
#{
hash
}
"
sandbox
.
api_client
=
Runtime
::
API
::
Client
.
as_admin
end
end
before
do
Runtime
::
Feature
.
enable
(
:new_route_storage_purchase
)
group
.
add_member
(
user
,
Resource
::
Members
::
AccessLevel
::
OWNER
)
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'storage'
project
.
group
=
group
project
.
initialize_with_readme
=
true
project
.
api_client
=
Runtime
::
API
::
Client
.
as_admin
end
Flow
::
Login
.
sign_in
(
as:
user
)
group
.
visit!
end
after
do
|
example
|
Runtime
::
Feature
.
disable
(
:new_route_storage_purchase
)
user
.
remove_via_api!
group
.
remove_via_api!
unless
example
.
exception
end
it
'adds additional storage to group namespace'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2424'
do
Page
::
Group
::
Menu
.
perform
(
&
:go_to_usage_quotas
)
Gitlab
::
Page
::
Group
::
Settings
::
UsageQuotas
.
perform
do
|
usage_quota
|
usage_quota
.
storage_tab
usage_quota
.
buy_storage
end
Gitlab
::
Page
::
Subscriptions
::
New
.
perform
do
|
storage
|
storage
.
quantity
=
purchase_quantity
storage
.
continue_to_billing
storage
.
country
=
user_billing_info
[
:country
]
storage
.
street_address_1
=
user_billing_info
[
:address_1
]
storage
.
street_address_2
=
user_billing_info
[
:address_2
]
storage
.
city
=
user_billing_info
[
:city
]
storage
.
state
=
user_billing_info
[
:state
]
storage
.
zip_code
=
user_billing_info
[
:zip
]
storage
.
continue_to_payment
storage
.
name_on_card
=
credit_card_info
[
:name
]
storage
.
card_number
=
credit_card_info
[
:number
]
storage
.
expiration_month
=
credit_card_info
[
:month
]
storage
.
expiration_year
=
credit_card_info
[
:year
]
storage
.
cvv
=
credit_card_info
[
:cvv
]
storage
.
review_your_order
storage
.
confirm_purchase
end
Gitlab
::
Page
::
Group
::
Settings
::
UsageQuotas
.
perform
do
|
usage_quota
|
expected_storage
=
STORAGE
[
:storage
]
*
purchase_quantity
expect
{
usage_quota
.
storage_purchase_successful_alert?
}.
to
eventually_be_truthy
.
within
(
max_duration:
60
,
max_attempts:
30
)
expect
{
usage_quota
.
purchased_storage_available?
}.
to
eventually_be_truthy
.
within
(
max_duration:
120
,
max_attempts:
60
,
reload_page:
page
)
expect
{
usage_quota
.
total_purchased_storage
}.
to
eventually_eq
(
expected_storage
.
to_f
).
within
(
max_duration:
120
,
max_attempts:
60
,
reload_page:
page
)
end
end
private
def
credit_card_info
{
name:
'QA Test'
,
number:
'4111111111111111'
,
month:
'01'
,
year:
'2025'
,
cvv:
'232'
}.
freeze
end
def
user_billing_info
{
country:
'United States of America'
,
address_1:
'Address 1'
,
address_2:
'Address 2'
,
city:
'San Francisco'
,
state:
'California'
,
zip:
'94102'
}.
freeze
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment