Commit adc4e642 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '342319-improve-saas-trial-form-by-updating-required-fields' into 'master'

Remove number of users from trial form

See merge request gitlab-org/gitlab!75926
parents fdbf045d 53e9274b
......@@ -77,7 +77,6 @@ module Registrations
:company_name,
:company_size,
:phone_number,
:number_of_users,
:country
).merge(
work_email: current_user.email,
......
......@@ -131,7 +131,7 @@ class TrialsController < ApplicationController
def company_params
params.permit(:company_name, :company_size, :first_name, :last_name, :phone_number,
:number_of_users, :country, :glm_content, :glm_source).merge(extra_params)
:country, :glm_content, :glm_source).merge(extra_params)
end
def extra_params
......
......@@ -16,10 +16,6 @@
.form-group.col-sm-12.gl-select2-html5-required-fix
= label_tag :company_size, s_('Trial|Number of employees'), for: :company_size, class: 'col-form-label'
= select_tag :company_size, company_size_options_for_select(params[:company_size]), class: 'js-trial-field select2', required: true
.row
.form-group.col-sm-12
= label_tag :number_of_users, s_('Trial|How many employees will use Gitlab?'), for: :number_of_users, class: 'col-form-label'
= number_field_tag :number_of_users, params[:number_of_users], class: 'form-control js-trial-field', required: true, min: 1
.row
.form-group.col-sm-12
= label_tag :phone_number, s_('Trial|Telephone number'), for: :phone_number, class: 'col-form-label'
......
......@@ -15,7 +15,7 @@
= render 'errors'
= form_tag create_lead_trials_path(glm_params), method: :post, id: "new_trial" do |f|
= form_tag create_lead_trials_path(glm_params), method: :post, id: "new_trial" do |_f|
.form-row
.col-12.col-sm-6.form-group
= label_tag :first_name, s_('Trial|First name'), for: :first_name, class: 'col-form-label'
......@@ -26,13 +26,9 @@
.form-group
= label_tag :company_name, s_('Trial|Company name'), for: :company_name, class: 'col-form-label'
= text_field_tag :company_name, params[:company_name] || current_user.organization, class: 'form-control gl-form-input', required: true, data: { qa_selector: 'company_name' }
.form-row
.col-12.col-sm-6.form-group.gl-select2-html5-required-fix
= label_tag :company_size, s_('Trial|Number of employees'), for: :company_size, class: 'col-form-label'
= select_tag :company_size, company_size_options_for_select(params[:company_size]), class: 'select2', required: true, data: { qa_selector: 'number_of_employees' }
.col-12.col-sm-6.form-group
= label_tag :number_of_users, s_('Trial|Number of trial users'), for: :number_of_users, class: 'col-form-label'
= number_field_tag :number_of_users, params[:number_of_users], class: 'form-control gl-border-gray-400', required: true, min: 1, data: { qa_selector: 'number_of_users' }
.form-group.gl-select2-html5-required-fix
= label_tag :company_size, s_('Trial|Number of employees'), for: :company_size, class: 'col-form-label'
= select_tag :company_size, company_size_options_for_select(params[:company_size]), class: 'select2', required: true, data: { qa_selector: 'number_of_employees' }
.form-group.gl-select2-html5-required-fix
= render 'select_country'
.form-group
......
......@@ -129,7 +129,6 @@ RSpec.describe Registrations::GroupsController do
company_name: 'ACME',
company_size: '1-99',
phone_number: '11111111',
number_of_users: '17',
country: 'Norway'
}
end
......
......@@ -184,7 +184,6 @@ RSpec.describe TrialsController, :saas do
first_name: user.first_name,
last_name: user.last_name,
phone_number: '1111111111',
number_of_users: '20',
country: 'IN',
glm_content: 'free-billing',
glm_source: 'about.gitlab.com'
......@@ -210,7 +209,6 @@ RSpec.describe TrialsController, :saas do
first_name: user.first_name,
last_name: user.last_name,
phone_number: '1111111111',
number_of_users: '20',
country: 'IN',
glm_content: 'free-billing',
glm_source: 'about.gitlab.com',
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'GitLab.com Google Analytics DataLayer', :js do
let!(:google_tag_manager_id) { 'GTM-WWKMTWS'}
let!(:user_attrs) { attributes_for(:user, first_name: 'GitLab', last_name: 'GitLab', company_name: 'GitLab', phone_number: '555-555-5555', number_of_users: 10) }
let!(:user_attrs) { attributes_for(:user, first_name: 'GitLab', last_name: 'GitLab', company_name: 'GitLab', phone_number: '555-555-5555') }
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
......@@ -71,12 +71,11 @@ RSpec.describe 'GitLab.com Google Analytics DataLayer', :js do
evaluate_script('document.getElementById("new_trial").addEventListener("submit", e => e.preventDefault())')
fill_in 'first_name', with: user_attrs[:first_name]
fill_in 'last_name', with: user_attrs[:last_name]
fill_in 'company_name', with: user_attrs[:company_name]
fill_in 'first_name', with: user_attrs[:first_name]
fill_in 'last_name', with: user_attrs[:last_name]
fill_in 'company_name', with: user_attrs[:company_name]
evaluate_script("document.getElementById('company_size').value = '1-99'")
fill_in 'phone_number', with: user_attrs[:phone_number]
fill_in 'number_of_users', with: user_attrs[:number_of_users]
fill_in 'phone_number', with: user_attrs[:phone_number]
evaluate_script("document.getElementById('country_select').value = 'US'")
click_button 'Continue'
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'User sees new onboarding flow', :js do
include Select2Helper
let_it_be(:user) { create(:user) }
let_it_be(:trial_fields) { ['Company name', 'Number of employees', 'How many employees will use Gitlab?', 'Telephone number', 'Country'] }
let_it_be(:trial_fields) { ['Company name', 'Number of employees', 'Telephone number', 'Country'] }
before do
allow(Gitlab).to receive(:com?).and_return(true)
......@@ -58,7 +58,6 @@ RSpec.describe 'User sees new onboarding flow', :js do
# submit the trial form
fill_in 'company_name', with: 'GitLab'
select2 '1-99', from: '#company_size'
fill_in 'number_of_users', with: '1'
fill_in 'phone_number', with: '+1234567890'
select2 'US', from: '#country_select'
......
......@@ -29,7 +29,6 @@ RSpec.describe 'Trial Capture Lead', :js do
fill_in 'company_name', with: 'GitLab'
select2 '1-99', from: '#company_size'
fill_in 'phone_number', with: '+1 23 456-78-90'
fill_in 'number_of_users', with: '1'
select2 'US', from: '#country_select'
click_button 'Continue'
......@@ -43,14 +42,11 @@ RSpec.describe 'Trial Capture Lead', :js do
before do
fill_in 'company_name', with: 'GitLab'
select2 '1-99', from: '#company_size'
fill_in 'number_of_users', with: '1'
select2 'US', from: '#country_select'
end
context 'without phone number' do
it 'shows validation error' do
fill_in 'number_of_users', with: '1'
click_button 'Continue'
message = page.find('#phone_number').native.attribute('validationMessage')
......@@ -62,7 +58,6 @@ RSpec.describe 'Trial Capture Lead', :js do
context 'with invalid phone number format' do
it 'shows validation error' do
fill_in 'number_of_users', with: '1'
invalid_phone_numbers = [
'+1 (121) 22-12-23',
'+12190AX ',
......@@ -82,19 +77,6 @@ RSpec.describe 'Trial Capture Lead', :js do
end
end
end
context 'and enters negative number to the number of users field' do
it 'shows validation error' do
fill_in 'number_of_users', with: '-1'
click_button 'Continue'
message = page.find('#number_of_users').native.attribute('validationMessage')
expect(message).to eq('Value must be greater than or equal to 1.')
expect(current_path).to eq(new_trial_path)
end
end
end
end
end
......@@ -37292,18 +37292,12 @@ msgstr ""
msgid "Trial|GitLab Ultimate trial (optional)"
msgstr ""
msgid "Trial|How many employees will use Gitlab?"
msgstr ""
msgid "Trial|Last name"
msgstr ""
msgid "Trial|Number of employees"
msgstr ""
msgid "Trial|Number of trial users"
msgstr ""
msgid "Trial|Please select a country"
msgstr ""
......
......@@ -12,7 +12,6 @@ module QA
text_field :company_name, id: 'company_name'
select :number_of_employees, id: 'company_size'
text_field :telephone_number, id: 'phone_number'
text_field :number_of_users, id: 'number_of_users'
select :country, id: 'country_select'
......
......@@ -15,7 +15,6 @@ module QA
let(:company_name) { 'QA Test Company' }
let(:number_of_employees) { '500 - 1,999' }
let(:telephone_number) { '555-555-5555' }
let(:number_of_users) { 600 }
let(:country) { 'United States of America' }
let(:group) { Resource::Group.fabricate_via_api! }
......@@ -46,7 +45,6 @@ module QA
new.company_name = company_name
new.number_of_employees = number_of_employees
new.telephone_number = telephone_number
new.number_of_users = number_of_users
new.country = country
new.continue
......
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