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
25fa866d
Commit
25fa866d
authored
Jul 27, 2021
by
ddavison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add upgrade_group_spec.rb and author Chemlab lib
Add Chemlab library for GitLab
parent
e13a197c
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
963 additions
and
2 deletions
+963
-2
ee/app/views/shared/billings/_billing_plan.html.haml
ee/app/views/shared/billings/_billing_plan.html.haml
+1
-1
qa/chemlab-library-gitlab.gemspec
qa/chemlab-library-gitlab.gemspec
+22
-0
qa/lib/gitlab.rb
qa/lib/gitlab.rb
+20
-0
qa/lib/gitlab/page/group/settings/billing.rb
qa/lib/gitlab/page/group/settings/billing.rb
+19
-0
qa/lib/gitlab/page/group/settings/billing.stub.rb
qa/lib/gitlab/page/group/settings/billing.stub.rb
+107
-0
qa/lib/gitlab/page/main/login.rb
qa/lib/gitlab/page/main/login.rb
+22
-0
qa/lib/gitlab/page/main/login.stub.rb
qa/lib/gitlab/page/main/login.stub.rb
+101
-0
qa/lib/gitlab/page/subscriptions/new.rb
qa/lib/gitlab/page/subscriptions/new.rb
+41
-0
qa/lib/gitlab/page/subscriptions/new.stub.rb
qa/lib/gitlab/page/subscriptions/new.stub.rb
+545
-0
qa/qa.rb
qa/qa.rb
+2
-0
qa/qa/specs/features/ee/browser_ui/fulfillment/purchase/upgrade_group_spec.rb
.../ee/browser_ui/fulfillment/purchase/upgrade_group_spec.rb
+80
-0
qa/spec/support/matchers/eventually_matcher.rb
qa/spec/support/matchers/eventually_matcher.rb
+3
-1
No files found.
ee/app/views/shared/billings/_billing_plan.html.haml
View file @
25fa866d
...
...
@@ -72,4 +72,4 @@
-
if
show_contact_sales_button
=
link_to
s_
(
'BillingPlan|Contact sales'
),
"
#{
contact_sales_url
}
?test=inappcontactsales
#{
plan
.
code
}
"
,
class:
[
"btn gl-button"
,
show_upgrade_button
?
"btn-success-secondary"
:
"btn-success"
],
data:
{
**
experiment_tracking_data_for_button_click
(
'contact_sales'
)
}
-
if
show_upgrade_button
=
link_to
upgrade_button_text
,
plan_purchase_or_upgrade_url
(
namespace
,
plan
),
class:
"
#{
upgrade_button_classes
}
billing-cta-purchase
#{
cta_class
}
gl-ml-3"
,
data:
{
**
experiment_tracking_data_for_button_click
(
'upgrade'
)
}
=
link_to
upgrade_button_text
,
plan_purchase_or_upgrade_url
(
namespace
,
plan
),
class:
"
#{
upgrade_button_classes
}
billing-cta-purchase
#{
cta_class
}
gl-ml-3"
,
data:
{
**
experiment_tracking_data_for_button_click
(
'upgrade'
)
,
qa_selector:
"upgrade_to_
#{
plan
.
code
}
"
}
qa/chemlab-library-gitlab.gemspec
0 → 100644
View file @
25fa866d
# frozen_string_literal: true
$:
.
unshift
(
File
.
expand_path
(
'lib'
,
__dir__
))
Gem
::
Specification
.
new
do
|
spec
|
spec
.
name
=
'chemlab-library-gitlab'
spec
.
version
=
'0.1.1'
spec
.
authors
=
[
'GitLab Quality'
]
spec
.
email
=
[
'quality@gitlab.com'
]
spec
.
required_ruby_version
=
'>= 2.5'
# rubocop:disable Gemspec/RequiredRubyVersion
spec
.
summary
=
'Chemlab Page Libraries for GitLab'
spec
.
homepage
=
'https://gitlab.com/'
spec
.
license
=
'MIT'
spec
.
files
=
`git ls-files -- lib/*`
.
split
(
"
\n
"
)
spec
.
require_paths
=
[
'lib'
]
spec
.
add_runtime_dependency
'chemlab'
,
'~> 0.7'
end
qa/lib/gitlab.rb
0 → 100644
View file @
25fa866d
# frozen_string_literal: true
# Chemlab Page Libraries for GitLab
module
Gitlab
module
Page
module
Main
autoload
:Login
,
'gitlab/page/main/login'
end
module
Subscriptions
autoload
:New
,
'gitlab/page/subscriptions/new'
end
module
Group
module
Settings
autoload
:Billing
,
'gitlab/page/group/settings/billing'
end
end
end
end
qa/
qa
/page/group/settings/billing.rb
→
qa/
lib/gitlab
/page/group/settings/billing.rb
View file @
25fa866d
# frozen_string_literal: true
module
QA
module
Gitlab
module
Page
module
Group
module
Settings
class
Billing
<
Chemlab
::
Page
# TODO: Supplant with data-qa-selectors
h4
:billing_plan_header
,
css:
'div.billing-plan-header h4'
link
:start_your_free_trial
link
:upgrade_to_premium
,
css:
'[data-testid="plan-card-premium"] a.billing-cta-purchase-new'
link
:upgrade_to_ultimate
,
css:
'[data-testid="plan-card-ultimate"] a.billing-cta-purchase-new'
end
end
end
...
...
qa/lib/gitlab/page/group/settings/billing.stub.rb
0 → 100644
View file @
25fa866d
# frozen_string_literal: true
module
Gitlab
module
Page
module
Group
module
Settings
module
Billing
# @note Defined as +h4 :billing_plan_header+
# @return [String] The text content or value of +billing_plan_header+
def
billing_plan_header
# This is a stub, used for indexing. The method is dynamically generated.
end
# @example
# Gitlab::Page::Group::Settings::Billing.perform do |billing|
# expect(billing.billing_plan_header_element).to exist
# end
# @return [Watir::H4] The raw +H4+ element
def
billing_plan_header_element
# This is a stub, used for indexing. The method is dynamically generated.
end
# @example
# Gitlab::Page::Group::Settings::Billing.perform do |billing|
# expect(billing).to be_billing_plan_header
# end
# @return [Boolean] true if the +billing_plan_header+ element is present on the page
def
billing_plan_header?
# This is a stub, used for indexing. The method is dynamically generated.
end
# @note Defined as +link :start_your_free_trial+
# Clicks +start_your_free_trial+
def
start_your_free_trial
# This is a stub, used for indexing. The method is dynamically generated.
end
# @example
# Gitlab::Page::Group::Settings::Billing.perform do |billing|
# expect(billing.start_your_free_trial_element).to exist
# end
# @return [Watir::Link] The raw +Link+ element
def
start_your_free_trial_element
# This is a stub, used for indexing. The method is dynamically generated.
end
# @example
# Gitlab::Page::Group::Settings::Billing.perform do |billing|
# expect(billing).to be_start_your_free_trial
# end
# @return [Boolean] true if the +start_your_free_trial+ element is present on the page
def
start_your_free_trial?
# This is a stub, used for indexing. The method is dynamically generated.
end
# @note Defined as +link :upgrade_to_premium+
# Clicks +upgrade_to_premium+
def
upgrade_to_premium
# This is a stub, used for indexing. The method is dynamically generated.
end
# @example
# Gitlab::Page::Group::Settings::Billing.perform do |billing|
# expect(billing.upgrade_to_premium_element).to exist
# end
# @return [Watir::Link] The raw +Link+ element
def
upgrade_to_premium_element
# This is a stub, used for indexing. The method is dynamically generated.
end
# @example
# Gitlab::Page::Group::Settings::Billing.perform do |billing|
# expect(billing).to be_upgrade_to_premium
# end
# @return [Boolean] true if the +upgrade_to_premium+ element is present on the page
def
upgrade_to_premium?
# This is a stub, used for indexing. The method is dynamically generated.
end
# @note Defined as +link :upgrade_to_ultimate+
# Clicks +upgrade_to_ultimate+
def
upgrade_to_ultimate
# This is a stub, used for indexing. The method is dynamically generated.
end
# @example
# Gitlab::Page::Group::Settings::Billing.perform do |billing|
# expect(billing.upgrade_to_ultimate_element).to exist
# end
# @return [Watir::Link] The raw +Link+ element
def
upgrade_to_ultimate_element
# This is a stub, used for indexing. The method is dynamically generated.
end
# @example
# Gitlab::Page::Group::Settings::Billing.perform do |billing|
# expect(billing).to be_upgrade_to_ultimate
# end
# @return [Boolean] true if the +upgrade_to_ultimate+ element is present on the page
def
upgrade_to_ultimate?
# This is a stub, used for indexing. The method is dynamically generated.
end
end
end
end
end
end
qa/lib/gitlab/page/main/login.rb
0 → 100644
View file @
25fa866d
# frozen_string_literal: true
module
Gitlab
module
Page
module
Main
class
Login
<
Chemlab
::
Page
path
'/users/sign_in'
text_field
:login_field
text_field
:password_field
button
:sign_in_button
def
sign_in_as
(
username
:,
password
:)
self
.
login_field
=
username
self
.
password_field
=
password
sign_in_button
end
end
end
end
end
qa/lib/gitlab/page/main/login.stub.rb
0 → 100644
View file @
25fa866d
# frozen_string_literal: true
module
Gitlab
module
Page
module
Main
module
Login
# @note Defined as +text_field :login_field+
# @return [String] The text content or value of +login_field+
def
login_field
# This is a stub, used for indexing. The method is dynamically generated.
end
# Set the value of login_field
# @example
# Gitlab::Page::Main::Login.perform do |login|
# login.login_field = 'value'
# end
# @param value [String] The value to set.
def
login_field
=
(
value
)
# This is a stub, used for indexing. The method is dynamically generated.
end
# @example
# Gitlab::Page::Main::Login.perform do |login|
# expect(login.login_field_element).to exist
# end
# @return [Watir::TextField] The raw +TextField+ element
def
login_field_element
# This is a stub, used for indexing. The method is dynamically generated.
end
# @example
# Gitlab::Page::Main::Login.perform do |login|
# expect(login).to be_login_field
# end
# @return [Boolean] true if the +login_field+ element is present on the page
def
login_field?
# This is a stub, used for indexing. The method is dynamically generated.
end
# @note Defined as +text_field :password_field+
# @return [String] The text content or value of +password_field+
def
password_field
# This is a stub, used for indexing. The method is dynamically generated.
end
# Set the value of password_field
# @example
# Gitlab::Page::Main::Login.perform do |login|
# login.password_field = 'value'
# end
# @param value [String] The value to set.
def
password_field
=
(
value
)
# This is a stub, used for indexing. The method is dynamically generated.
end
# @example
# Gitlab::Page::Main::Login.perform do |login|
# expect(login.password_field_element).to exist
# end
# @return [Watir::TextField] The raw +TextField+ element
def
password_field_element
# This is a stub, used for indexing. The method is dynamically generated.
end
# @example
# Gitlab::Page::Main::Login.perform do |login|
# expect(login).to be_password_field
# end
# @return [Boolean] true if the +password_field+ element is present on the page
def
password_field?
# This is a stub, used for indexing. The method is dynamically generated.
end
# @note Defined as +button :sign_in_button+
# Clicks +sign_in_button+
def
sign_in_button
# This is a stub, used for indexing. The method is dynamically generated.
end
# @example
# Gitlab::Page::Main::Login.perform do |login|
# expect(login.sign_in_button_element).to exist
# end
# @return [Watir::Button] The raw +Button+ element
def
sign_in_button_element
# This is a stub, used for indexing. The method is dynamically generated.
end
# @example
# Gitlab::Page::Main::Login.perform do |login|
# expect(login).to be_sign_in_button
# end
# @return [Boolean] true if the +sign_in_button+ element is present on the page
def
sign_in_button?
# This is a stub, used for indexing. The method is dynamically generated.
end
end
end
end
end
qa/lib/gitlab/page/subscriptions/new.rb
0 → 100644
View file @
25fa866d
# frozen_string_literal: true
module
Gitlab
module
Page
module
Subscriptions
class
New
<
Chemlab
::
Page
path
'/subscriptions/new'
# Subscription Details
select
:plan_name
select
:group_name
text_field
:number_of_users
button
:continue_to_billing
,
text:
/Continue to billing/
# Billing address
select
:country
text_field
:street_address_1
text_field
:street_address_2
text_field
:city
select
:state
text_field
:zip_code
button
:continue_to_payment
,
text:
/Continue to payment/
# Payment method
# TODO: Revisit when https://gitlab.com/gitlab-org/quality/chemlab/-/issues/6 is closed
iframe
:payment_form
,
id:
'z_hppm_iframe'
text_field
(
:name_on_card
)
{
payment_form_element
.
text_field
(
id:
'input-creditCardHolderName'
)
}
text_field
(
:card_number
)
{
payment_form_element
.
text_field
(
id:
'input-creditCardNumber'
)
}
select
(
:expiration_month
)
{
payment_form_element
.
select
(
id:
'input-creditCardExpirationMonth'
)
}
select
(
:expiration_year
)
{
payment_form_element
.
select
(
id:
'input-creditCardExpirationYear'
)
}
text_field
(
:cvv
)
{
payment_form_element
.
text_field
(
id:
'input-cardSecurityCode'
)
}
link
(
:review_your_order
)
{
payment_form_element
.
link
(
text:
/Review your order/
)
}
# ENDTODO
# Confirmation
button
:confirm_purchase
,
text:
/Confirm purchase/
end
end
end
end
qa/lib/gitlab/page/subscriptions/new.stub.rb
0 → 100644
View file @
25fa866d
This diff is collapsed.
Click to expand it.
qa/qa.rb
View file @
25fa866d
...
...
@@ -8,6 +8,8 @@ require_relative '../lib/gitlab'
require_relative
'../lib/gitlab/utils'
require_relative
'../config/initializers/0_inject_enterprise_edition_module'
require_relative
'lib/gitlab'
require
'chemlab'
module
QA
...
...
qa/qa/specs/features/ee/browser_ui/fulfillment/purchase/upgrade_group_spec.rb
0 → 100644
View file @
25fa866d
# frozen_string_literal: true
module
QA
RSpec
.
describe
'Fulfillment'
,
:requires_admin
,
only:
{
subdomain: :staging
}
do
describe
'Purchase'
do
describe
'group plan'
do
let
(
:hash
)
{
SecureRandom
.
hex
(
4
)
}
let
(
:user
)
do
Resource
::
User
.
fabricate_via_api!
do
|
user
|
user
.
email
=
"gitlab-qa+
#{
hash
}
@gitlab.com"
user
.
api_client
=
Runtime
::
API
::
Client
.
as_admin
user
.
hard_delete_on_api_removal
=
true
end
end
# Normally we would delete the group, however we cannot remove this group
# after the test runs since GitLab will not allow deletion of a group
# that has a Subscription attached
let
(
:group
)
do
Resource
::
Sandbox
.
fabricate_via_api!
do
|
sandbox
|
sandbox
.
path
=
"gitlab-qa-group-
#{
hash
}
"
sandbox
.
api_client
=
Runtime
::
API
::
Client
.
as_admin
end
end
before
do
Runtime
::
Feature
.
enable
(
:top_level_group_creation_enabled
)
group
.
add_member
(
user
,
Resource
::
Members
::
AccessLevel
::
OWNER
)
Flow
::
Login
.
sign_in
(
as:
user
)
group
.
visit!
end
after
do
user
.
remove_via_api!
Runtime
::
Feature
.
disable
(
:top_level_group_creation_enabled
)
end
it
'upgrades from free to ultimate'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1863'
do
Page
::
Group
::
Menu
.
perform
(
&
:go_to_billing
)
Gitlab
::
Page
::
Group
::
Settings
::
Billing
.
perform
(
&
:upgrade_to_ultimate
)
Gitlab
::
Page
::
Subscriptions
::
New
.
perform
do
|
new_subscription
|
# Subscription details
new_subscription
.
continue_to_billing
# Billing information
new_subscription
.
country
=
'United States of America'
new_subscription
.
street_address_1
=
'QA Test Address 1'
new_subscription
.
city
=
'San Francisco'
new_subscription
.
state
=
'California'
new_subscription
.
zip_code
=
'94102'
new_subscription
.
continue_to_payment
# Payment method
new_subscription
.
name_on_card
=
'QA Test User'
new_subscription
.
card_number
=
'4111 1111 1111 1111'
new_subscription
.
expiration_month
=
'01'
new_subscription
.
expiration_year
=
'2030'
new_subscription
.
cvv
=
'789'
new_subscription
.
review_your_order
# Confirm
new_subscription
.
confirm_purchase
end
Page
::
Group
::
Menu
.
perform
(
&
:go_to_billing
)
Gitlab
::
Page
::
Group
::
Settings
::
Billing
.
perform
do
|
billing
|
expect
do
billing
.
billing_plan_header
end
.
to
eventually_include
(
"
#{
group
.
name
}
is currently using the Ultimate SaaS Plan"
).
within
(
duration:
120
,
attempts:
60
,
reload_page:
page
)
end
end
end
end
end
end
qa/spec/support/matchers/eventually_matcher.rb
View file @
25fa866d
...
...
@@ -25,6 +25,7 @@ module Matchers
@duration
=
options
[
:duration
]
@attempts
=
options
[
:attempts
]
@interval
=
options
[
:interval
]
@reload_page
=
options
[
:reload_page
]
end
def
supports_block_expectations?
...
...
@@ -59,7 +60,8 @@ module Matchers
QA
::
Support
::
Retrier
.
retry_until
(
max_attempts:
@attempts
,
max_duration:
@duration
,
sleep_interval:
@interval
||
0.5
sleep_interval:
@interval
||
0.5
,
reload_page:
@reload_page
)
do
QA
::
Runtime
::
Logger
.
debug
(
"evaluating expectation, attempt:
#{
attempt
+=
1
}
"
)
...
...
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