Commit 0c3b6bf0 authored by Dan Davison's avatar Dan Davison

Merge branch 'e2e-subscription-test' into 'master'

Add e2e tests for upgrade group subscription with existing add-on purchase

See merge request gitlab-org/gitlab!76890
parents b283cc3a 3f7bbbc6
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
include QA::Support::Helpers::Plan
RSpec.describe 'Fulfillment', :requires_admin, only: { subdomain: :staging } do RSpec.describe 'Fulfillment', :requires_admin, only: { subdomain: :staging } do
describe 'Purchase' do describe 'Purchase' do
describe 'group plan' do describe 'group plan' do
...@@ -35,39 +37,54 @@ module QA ...@@ -35,39 +37,54 @@ module QA
end end
it 'upgrades from free to ultimate', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347667' do it 'upgrades from free to ultimate', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347667' do
Flow::Purchase.upgrade_subscription(plan: ULTIMATE)
Page::Group::Menu.perform(&:go_to_billing) Page::Group::Menu.perform(&:go_to_billing)
Gitlab::Page::Group::Settings::Billing.perform(&:upgrade_to_ultimate)
Gitlab::Page::Subscriptions::New.perform do |new_subscription| Gitlab::Page::Group::Settings::Billing.perform do |billing|
# Subscription details expect do
new_subscription.continue_to_billing billing.billing_plan_header
end.to eventually_include("#{group.path} is currently using the Ultimate SaaS Plan").within(max_duration: 120, max_attempts: 60, reload_page: page)
end
end
# Billing information context 'with existing CI minutes pack' do
new_subscription.country = 'United States of America' let(:ci_minutes_quantity) { 5 }
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 before do
new_subscription.name_on_card = 'QA Test User' Resource::Project.fabricate_via_api! do |project|
new_subscription.card_number = '4111 1111 1111 1111' project.name = 'ci-minutes'
new_subscription.expiration_month = '01' project.group = group
new_subscription.expiration_year = '2030' project.initialize_with_readme = true
new_subscription.cvv = '789' project.api_client = Runtime::API::Client.as_admin
new_subscription.review_your_order end
# Confirm Flow::Purchase.purchase_ci_minutes(quantity: ci_minutes_quantity)
new_subscription.confirm_purchase
end end
Page::Group::Menu.perform(&:go_to_billing) it 'upgrades from free to premium with correct CI minutes', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349085' do
Flow::Purchase.upgrade_subscription(plan: PREMIUM)
expected_minutes = CI_MINUTES[:ci_minutes] * ci_minutes_quantity
plan_limits = PREMIUM[:ci_minutes]
Page::Group::Menu.perform(&:go_to_billing)
Gitlab::Page::Group::Settings::Billing.perform do |billing| Gitlab::Page::Group::Settings::Billing.perform do |billing|
expect do expect do
billing.billing_plan_header billing.billing_plan_header
end.to eventually_include("#{group.path} is currently using the Ultimate SaaS Plan").within(max_duration: 120, max_attempts: 60, reload_page: page) end.to eventually_include("#{group.path} is currently using the Premium SaaS Plan").within(max_duration: 120, max_attempts: 60, sleep_interval: 2, reload_page: page)
end
Page::Group::Menu.perform(&:go_to_usage_quotas)
Gitlab::Page::Group::Settings::UsageQuotas.perform do |usage_quota|
usage_quota.pipeline_tab
expect { usage_quota.additional_ci_minutes? }.to eventually_be_truthy.within(max_duration: 120, max_attempts: 60, reload_page: page)
aggregate_failures do
expect(usage_quota.additional_ci_limits).to eq(expected_minutes.to_s)
expect(usage_quota.plan_ci_limits).to eq(plan_limits.to_s)
end
end
end end
end end
end end
......
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