Commit e9d46397 authored by Dan Davison's avatar Dan Davison

Merge branch 'ag-328246-activation-modal-components-specs' into 'master'

Specs for modal component

See merge request gitlab-org/gitlab!61105
parents 40348e8f b22ba066
......@@ -148,7 +148,11 @@ export default {
:invalid-feedback="$options.i18n.fieldRequiredMessage"
data-testid="form-group-terms"
>
<gl-form-checkbox v-model="form.fields.terms.state" :state="isCheckboxValid">
<gl-form-checkbox
id="subscription-form-terms-check"
v-model="form.fields.terms.state"
:state="isCheckboxValid"
>
<gl-sprintf :message="$options.i18n.acceptTerms">
<template #link="{ content }">
<gl-link href="https://about.gitlab.com/terms/" target="_blank"
......
......@@ -67,6 +67,39 @@ RSpec.describe 'Admin views Cloud License', :js do
end
end
end
context 'activate another subscription' do
before do
click_button('Enter activation code')
end
it 'shows the activation modal' do
page.within(find('#subscription-activation-modal', match: :first)) do
expect(page).to have_content('Activate subscription')
end
end
it 'displays an error when the activation fails' do
stub_request(:post, EE::SUBSCRIPTIONS_GRAPHQL_URL).to_return(status: 422, body: '', headers: {})
page.within(find('#subscription-activation-modal', match: :first)) do
fill_activation_form
expect(page).to have_content('An error occurred while activating your subscription.')
end
end
it 'displays a connectivity error' do
stub_request(:post, EE::SUBSCRIPTIONS_GRAPHQL_URL)
.to_return(status: 500, body: '', headers: {})
page.within(find('#subscription-activation-modal', match: :first)) do
fill_activation_form
expect(page).to have_content('There is a connectivity issue.')
end
end
end
end
context 'when there is no license' do
......@@ -92,4 +125,12 @@ RSpec.describe 'Admin views Cloud License', :js do
end
end
end
private
def fill_activation_form
fill_in 'activationCode', with: 'fake-activation-code'
check 'subscription-form-terms-check'
click_button 'Activate'
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