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
module QA
include QA::Support::Helpers::Plan
RSpec.describe 'Fulfillment', :requires_admin, only: { subdomain: :staging } do
describe 'Purchase' do
describe 'group plan' do
......@@ -35,32 +37,7 @@ module QA
end
it 'upgrades from free to ultimate', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347667' 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
Flow::Purchase.upgrade_subscription(plan: ULTIMATE)
Page::Group::Menu.perform(&:go_to_billing)
......@@ -70,6 +47,46 @@ module QA
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
context 'with existing CI minutes pack' do
let(:ci_minutes_quantity) { 5 }
before do
Resource::Project.fabricate_via_api! do |project|
project.name = 'ci-minutes'
project.group = group
project.initialize_with_readme = true
project.api_client = Runtime::API::Client.as_admin
end
Flow::Purchase.purchase_ci_minutes(quantity: ci_minutes_quantity)
end
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|
expect do
billing.billing_plan_header
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
......
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