Commit 3f7bbbc6 authored by Chloe Liu's avatar Chloe Liu Committed by Dan Davison

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

parent 6eb47ae9
# 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,39 +37,54 @@ module QA
end
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)
Gitlab::Page::Group::Settings::Billing.perform(&:upgrade_to_ultimate)
Gitlab::Page::Subscriptions::New.perform do |new_subscription|
# Subscription details
new_subscription.continue_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 Ultimate SaaS Plan").within(max_duration: 120, max_attempts: 60, reload_page: page)
end
end
# 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
context 'with existing CI minutes pack' do
let(:ci_minutes_quantity) { 5 }
# 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
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
# Confirm
new_subscription.confirm_purchase
Flow::Purchase.purchase_ci_minutes(quantity: ci_minutes_quantity)
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|
expect do
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
......
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