Commit 6d9e0bf6 authored by Alper Akgun's avatar Alper Akgun

Make phone number field optional for trial form

Runs an experiment with making the phone number field optional within
SaaS trial sign up behind a feature flag
parent bc0022ca
- page_title _('Start your Free Gold Trial')
- glm_params = { glm_source: params[:glm_source], glm_content: params[:glm_content] }
- phone_number_required = Feature.disabled?(:trial_form_phone_optional, current_user)
- phone_number_label = phone_number_required ? _('Telephone number') : _('Telephone number (Optional)')
%h3.center.pt-6
= _('Start your Free Gold Trial')
......@@ -23,8 +25,8 @@
= label_tag :company_size, _('Number of employees'), for: :company_size, class: 'col-form-label'
= select_tag :company_size, company_size_options_for_select(params[:company_size]), include_blank: true, class: 'select2', required: true
.form-group
= label_tag :phone_number, _('Telephone number'), for: :phone_number, class: 'col-form-label'
= text_field_tag :phone_number, params[:phone_number], class: 'form-control', required: true
= label_tag :phone_number, phone_number_label, for: :phone_number, class: 'col-form-label'
= text_field_tag :phone_number, params[:phone_number], class: 'form-control', required: phone_number_required
.form-group
= label_tag :number_of_users, _('How many users will be evaluating the trial?'), for: :number_of_users, class: 'col-form-label'
= number_field_tag :number_of_users, params[:number_of_users], class: 'form-control', required: true, min: 1
......
......@@ -12,12 +12,38 @@ describe 'Trial Capture Lead', :js do
end
context 'when user' do
let(:trial_form_phone_optional_feature_enabled) { false }
before do
stub_feature_flags(trial_form_phone_optional: trial_form_phone_optional_feature_enabled)
visit new_trial_path
wait_for_requests
end
context 'phone number is optional' do
let(:trial_form_phone_optional_feature_enabled) { true }
context 'without phone number' do
it 'proceeds to the next step' do
expect_any_instance_of(GitlabSubscriptions::CreateLeadService).to receive(:execute) do
{ success: true }
end
fill_in 'company_name', with: 'GitLab'
select2 '1-99', from: '#company_size'
fill_in 'number_of_users', with: '1'
select2 'US', from: '#country_select'
click_button 'Continue'
expect(page).not_to have_css('flash-container')
expect(current_path).to eq(select_trials_path)
end
end
end
context 'enters valid company information' do
before do
expect_any_instance_of(GitlabSubscriptions::CreateLeadService).to receive(:execute) do
......
......@@ -20207,6 +20207,9 @@ msgstr ""
msgid "Telephone number"
msgstr ""
msgid "Telephone number (Optional)"
msgstr ""
msgid "Template"
msgstr ""
......
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