Skip to content

Commit

Permalink
Security questions pop up for employer sign ups (#2518) (#2529)
Browse files Browse the repository at this point in the history
* adds libraries to support jquery functions

* adds security questions pop up for employer sign ups

* adds security question cucumbers for employer registration

* quick fixes

Co-authored-by: Utkarsh Shukla <utkarsh7989@gmail.com>
  • Loading branch information
sri49 and utkarsh7989 authored Jan 10, 2024
1 parent 880cc97 commit 73205ed
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 8 deletions.
3 changes: 2 additions & 1 deletion app/assets/javascripts/ui-components/components.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require bootstrap.min
//= require bootstrap-treeview
//= require jquery.selectric.min
//= require bowser.min
//= require ./sweetalerts
//= require ./tether
Expand All @@ -13,4 +15,3 @@
//= require ./validators
//= require ./mask_inputs
//= require ./datepickerForInputs

Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

<script>

$('.security-question-select').selectric('refresh')
$('.security-question-select').on('change', function(){
var questionId = $(this).val();
var selectedQuestions = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
= raw v

= form_for @agency, as: :agency, url: {action: "create"}, html: { class: "needs-validation s508", id:'broker_registration_form', novalidate:true } do |f|

= f.hidden_field :profile_type, value: params[:profile_type]

= render 'shared/error_messages', :object => @agency
= f.fields_for :staff_roles, f.object.staff_roles, errors: {}, fieldset: false do |f|
= render partial: './ui-components/v1/forms/broker_registration/personal_information', locals: {f: f}

= f.fields_for :organization, f.object.organization, errors: {}, field_set: false do |f|
fieldset
legend Broker Agency Information
Expand All @@ -33,12 +33,11 @@

= f.submit 'CREATE BROKER AGENCY', class:'btn btn-primary float-right', id:'broker-btn'
- else
= render './users/security_question_responses/modal'
= form_for @agency, as: :agency, url: {action: "create"}, html: { class: "needs-validation s508", novalidate:true } do |f|
= f.hidden_field :profile_type, value: params[:profile_type]
= render 'benefit_sponsors/shared/error_messages', :object => @agency
= render './ui-components/v1/forms/employer_registration/employer_profile_form', f: f

javascript:
validateForm()
12 changes: 12 additions & 0 deletions features/employers/add_deductible_display_under_plan_year.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ Feature: Add Plan Year For Employer
Given a CCA site exists with a benefit market
Given SAFE benefit market catalog exists for enrollment_open initial employer with health benefits
Given the user is on the Employer Registration page
Given Security questions exist
And Jack Doe create a new account for employer
When the user fills out the security questions modal
When the user submitted the security questions
And the user is registering a new Employer
And all required fields have valid inputs on the Employer Registration Form
And the user clicks the 'Confirm' button on the Employer Registration Form
Expand All @@ -22,7 +25,10 @@ Feature: Add Plan Year For Employer
Given a CCA site exists with a benefit market
Given SAFE benefit market catalog exists for enrollment_open initial employer with health benefits
Given the user is on the Employer Registration page
Given Security questions exist
And Jack Doe create a new account for employer
When the user fills out the security questions modal
When the user submitted the security questions
And the user is registering a new Employer
And all required fields have valid inputs on the Employer Registration Form
And the user clicks the 'Confirm' button on the Employer Registration Form
Expand All @@ -40,7 +46,10 @@ Feature: Add Plan Year For Employer
Given a CCA site exists with a benefit market
Given SAFE benefit market catalog exists for enrollment_open initial employer with health benefits
Given the user is on the Employer Registration page
Given Security questions exist
And Jack Doe create a new account for employer
When the user fills out the security questions modal
When the user submitted the security questions
And the user is registering a new Employer
And all required fields have valid inputs on the Employer Registration Form
And the user clicks the 'Confirm' button on the Employer Registration Form
Expand All @@ -59,7 +68,10 @@ Feature: Add Plan Year For Employer
Given a CCA site exists with a benefit market
Given SAFE benefit market catalog exists for enrollment_open initial employer that has both health and dental benefits
Given the user is on the Employer Registration page
Given Security questions exist
And Jack Doe create a new account for employer
When the user fills out the security questions modal
When the user submitted the security questions
And the user is registering a new Employer
And all required fields have valid inputs on the Employer Registration Form
And the user clicks the 'Confirm' button on the Employer Registration Form
Expand Down
28 changes: 27 additions & 1 deletion features/support/worlds/form_world.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,33 @@ def fill_in_office_locations_for_broker_agecny
expect(find('#end_on').value.blank?).to eq false
end

Given(/^Security questions exist$/) do
(0..2).map do |num|
SecurityQuestion.create!(
:title => "Question ##{num}"
)
end
end

When(/^the user fills out the security questions modal$/) do
(0..2).each do |num|
within all('div.selectric-wrapper.selectric-security-question-select', visible: false)[num] do
sleep 1
find('.selectric').click
sleep 1
all('li')[-1].click
sleep 1
end

page.all('input').select { |input| input[:id] == "security_question_response_question_answer" }[num].set("Answer #{num + 1}")
end
end

When(/the user submitted the security questions$/) do
find('.modal-footer input[type="submit"]').click
sleep 1
end

And(/^the user is on the Employer Registration page$/) do
#visit '/benefit_sponsors/profiles/registrations/new?portal=true&profile_type=benefit_sponsor'
visit '/'
Expand Down Expand Up @@ -199,4 +226,3 @@ def fill_in_office_locations_for_broker_agecny
screenshot("register")
find('.btn', text: 'CONTINUE').click
end

0 comments on commit 73205ed

Please sign in to comment.