Commit 43b6f69c authored by Alper Akgun's avatar Alper Akgun

Merge branch 'registration-remove-default-role' into 'master'

Registration Flow - Don't pre-select role

See merge request gitlab-org/gitlab!76051
parents 68d1ea85 81fea3be
......@@ -22,7 +22,7 @@
.row
.form-group.col-sm-12
= f.label :role, _('Role'), class: 'label-bold'
= f.select :role, ::User.roles.keys.map { |role| [role.titleize, role] }, {}, class: 'form-control js-user-role-dropdown', autofocus: true
= f.select :role, ::User.roles.keys.map { |role| [role.titleize, role] }, { include_blank: _('Select a role') }, class: 'form-control js-user-role-dropdown', autofocus: true, required: true
- if Feature.enabled?(:user_other_role_details)
.row
.form-group.col-sm-12.js-other-role-group.hidden
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe 'Welcome screen', :js do
let_it_be(:user) { create(:user) }
let_it_be(:user) { create(:user, role: nil) }
context 'when on GitLab.com' do
before do
......@@ -18,9 +18,24 @@ RSpec.describe 'Welcome screen', :js do
it 'shows the welcome page' do
expect(page).to have_content('Welcome to GitLab')
expect(page).to have_content('Select a role')
expect(page).to have_content('Continue')
end
it 'has validations' do
click_button 'Continue'
expect(page).to have_field("user_role", valid: false)
expect(page).to have_field("user_setup_for_company_true", valid: false)
page.select('Software Developer', from: 'user_role')
choose 'user_setup_for_company_true'
click_button 'Continue'
expect(page).not_to have_selector('#user_role')
end
it 'allows specifying other for jobs_to_be_done' do
expect(page).not_to have_content('Why are you signing up? (Optional)')
......@@ -32,9 +47,12 @@ RSpec.describe 'Welcome screen', :js do
end
context 'email opt in' do
let(:user) { create(:user, email_opted_in: false) }
it 'does not show the email opt in checkbox when setting up for a company' do
expect(page).not_to have_selector('input[name="user[email_opted_in]', visible: true)
page.select('Software Developer', from: 'user_role')
choose 'user_setup_for_company_true'
expect(page).not_to have_selector('input[name="user[email_opted_in]', visible: true)
......@@ -44,9 +62,10 @@ RSpec.describe 'Welcome screen', :js do
expect(user.reload.email_opted_in).to eq(true)
end
it 'shows the email opt checkbox in when setting up for just me' do
it 'shows the email opt in checkbox when setting up for just me' do
expect(page).not_to have_selector('input[name="user[email_opted_in]', visible: true)
page.select('Software Developer', from: 'user_role')
choose 'user_setup_for_company_false'
expect(page).to have_selector('input[name="user[email_opted_in]', visible: true)
......
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