Commit 0038d3a2 authored by James Lopez's avatar James Lopez

Merge branch 'astoicescu-feature-specs-2' into 'master'

Add feature specs for Upgrade Offer scenarios

See merge request gitlab-org/gitlab!56017
parents 3edf67c8 18f0120d
......@@ -109,7 +109,7 @@ module BillingPlansHelper
css_classes = %w[btn btn-success gl-button]
css_classes << 'disabled' if is_current_plan && !namespace.trial_active?
css_classes << 'invisible' if plan.deprecated?
css_classes << 'invisible' if ::Feature.enabled?(:hide_deprecated_billing_plans) && plan.deprecated?
css_classes.join(' ')
end
......
......@@ -7,7 +7,7 @@
- faq_link_url = 'https://about.gitlab.com/pricing/faq-new-product-subscription-tiers'
- faq_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: faq_link_url }
.card-wrapper{ class: ("card-wrapper-has-badge" if has_upgrade) }
.card-wrapper{ class: ("card-wrapper-has-badge" if has_upgrade), data: { testid: "plan-card-#{plan.code}" } }
- if has_upgrade
.card-badge
%span.card-badge-text
......
......@@ -3,7 +3,7 @@
module SubscriptionPortalHelpers
include StubRequests
def stub_eoa_eligibility_request(namespace_id)
def stub_eoa_eligibility_request(namespace_id, eligible = false, free_upgrade_plan_id = nil, assisted_upgrade_plan_id = nil)
stub_full_request("#{EE::SUBSCRIPTIONS_URL}/graphql", method: :post)
.with(
body: "{\"query\":\"{\\n subscription(namespaceId: \\\"#{namespace_id}\\\") {\\n eoaStarterBronzeEligible\\n assistedUpgradePlanId\\n freeUpgradePlanId\\n }\\n}\\n\"}",
......@@ -17,7 +17,7 @@ module SubscriptionPortalHelpers
.to_return(
status: 200,
headers: { 'Content-Type' => 'application/json' },
body: stubbed_eoa_eligibility_response_body
body: stubbed_eoa_eligibility_response_body(eligible, free_upgrade_plan_id, assisted_upgrade_plan_id)
)
end
......@@ -41,13 +41,13 @@ module SubscriptionPortalHelpers
private
def stubbed_eoa_eligibility_response_body
def stubbed_eoa_eligibility_response_body(eligible, free_upgrade_plan_id, assisted_upgrade_plan_id)
{
"data": {
"subscription": {
"eoaStarterBronzeEligible": false,
"assistedUpgradePlanId": nil,
"freeUpgradePlanId": nil
"eoaStarterBronzeEligible": eligible,
"assistedUpgradePlanId": free_upgrade_plan_id,
"freeUpgradePlanId": assisted_upgrade_plan_id
}
}
}.to_json
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment