Commit 98643f5b authored by Dan Davison's avatar Dan Davison

Merge branch 'ag-325156-manual-sync-specs' into 'master'

Manual Sync: add feature specs

See merge request gitlab-org/gitlab!60106
parents e1e22c04 4979de70
# frozen_string_literal: true # frozen_string_literal: true
require "spec_helper" require 'spec_helper'
RSpec.describe "Admin views Cloud License", :js do RSpec.describe 'Admin views Cloud License', :js do
let_it_be(:admin) { create(:admin) } let_it_be(:admin) { create(:admin) }
before do before do
sign_in(admin) sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin) gitlab_enable_admin_mode_sign_in(admin)
stub_application_setting(cloud_license_enabled: true) stub_application_setting(cloud_license_enabled: true)
allow(License).to receive(:current).and_return(license)
end end
License::EE_ALL_PLANS.each do |plan| context 'Cloud license' do
context "#{plan} license" do let_it_be(:license) { create_current_license(type: License::CLOUD_LICENSE_TYPE, plan: License::ULTIMATE_PLAN) }
let_it_be(:license) { build(:license, plan: plan) }
it 'displays the subscription details' do before do
visit(admin_cloud_license_path) visit(admin_cloud_license_path)
end
it 'displays the subscription details' do
page.within(find('#content-body', match: :first)) do
expect(page).to have_content('Subscription details')
expect(all("[data-testid='details-label']")[1]).to have_content('Plan:')
expect(all("[data-testid='details-content']")[1]).to have_content('Ultimate')
end
end
it 'succeeds to sync the subscription' do
page.within(find('#content-body', match: :first)) do
click_button('Sync subscription details')
expect(page).to have_content('The subscription details synced successfully')
end
end
page.within(find('#content-body', match: :first)) do it 'fails to sync the subscription' do
expect(page).to have_content("Subscription details") create_current_license(type: License::CLOUD_LICENSE_TYPE, plan: License::ULTIMATE_PLAN, expires_at: nil)
end
page.within(find('#content-body', match: :first)) do
click_button('Sync subscription details')
expect(page).to have_content('You can no longer sync your subscription details with GitLab. Get help for the most common connectivity issues by troubleshooting the activation code')
end end
end end
end end
context "when there is no license" do context 'when there is no license' do
let_it_be(:license) { nil } let_it_be(:license) { nil }
before do before do
allow(License).to receive(:current).and_return(license)
visit(admin_cloud_license_path) visit(admin_cloud_license_path)
end end
it "displays a message signaling there is not active subscription" do it 'displays a message signaling there is not active subscription' do
page.within(find('#content-body', match: :first)) do page.within(find('#content-body', match: :first)) do
expect(page).to have_content("You do not have an active subscription") expect(page).to have_content('You do not have an active subscription')
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