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
b7b26416
Commit
b7b26416
authored
Mar 14, 2022
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Group namespace billing hand raise test improvement
parent
394460bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
52 deletions
+58
-52
ee/spec/features/billings/billing_plans_spec.rb
ee/spec/features/billings/billing_plans_spec.rb
+58
-52
No files found.
ee/spec/features/billings/billing_plans_spec.rb
View file @
b7b26416
...
@@ -63,65 +63,71 @@ RSpec.describe 'Billing plan pages', :feature, :js do
...
@@ -63,65 +63,71 @@ RSpec.describe 'Billing plan pages', :feature, :js do
end
end
end
end
shared_examples
'can contact sales'
do
shared_examples
'can
not
contact sales'
do
before
do
before
do
visit
page_path
visit
page_path
end
end
it
'displays the in-app hand raise lead'
,
:aggregate_failures
do
it
'does not render in-app hand raise lead'
do
if
namespace
.
group_namespace?
expect
(
page
).
to
have_selector
(
".js-hand-raise-lead-button[data-namespace-id='
#{
namespace
.
id
}
'][data-user-name='
#{
user
.
username
}
']"
,
visible:
false
)
form_data
=
{
end
first_name:
user
.
first_name
,
end
last_name:
user
.
last_name
,
phone_number:
'+1 23 456-78-90'
,
company_size:
'1 - 99'
,
company_name:
user
.
organization
,
country:
{
id:
'US'
,
name:
'United States of America'
},
state:
{
id:
'CA'
,
name:
'California'
}
}
hand_raise_lead_params
=
{
"first_name"
=>
form_data
[
:first_name
],
"last_name"
=>
form_data
[
:last_name
],
"company_name"
=>
form_data
[
:company_name
],
"company_size"
=>
form_data
[
:company_size
].
delete
(
' '
),
"phone_number"
=>
form_data
[
:phone_number
],
"country"
=>
form_data
.
dig
(
:country
,
:id
),
"state"
=>
form_data
.
dig
(
:state
,
:id
),
"namespace_id"
=>
namespace
.
id
,
"comment"
=>
''
,
"glm_content"
=>
'billing-group'
,
"work_email"
=>
user
.
email
,
"uid"
=>
user
.
id
,
"setup_for_company"
=>
user
.
setup_for_company
,
"provider"
=>
"gitlab"
,
"glm_source"
=>
'gitlab.com'
}
lead_params
=
ActionController
::
Parameters
.
new
(
hand_raise_lead_params
).
permit!
shared_examples
'can contact sales'
do
before
do
visit
page_path
end
expect_next_instance_of
(
GitlabSubscriptions
::
CreateHandRaiseLeadService
)
do
|
service
|
it
'displays the in-app hand raise lead'
,
:aggregate_failures
do
expect
(
service
).
to
receive
(
:execute
).
with
(
lead_params
).
and_return
(
double
(
'lead'
,
success?:
true
))
form_data
=
{
end
first_name:
user
.
first_name
,
last_name:
user
.
last_name
,
phone_number:
'+1 23 456-78-90'
,
company_size:
'1 - 99'
,
company_name:
user
.
organization
,
country:
{
id:
'US'
,
name:
'United States of America'
},
state:
{
id:
'CA'
,
name:
'California'
}
}
hand_raise_lead_params
=
{
"first_name"
=>
form_data
[
:first_name
],
"last_name"
=>
form_data
[
:last_name
],
"company_name"
=>
form_data
[
:company_name
],
"company_size"
=>
form_data
[
:company_size
].
delete
(
' '
),
"phone_number"
=>
form_data
[
:phone_number
],
"country"
=>
form_data
.
dig
(
:country
,
:id
),
"state"
=>
form_data
.
dig
(
:state
,
:id
),
"namespace_id"
=>
namespace
.
id
,
"comment"
=>
''
,
"glm_content"
=>
'billing-group'
,
"work_email"
=>
user
.
email
,
"uid"
=>
user
.
id
,
"setup_for_company"
=>
user
.
setup_for_company
,
"provider"
=>
"gitlab"
,
"glm_source"
=>
'gitlab.com'
}
lead_params
=
ActionController
::
Parameters
.
new
(
hand_raise_lead_params
).
permit!
expect_next_instance_of
(
GitlabSubscriptions
::
CreateHandRaiseLeadService
)
do
|
service
|
expect
(
service
).
to
receive
(
:execute
).
with
(
lead_params
).
and_return
(
double
(
'lead'
,
success?:
true
))
end
page
.
within
(
'[data-testid="plan-card-premium"]'
)
do
page
.
within
(
'[data-testid="plan-card-premium"]'
)
do
click_button
'Contact sales'
click_button
'Contact sales'
end
end
expect
(
page
).
to
have_content
(
'Contact our Sales team'
)
expect
(
page
).
to
have_content
(
'Contact our Sales team'
)
expect
(
page
).
to
have_field
(
'First Name'
,
with:
form_data
[
:first_name
])
expect
(
page
).
to
have_field
(
'First Name'
,
with:
form_data
[
:first_name
])
expect
(
page
).
to
have_field
(
'Last Name'
,
with:
form_data
[
:last_name
])
expect
(
page
).
to
have_field
(
'Last Name'
,
with:
form_data
[
:last_name
])
expect
(
page
).
to
have_field
(
'Company Name'
,
with:
form_data
[
:company_name
])
expect
(
page
).
to
have_field
(
'Company Name'
,
with:
form_data
[
:company_name
])
page
.
within
(
'[data-testid="hand-raise-lead-modal"]'
)
do
page
.
within
(
'[data-testid="hand-raise-lead-modal"]'
)
do
select
form_data
[
:company_size
],
from:
'company-size'
select
form_data
[
:company_size
],
from:
'company-size'
fill_in
'phone-number'
,
with:
form_data
[
:phone_number
]
fill_in
'phone-number'
,
with:
form_data
[
:phone_number
]
select
form_data
.
dig
(
:country
,
:name
),
from:
'country'
select
form_data
.
dig
(
:country
,
:name
),
from:
'country'
select
form_data
.
dig
(
:state
,
:name
),
from:
'state'
select
form_data
.
dig
(
:state
,
:name
),
from:
'state'
click_button
'Submit information'
click_button
'Submit information'
end
else
expect
(
page
).
to
have_selector
(
".js-hand-raise-lead-button[data-namespace-id='
#{
namespace
.
id
}
'][data-user-name='
#{
user
.
username
}
']"
,
visible:
false
)
end
end
end
end
end
end
...
@@ -293,7 +299,7 @@ RSpec.describe 'Billing plan pages', :feature, :js do
...
@@ -293,7 +299,7 @@ RSpec.describe 'Billing plan pages', :feature, :js do
it_behaves_like
'plan with header'
it_behaves_like
'plan with header'
it_behaves_like
'downgradable plan'
it_behaves_like
'downgradable plan'
it_behaves_like
'upgradable plan'
it_behaves_like
'upgradable plan'
it_behaves_like
'can contact sales'
it_behaves_like
'can
not
contact sales'
it_behaves_like
'plan with subscription table'
it_behaves_like
'plan with subscription table'
context
'when hide_deprecated_billing_plans is active'
do
context
'when hide_deprecated_billing_plans is active'
do
...
@@ -327,7 +333,7 @@ RSpec.describe 'Billing plan pages', :feature, :js do
...
@@ -327,7 +333,7 @@ RSpec.describe 'Billing plan pages', :feature, :js do
it_behaves_like
'plan with header'
it_behaves_like
'plan with header'
it_behaves_like
'downgradable plan'
it_behaves_like
'downgradable plan'
it_behaves_like
'upgradable plan'
it_behaves_like
'upgradable plan'
it_behaves_like
'can contact sales'
it_behaves_like
'can
not
contact sales'
it_behaves_like
'plan with subscription table'
it_behaves_like
'plan with subscription table'
it_behaves_like
'does not display EoA banner'
it_behaves_like
'does not display EoA banner'
end
end
...
@@ -386,7 +392,7 @@ RSpec.describe 'Billing plan pages', :feature, :js do
...
@@ -386,7 +392,7 @@ RSpec.describe 'Billing plan pages', :feature, :js do
it_behaves_like
'plan with header'
it_behaves_like
'plan with header'
it_behaves_like
'downgradable plan'
it_behaves_like
'downgradable plan'
it_behaves_like
'upgradable plan'
it_behaves_like
'upgradable plan'
it_behaves_like
'can contact sales'
it_behaves_like
'can
not
contact sales'
end
end
context
'on ultimate plan'
do
context
'on ultimate plan'
do
...
...
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