diff --git a/.circleci/config.yml b/.circleci/config.yml index 1b58c5a2a..6f72fafc4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ # version: 2.1 orbs: - browser-tools: circleci/browser-tools@1.4.2 + browser-tools: circleci/browser-tools@1.4.3 jobs: build: @@ -50,8 +50,8 @@ jobs: - run: name: Setup Chrome command: | - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb - sudo apt install ./google-chrome-stable_current_amd64.deb + wget https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_114.0.5735.198-1_amd64.deb + sudo apt install ./google-chrome-stable_114.0.5735.198-1_amd64.deb # run tests! - run: diff --git a/Gemfile b/Gemfile index efd5fb7fb..ed5fedb9e 100644 --- a/Gemfile +++ b/Gemfile @@ -97,7 +97,7 @@ group :test do gem 'factory_bot_rails' gem 'rails-controller-testing' gem 'rspec-rails', '>=6.0.3' - gem 'selenium-webdriver', ">=4.10.0" + gem 'selenium-webdriver' gem 'simplecov', require: false gem 'webdrivers', '>= 5.1.0' end diff --git a/Gemfile.lock b/Gemfile.lock index bff071e4f..1e3987979 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,47 +18,47 @@ GEM aasm-diagram (0.1.3) aasm (~> 5.0, >= 4.12) ruby-graphviz (~> 1.2) - actioncable (7.0.6) - actionpack (= 7.0.6) - activesupport (= 7.0.6) + actioncable (7.0.7) + actionpack (= 7.0.7) + activesupport (= 7.0.7) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.6) - actionpack (= 7.0.6) - activejob (= 7.0.6) - activerecord (= 7.0.6) - activestorage (= 7.0.6) - activesupport (= 7.0.6) + actionmailbox (7.0.7) + actionpack (= 7.0.7) + activejob (= 7.0.7) + activerecord (= 7.0.7) + activestorage (= 7.0.7) + activesupport (= 7.0.7) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.6) - actionpack (= 7.0.6) - actionview (= 7.0.6) - activejob (= 7.0.6) - activesupport (= 7.0.6) + actionmailer (7.0.7) + actionpack (= 7.0.7) + actionview (= 7.0.7) + activejob (= 7.0.7) + activesupport (= 7.0.7) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.6) - actionview (= 7.0.6) - activesupport (= 7.0.6) + actionpack (7.0.7) + actionview (= 7.0.7) + activesupport (= 7.0.7) rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.6) - actionpack (= 7.0.6) - activerecord (= 7.0.6) - activestorage (= 7.0.6) - activesupport (= 7.0.6) + actiontext (7.0.7) + actionpack (= 7.0.7) + activerecord (= 7.0.7) + activestorage (= 7.0.7) + activesupport (= 7.0.7) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.6) - activesupport (= 7.0.6) + actionview (7.0.7) + activesupport (= 7.0.7) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -68,22 +68,22 @@ GEM activemodel (>= 4.1, < 7.1) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) - activejob (7.0.6) - activesupport (= 7.0.6) + activejob (7.0.7) + activesupport (= 7.0.7) globalid (>= 0.3.6) - activemodel (7.0.6) - activesupport (= 7.0.6) - activerecord (7.0.6) - activemodel (= 7.0.6) - activesupport (= 7.0.6) - activestorage (7.0.6) - actionpack (= 7.0.6) - activejob (= 7.0.6) - activerecord (= 7.0.6) - activesupport (= 7.0.6) + activemodel (7.0.7) + activesupport (= 7.0.7) + activerecord (7.0.7) + activemodel (= 7.0.7) + activesupport (= 7.0.7) + activestorage (7.0.7) + actionpack (= 7.0.7) + activejob (= 7.0.7) + activerecord (= 7.0.7) + activesupport (= 7.0.7) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.6) + activesupport (7.0.7) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -96,10 +96,10 @@ GEM aes_key_wrap (1.1.0) ast (2.4.2) aws-eventstream (1.2.0) - aws-partitions (1.800.0) + aws-partitions (1.805.0) aws-record (2.11.0) aws-sdk-dynamodb (~> 1, >= 1.85.0) - aws-sdk-core (3.180.2) + aws-sdk-core (3.180.3) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.5) @@ -115,7 +115,7 @@ GEM aws-sessionstore-dynamodb (~> 2) concurrent-ruby (~> 1) railties (>= 5.2.0) - aws-sdk-ses (1.54.0) + aws-sdk-ses (1.55.0) aws-sdk-core (~> 3, >= 3.177.0) aws-sigv4 (~> 1.1) aws-sdk-sesv2 (1.38.0) @@ -277,7 +277,7 @@ GEM method_source (1.0.0) mime-types (3.5.0) mime-types-data (~> 3.2015) - mime-types-data (3.2023.0218.1) + mime-types-data (3.2023.0808) mini_magick (4.12.0) mini_mime (1.1.5) mini_portile2 (2.8.4) @@ -297,10 +297,10 @@ GEM net-protocol newrelic_rpm (9.3.1) nio4r (2.5.9) - nokogiri (1.15.3) + nokogiri (1.15.4) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.15.3-x86_64-darwin) + nokogiri (1.15.4-x86_64-darwin) racc (~> 1.4) oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) @@ -342,20 +342,20 @@ GEM rack (~> 2.2, >= 2.2.4) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.6) - actioncable (= 7.0.6) - actionmailbox (= 7.0.6) - actionmailer (= 7.0.6) - actionpack (= 7.0.6) - actiontext (= 7.0.6) - actionview (= 7.0.6) - activejob (= 7.0.6) - activemodel (= 7.0.6) - activerecord (= 7.0.6) - activestorage (= 7.0.6) - activesupport (= 7.0.6) + rails (7.0.7) + actioncable (= 7.0.7) + actionmailbox (= 7.0.7) + actionmailer (= 7.0.7) + actionpack (= 7.0.7) + actiontext (= 7.0.7) + actionview (= 7.0.7) + activejob (= 7.0.7) + activemodel (= 7.0.7) + activerecord (= 7.0.7) + activestorage (= 7.0.7) + activesupport (= 7.0.7) bundler (>= 1.15.0) - railties (= 7.0.6) + railties (= 7.0.7) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -372,9 +372,9 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.0.6) - actionpack (= 7.0.6) - activesupport (= 7.0.6) + railties (7.0.7) + actionpack (= 7.0.7) + activesupport (= 7.0.7) method_source rake (>= 12.2) thor (~> 1.0) @@ -436,7 +436,7 @@ GEM activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) - rubocop-rspec (2.23.0) + rubocop-rspec (2.23.2) rubocop (~> 1.33) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) @@ -570,7 +570,7 @@ DEPENDENCIES rubocop-rails rubocop-rspec sass-rails (>= 6.0.0) - selenium-webdriver (>= 4.10.0) + selenium-webdriver sidekiq simplecov sprockets-rails diff --git a/app/controllers/admin/cscrm_data_collections2_controller.rb b/app/controllers/admin/cscrm_data_collections2_controller.rb index d06c76e8d..bd91cfa8f 100644 --- a/app/controllers/admin/cscrm_data_collections2_controller.rb +++ b/app/controllers/admin/cscrm_data_collections2_controller.rb @@ -15,7 +15,7 @@ def index if cscrm_manager_permissions? @cscrm_data_collections = CscrmDataCollection2.all.includes(:organization) else - @cscrm_data_collections = current_user.organization.cscrm_data_collections.all.includes(:organization) + @cscrm_data_collections = current_user.organization.cscrm_data_collections2.all.includes(:organization) end } format.csv { @@ -71,7 +71,7 @@ def update def submit @cscrm_data_collection.submit! Event.log_event(Event.names[:cscrm_data_collection_collection_submitted], 'CSRCM Data Collection', @cscrm_data_collection.id, "CSRCM Data Collection #{@cscrm_data_collection.id} submitted at #{DateTime.now}", current_user.id) - UserMailer.cscrm_data_collection_notification(collection_id: @cscrm_data_collection.id).deliver_later + UserMailer.cscrm_data_collection2_notification(collection_id: @cscrm_data_collection.id).deliver_later redirect_to admin_cscrm_data_collections2_path(@cscrm_data_collection), notice: 'CSRCM Data Collection has been submitted successfully.' end @@ -94,7 +94,7 @@ def destroy Event.log_event(Event.names[:cscrm_data_collection_collection_deleted], 'CSRCM Data Collection', @cscrm_data_collection.id, "CSRCM Data Collection #{@cscrm_data_collection.id} deleted at #{DateTime.now}", current_user.id) respond_to do |format| - format.html { redirect_to admin_cscrm_data_collections_url, notice: 'Cscrm data collection was successfully destroyed.' } + format.html { redirect_to admin_cscrm_data_collections2_index_url, notice: 'Cscrm data collection was successfully destroyed.' } format.json { head :no_content } end end diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 7f2373abc..0a1e5c5a3 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -48,7 +48,7 @@ def collection_notification(collection_id:) mail subject: "Data Collection notification to #{@collection.name}", to: (ENV.fetch('TOUCHPOINTS_ADMIN_EMAILS').split(',') + User.performance_managers.collect(&:email)).uniq end - + def cscrm_data_collection_notification(collection_id:) set_logo @collection = CscrmDataCollection.find(collection_id) @@ -56,6 +56,13 @@ def cscrm_data_collection_notification(collection_id:) to: (ENV.fetch('TOUCHPOINTS_ADMIN_EMAILS').split(',') + User.where(cscrm_data_collection_manager: true).collect(&:email)).uniq end + def cscrm_data_collection2_notification(collection_id:) + set_logo + @collection = CscrmDataCollection2.find(collection_id) + mail subject: "CSCRM Data Collection 2 notification to #{@collection.id}", + to: (ENV.fetch('TOUCHPOINTS_ADMIN_EMAILS').split(',') + User.where(cscrm_data_collection_manager: true).collect(&:email)).uniq + end + def quarterly_performance_notification(collection_id:) set_logo @collection = Collection.find(collection_id) @@ -131,7 +138,7 @@ def website_data_collection(email, websites) @websites = websites mail subject: 'Website Data Collection Request', to: email end - + def website_backlog_data_collection(email, websites) return unless email diff --git a/app/views/user_mailer/cscrm_data_collection2_notification.html.erb b/app/views/user_mailer/cscrm_data_collection2_notification.html.erb new file mode 100644 index 000000000..b37f26494 --- /dev/null +++ b/app/views/user_mailer/cscrm_data_collection2_notification.html.erb @@ -0,0 +1,15 @@ +<%= render 'user_mailer/components/header' %> +

