Commit b22ba066 authored by Angelo Gulina's avatar Angelo Gulina Committed by Dan Davison

Specs for modal component

parent a19e7b79
...@@ -148,7 +148,11 @@ export default { ...@@ -148,7 +148,11 @@ export default {
:invalid-feedback="$options.i18n.fieldRequiredMessage" :invalid-feedback="$options.i18n.fieldRequiredMessage"
data-testid="form-group-terms" 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"> <gl-sprintf :message="$options.i18n.acceptTerms">
<template #link="{ content }"> <template #link="{ content }">
<gl-link href="https://about.gitlab.com/terms/" target="_blank" <gl-link href="https://about.gitlab.com/terms/" target="_blank"
......
...@@ -43,6 +43,39 @@ RSpec.describe 'Admin views Cloud License', :js do ...@@ -43,6 +43,39 @@ RSpec.describe 'Admin views Cloud License', :js do
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') 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
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 end
context 'when there is no license' do context 'when there is no license' do
...@@ -68,4 +101,12 @@ RSpec.describe 'Admin views Cloud License', :js do ...@@ -68,4 +101,12 @@ RSpec.describe 'Admin views Cloud License', :js do
end end
end 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 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