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
0fea04b8
Commit
0fea04b8
authored
Nov 30, 2021
by
Chloe Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add e2e tests for CI minutes purchase
parent
f3915fd9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
24 deletions
+100
-24
qa/lib/gitlab/page/group/settings/usage_quotas.rb
qa/lib/gitlab/page/group/settings/usage_quotas.rb
+2
-0
qa/qa/specs/features/ee/browser_ui/fulfillment/purchase/purchase_ci_spec.rb
...es/ee/browser_ui/fulfillment/purchase/purchase_ci_spec.rb
+98
-24
No files found.
qa/lib/gitlab/page/group/settings/usage_quotas.rb
View file @
0fea04b8
...
@@ -10,7 +10,9 @@ module Gitlab
...
@@ -10,7 +10,9 @@ module Gitlab
link
:buy_ci_minutes
,
text:
'Buy additional minutes'
link
:buy_ci_minutes
,
text:
'Buy additional minutes'
link
:buy_storage
,
text:
/Purchase more storage/
link
:buy_storage
,
text:
/Purchase more storage/
strong
:additional_minutes
,
text:
'Additional minutes'
strong
:additional_minutes
,
text:
'Additional minutes'
strong
:plan_minutes
,
text:
'Current period usage'
div
:purchased_usage
,
'data-testid'
:
'purchased-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
(
:additional_minutes_usage
)
{
additional_minutes_element
.
following_sibling
.
span
}
div
:ci_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/
div
:storage_purchase_successful_alert
,
text:
/You have successfully purchased a storage/
...
...
qa/qa/specs/features/ee/browser_ui/fulfillment/purchase/purchase_ci_spec.rb
View file @
0fea04b8
...
@@ -38,51 +38,125 @@ module QA
...
@@ -38,51 +38,125 @@ module QA
group
.
visit!
group
.
visit!
end
end
after
do
|
example
|
after
do
user
.
remove_via_api!
user
.
remove_via_api!
group
.
remove_via_api!
unless
example
.
exception
end
context
'without active subscription'
do
after
do
group
.
remove_via_api!
end
end
it
'adds additional minutes to group namespace'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2260'
do
it
'adds additional minutes to group namespace'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2260'
do
Page
::
Group
::
Menu
.
perform
(
&
:go_to_usage_quotas
)
purchase_ci_minutes
Gitlab
::
Page
::
Group
::
Settings
::
UsageQuotas
.
perform
do
|
usage_quota
|
Gitlab
::
Page
::
Group
::
Settings
::
UsageQuotas
.
perform
do
|
usage_quota
|
usage_quota
.
pipeline_tab
expected_minutes
=
CI_MINUTES
[
:ci_minutes
]
*
purchase_quantity
usage_quota
.
buy_ci_minutes
expect
{
usage_quota
.
ci_purchase_successful_alert?
}.
to
eventually_be_truthy
.
within
(
max_duration:
60
,
max_attempts:
30
)
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
end
end
end
Gitlab
::
Page
::
Subscriptions
::
New
.
perform
do
|
ci_minutes
|
context
'with an active subscription'
do
ci_minutes
.
quantity
=
purchase_quantity
before
do
ci_minutes
.
continue_to_billing
Page
::
Group
::
Menu
.
perform
(
&
:go_to_billing
)
Gitlab
::
Page
::
Group
::
Settings
::
Billing
.
perform
(
&
:upgrade_to_ultimate
)
ci_minutes
.
country
=
user_billing_info
[
:country
]
Gitlab
::
Page
::
Subscriptions
::
New
.
perform
do
|
new_subscription
|
ci_minutes
.
street_address_1
=
user_billing_info
[
:address_1
]
new_subscription
.
continue_to_billing
ci_minutes
.
street_address_2
=
user_billing_info
[
:address_2
]
ci_minutes
.
city
=
user_billing_info
[
:city
]
ci_minutes
.
state
=
user_billing_info
[
:state
]
ci_minutes
.
zip_code
=
user_billing_info
[
:zip
]
ci_minutes
.
continue_to_payment
ci_minutes
.
name_on_card
=
credit_card_info
[
:name
]
ci_minutes
.
card_number
=
credit_card_info
[
:number
]
ci_minutes
.
expiration_month
=
credit_card_info
[
:month
]
ci_minutes
.
expiration_year
=
credit_card_info
[
:year
]
ci_minutes
.
cvv
=
credit_card_info
[
:cvv
]
ci_minutes
.
review_your_order
ci_minutes
.
confirm_purchase
fill_in_customer_info
fill_in_payment_info
new_subscription
.
confirm_purchase
end
end
end
it
'adds additional minutes to group namespace'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2430'
do
purchase_ci_minutes
Gitlab
::
Page
::
Group
::
Settings
::
UsageQuotas
.
perform
do
|
usage_quota
|
Gitlab
::
Page
::
Group
::
Settings
::
UsageQuotas
.
perform
do
|
usage_quota
|
expected_minutes
=
CI_MINUTES
[
:ci_minutes
]
*
purchase_quantity
expected_minutes
=
CI_MINUTES
[
:ci_minutes
]
*
purchase_quantity
plan_limits
=
ULTIMATE
[
:ci_minutes
]
expect
{
usage_quota
.
ci_purchase_successful_alert?
}.
to
eventually_be_truthy
.
within
(
max_duration:
60
,
max_attempts:
30
)
expect
{
usage_quota
.
ci_purchase_successful_alert?
}.
to
eventually_be_truthy
.
within
(
max_duration:
60
,
max_attempts:
30
)
expect
{
usage_quota
.
additional_minutes?
}.
to
eventually_be_truthy
.
within
(
max_duration:
120
,
max_attempts:
60
,
reload_page:
page
)
expect
{
usage_quota
.
additional_minutes?
}.
to
eventually_be_truthy
.
within
(
max_duration:
120
,
max_attempts:
60
,
reload_page:
page
)
aggregate_failures
do
expect
(
usage_quota
.
additional_limits
).
to
eq
(
expected_minutes
.
to_s
)
expect
(
usage_quota
.
additional_limits
).
to
eq
(
expected_minutes
.
to_s
)
expect
(
usage_quota
.
plan_minutes_limits
).
to
eq
(
plan_limits
.
to_s
)
end
end
end
end
context
'with existing CI minutes packs'
do
before
do
purchase_ci_minutes
end
after
do
group
.
remove_via_api!
end
it
'adds additional minutes to group namespace'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2431'
do
purchase_ci_minutes
Gitlab
::
Page
::
Group
::
Settings
::
UsageQuotas
.
perform
do
|
usage_quota
|
expected_minutes
=
CI_MINUTES
[
:ci_minutes
]
*
purchase_quantity
*
2
expect
{
usage_quota
.
ci_purchase_successful_alert?
}.
to
eventually_be_truthy
.
within
(
max_duration:
60
,
max_attempts:
30
)
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
end
end
end
end
private
private
def
purchase_ci_minutes
Page
::
Group
::
Menu
.
perform
(
&
:go_to_usage_quotas
)
Gitlab
::
Page
::
Group
::
Settings
::
UsageQuotas
.
perform
do
|
usage_quota
|
usage_quota
.
pipeline_tab
usage_quota
.
buy_ci_minutes
end
Gitlab
::
Page
::
Subscriptions
::
New
.
perform
do
|
ci_minutes
|
ci_minutes
.
quantity
=
purchase_quantity
ci_minutes
.
continue_to_billing
fill_in_customer_info
fill_in_payment_info
ci_minutes
.
confirm_purchase
end
end
def
fill_in_customer_info
Gitlab
::
Page
::
Subscriptions
::
New
.
perform
do
|
subscription
|
subscription
.
country
=
user_billing_info
[
:country
]
subscription
.
street_address_1
=
user_billing_info
[
:address_1
]
subscription
.
street_address_2
=
user_billing_info
[
:address_2
]
subscription
.
city
=
user_billing_info
[
:city
]
subscription
.
state
=
user_billing_info
[
:state
]
subscription
.
zip_code
=
user_billing_info
[
:zip
]
subscription
.
continue_to_payment
end
end
def
fill_in_payment_info
Gitlab
::
Page
::
Subscriptions
::
New
.
perform
do
|
subscription
|
subscription
.
name_on_card
=
credit_card_info
[
:name
]
subscription
.
card_number
=
credit_card_info
[
:number
]
subscription
.
expiration_month
=
credit_card_info
[
:month
]
subscription
.
expiration_year
=
credit_card_info
[
:year
]
subscription
.
cvv
=
credit_card_info
[
:cvv
]
subscription
.
review_your_order
end
end
def
credit_card_info
def
credit_card_info
{
{
name:
'QA Test'
,
name:
'QA Test'
,
...
...
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