+ CSCRM Data Collection Notification +

+

+ Updates to the CSCRM Data Collection, + <%= @collection.id %> + have occurred. +

+

+ Visit + + <%= admin_cscrm_data_collections2_url(@collection) %> + to view. +

diff --git a/app/views/user_mailer/cscrm_data_collection2_notification.text.erb b/app/views/user_mailer/cscrm_data_collection2_notification.text.erb new file mode 100644 index 000000000..85c02c0a7 --- /dev/null +++ b/app/views/user_mailer/cscrm_data_collection2_notification.text.erb @@ -0,0 +1,5 @@ +Touchpoints.gov CSCRM Data Collection 2 Notification + +Updates to the CSCRM Data Collection 2, <%= @collection.id %> have occurred. + +Visit <%= admin_cscrm_data_collections2_index_url(@collection) %> to view. diff --git a/spec/factories/cscrm_data_collection2.rb b/spec/factories/cscrm_data_collection2.rb new file mode 100644 index 000000000..997a7bb89 --- /dev/null +++ b/spec/factories/cscrm_data_collection2.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :cscrm_data_collection2 do + year { 2023 } + quarter { 4 } + end +end diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb index b604d67aa..8a8d527fd 100644 --- a/spec/mailers/user_mailer_spec.rb +++ b/spec/mailers/user_mailer_spec.rb @@ -88,7 +88,7 @@ expect(mail.body.encoded).to match('Quarterly Performance Notification') end end - + describe 'CSCRM Data Collection' do let!(:organization) { FactoryBot.create(:organization) } let!(:user) { FactoryBot.create(:user, organization:) } @@ -111,6 +111,28 @@ end end + describe 'CSCRM Data Collection 2' do + let!(:organization) { FactoryBot.create(:organization) } + let!(:user) { FactoryBot.create(:user, organization:) } + let!(:cscrm_data_manager) { FactoryBot.create(:user, organization:, cscrm_data_collection_manager: true) } + let!(:cscrm_data_collection2) { FactoryBot.create(:cscrm_data_collection2, organization:, user:) } + let(:mail) { UserMailer.cscrm_data_collection2_notification(collection_id: cscrm_data_collection2.id) } + + before do + ENV['ENABLE_EMAIL_NOTIFICATIONS'] = 'true' + end + + it 'renders the headers' do + expect(mail.subject).to eq("CSCRM Data Collection 2 notification to #{cscrm_data_collection2.id}") + expect(mail.to).to eq([ENV.fetch('TOUCHPOINTS_ADMIN_EMAILS'), cscrm_data_manager.email]) + expect(mail.from).to eq([ENV.fetch('TOUCHPOINTS_EMAIL_SENDER')]) + end + + it 'renders the body' do + expect(mail.body.encoded).to match('CSCRM Data Collection 2 Notification') + end + end + describe 'account_deactivation_scheduled_notification' do let!(:organization) { FactoryBot.create(:organization) } let(:user) { FactoryBot.create(:user, organization:) }